* Cygwin + git log = no pager! @ 2014-02-22 5:18 Robert Dailey 2014-02-22 7:39 ` Chris Packham 0 siblings, 1 reply; 11+ messages in thread From: Robert Dailey @ 2014-02-22 5:18 UTC (permalink / raw) To: Git So it seems that the pager doesn't work by default when running `git log` from Cygwin like it does in msysgit for Windows. I know I can pipe to `less` but that requires the additional typing obviously. Does anyone know how I can get the pager to work in Cygwin for git log, reflog, and other commands like it does in msysgit? Thanks in advance. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-22 5:18 Cygwin + git log = no pager! Robert Dailey @ 2014-02-22 7:39 ` Chris Packham 2014-02-23 20:33 ` Robert Dailey 0 siblings, 1 reply; 11+ messages in thread From: Chris Packham @ 2014-02-22 7:39 UTC (permalink / raw) To: Robert Dailey, Git On 22/02/14 18:18, Robert Dailey wrote: > So it seems that the pager doesn't work by default when running `git > log` from Cygwin like it does in msysgit for Windows. > > I know I can pipe to `less` but that requires the additional typing > obviously. Does anyone know how I can get the pager to work in Cygwin > for git log, reflog, and other commands like it does in msysgit? > > Thanks in advance. Add GIT_PAGER=less to your environment. I don't know if you were using the cygwin packaged git or building from source but I'm surprised the pager is not set by default as you actually have to define the use of something other than less. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-22 7:39 ` Chris Packham @ 2014-02-23 20:33 ` Robert Dailey 2014-02-24 7:55 ` Chris Packham 0 siblings, 1 reply; 11+ messages in thread From: Robert Dailey @ 2014-02-23 20:33 UTC (permalink / raw) To: Chris Packham; +Cc: Git On Sat, Feb 22, 2014 at 1:39 AM, Chris Packham <judge.packham@gmail.com> wrote: > On 22/02/14 18:18, Robert Dailey wrote: >> So it seems that the pager doesn't work by default when running `git >> log` from Cygwin like it does in msysgit for Windows. >> >> I know I can pipe to `less` but that requires the additional typing >> obviously. Does anyone know how I can get the pager to work in Cygwin >> for git log, reflog, and other commands like it does in msysgit? >> >> Thanks in advance. > > Add GIT_PAGER=less to your environment. I don't know if you were using > the cygwin packaged git or building from source but I'm surprised the > pager is not set by default as you actually have to define the use of > something other than less. Thanks for the response. I did set this environment variable in my .bashrc like so: export GIT_PAGER=less However after I do a 'git log' it is just spitting it out all at once and not entering the pager. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-23 20:33 ` Robert Dailey @ 2014-02-24 7:55 ` Chris Packham 2014-02-24 9:06 ` Jeff King 0 siblings, 1 reply; 11+ messages in thread From: Chris Packham @ 2014-02-24 7:55 UTC (permalink / raw) To: Robert Dailey; +Cc: Git On 24/02/14 09:33, Robert Dailey wrote: > On Sat, Feb 22, 2014 at 1:39 AM, Chris Packham <judge.packham@gmail.com> wrote: >> On 22/02/14 18:18, Robert Dailey wrote: >>> So it seems that the pager doesn't work by default when running `git >>> log` from Cygwin like it does in msysgit for Windows. >>> >>> I know I can pipe to `less` but that requires the additional typing >>> obviously. Does anyone know how I can get the pager to work in Cygwin >>> for git log, reflog, and other commands like it does in msysgit? >>> >>> Thanks in advance. >> >> Add GIT_PAGER=less to your environment. I don't know if you were using >> the cygwin packaged git or building from source but I'm surprised the >> pager is not set by default as you actually have to define the use of >> something other than less. > > Thanks for the response. I did set this environment variable in my > .bashrc like so: > > export GIT_PAGER=less > > However after I do a 'git log' it is just spitting it out all at once > and not entering the pager. > Um OK that was the obvious thing to try. There is also the config variable core.pager but GIT_PAGER should take precedence. Could something be setting the environment variable LESS? Reading the git-config man page for core.pager git wants to set LESS to FRSX but if it is already set git takes that as an indication that you don't want to set LESS automatically. If neither of those help you probably want to let us know your cygwin version as well as your git version and how you installed git (i.e. built from source or installed via cygwin). ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-24 7:55 ` Chris Packham @ 2014-02-24 9:06 ` Jeff King 2014-02-24 19:34 ` Robert Dailey 0 siblings, 1 reply; 11+ messages in thread From: Jeff King @ 2014-02-24 9:06 UTC (permalink / raw) To: Chris Packham; +Cc: Robert Dailey, Git On Mon, Feb 24, 2014 at 08:55:41PM +1300, Chris Packham wrote: > > Thanks for the response. I did set this environment variable in my > > .bashrc like so: > > > > export GIT_PAGER=less > > > > However after I do a 'git log' it is just spitting it out all at once > > and not entering the pager. > > > > Um OK that was the obvious thing to try. There is also the config > variable core.pager but GIT_PAGER should take precedence. Presumably we are actually running what's in GIT_PAGER, but we can double-check with: GIT_PAGER='echo custom pager' git log You can also try: GIT_TRACE=1 git log which should describe the pager being run. > Could something be setting the environment variable LESS? Reading the > git-config man page for core.pager git wants to set LESS to FRSX but if > it is already set git takes that as an indication that you don't want to > set LESS automatically. We can also double-check the LESS setting in the executed pager: GIT_PAGER='echo LESS=$LESS' git log If we are running less, and it is using FRSX, I'd suspect some kind of terminal weirdness with less itself. With "-F", less will quit if the whole output can be displayed; it's possible it thinks the screen is bigger than it is. Trying: GIT_PAGER=less LESS=RSX git log might help. -Peff ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-24 9:06 ` Jeff King @ 2014-02-24 19:34 ` Robert Dailey 2014-02-26 9:26 ` Jeff King 0 siblings, 1 reply; 11+ messages in thread From: Robert Dailey @ 2014-02-24 19:34 UTC (permalink / raw) To: Jeff King; +Cc: Chris Packham, Git On Mon, Feb 24, 2014 at 3:06 AM, Jeff King <peff@peff.net> wrote: > On Mon, Feb 24, 2014 at 08:55:41PM +1300, Chris Packham wrote: > >> > Thanks for the response. I did set this environment variable in my >> > .bashrc like so: >> > >> > export GIT_PAGER=less >> > >> > However after I do a 'git log' it is just spitting it out all at once >> > and not entering the pager. >> > >> >> Um OK that was the obvious thing to try. There is also the config >> variable core.pager but GIT_PAGER should take precedence. > > Presumably we are actually running what's in GIT_PAGER, but we can > double-check with: > > GIT_PAGER='echo custom pager' git log > > You can also try: > > GIT_TRACE=1 git log > > which should describe the pager being run. > >> Could something be setting the environment variable LESS? Reading the >> git-config man page for core.pager git wants to set LESS to FRSX but if >> it is already set git takes that as an indication that you don't want to >> set LESS automatically. > > We can also double-check the LESS setting in the executed pager: > > GIT_PAGER='echo LESS=$LESS' git log > > If we are running less, and it is using FRSX, I'd suspect some kind of > terminal weirdness with less itself. With "-F", less will quit if the > whole output can be displayed; it's possible it thinks the screen is > bigger than it is. > > Trying: > > GIT_PAGER=less LESS=RSX git log > > might help. > > -Peff So I set GIT_PAGER to 'echo custom pager' as you instructed, and I noticed that wasn't being printed when I ran my git log alias. So what I did after that was set GIT_TRACE=1 and here is the output I see before my logs start printing: $ git lg trace: exec: 'git-lg' trace: run_command: 'git-lg' trace: run_command: 'git lg1' trace: exec: 'git-lg1' trace: run_command: 'git-lg1' trace: run_command: 'git short-log-base --branches --remotes --tags' trace: exec: 'git-short-log-base' '--branches' '--remotes' '--tags' trace: run_command: 'git-short-log-base' '--branches' '--remotes' '--tags' trace: alias expansion: short-log-base => 'log' '--graph' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset)%x09%C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)' trace: built-in: git 'log' '--graph' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset)%x09%C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)' '--branches' '--remotes' '--tags' Does using an alias have something to do with this? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-24 19:34 ` Robert Dailey @ 2014-02-26 9:26 ` Jeff King 2014-02-26 15:54 ` Robert Dailey 0 siblings, 1 reply; 11+ messages in thread From: Jeff King @ 2014-02-26 9:26 UTC (permalink / raw) To: Robert Dailey; +Cc: Chris Packham, Git On Mon, Feb 24, 2014 at 01:34:34PM -0600, Robert Dailey wrote: > So I set GIT_PAGER to 'echo custom pager' as you instructed, and I > noticed that wasn't being printed when I ran my git log alias. So what > I did after that was set GIT_TRACE=1 and here is the output I see > before my logs start printing: > [...] > Does using an alias have something to do with this? The aliases shouldn't matter (and I constructed a scenario like the one you showed and it starts the pager for me on Linux). It's more like git is deciding not to show a pager at all (e.g., it thinks your stdout is not a tty). Does running: git log not use a pager, but: git -p log does? In that case, I think that your stdout is not a tty for some reason. If that is the case, try: git -p lg That _should_ turn on the pager, but I think it does not due to a bug with setup_pager and aliases. Something like the patch below would make it work (but if you are having to use "-p" manually, there is something to fix in your cygwin environment, which does not think you are on a terminal). -Peff --- diff --git a/cache.h b/cache.h index dc040fb..ecc410e 100644 --- a/cache.h +++ b/cache.h @@ -1238,6 +1238,7 @@ static inline ssize_t write_str_in_full(int fd, const char *str) /* pager.c */ extern void setup_pager(void); +extern void setup_pager_with_options(int stdout_is_tty); extern const char *pager_program; extern int pager_in_use(void); extern int pager_use_color; diff --git a/git.c b/git.c index 7cf2953..ad54891 100644 --- a/git.c +++ b/git.c @@ -27,7 +27,7 @@ static void commit_pager_choice(void) { setenv("GIT_PAGER", "cat", 1); break; case 1: - setup_pager(); + setup_pager_with_options(1); break; default: break; diff --git a/pager.c b/pager.c index 0cc75a8..b28125d 100644 --- a/pager.c +++ b/pager.c @@ -62,7 +62,12 @@ const char *git_pager(int stdout_is_tty) void setup_pager(void) { - const char *pager = git_pager(isatty(1)); + setup_pager_with_options(isatty(1)); +} + +void setup_pager_with_options(int stdout_is_tty) +{ + const char *pager = git_pager(stdout_is_tty); if (!pager || pager_in_use()) return; ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-26 9:26 ` Jeff King @ 2014-02-26 15:54 ` Robert Dailey 2014-02-26 16:41 ` Robert Dailey ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Robert Dailey @ 2014-02-26 15:54 UTC (permalink / raw) To: Jeff King; +Cc: Chris Packham, Git On Wed, Feb 26, 2014 at 3:26 AM, Jeff King <peff@peff.net> wrote: > On Mon, Feb 24, 2014 at 01:34:34PM -0600, Robert Dailey wrote: > >> So I set GIT_PAGER to 'echo custom pager' as you instructed, and I >> noticed that wasn't being printed when I ran my git log alias. So what >> I did after that was set GIT_TRACE=1 and here is the output I see >> before my logs start printing: >> [...] >> Does using an alias have something to do with this? > > The aliases shouldn't matter (and I constructed a scenario like the one > you showed and it starts the pager for me on Linux). It's more like git > is deciding not to show a pager at all (e.g., it thinks your stdout is > not a tty). Does running: > > git log > > not use a pager, but: > > git -p log > > does? In that case, I think that your stdout is not a tty for some > reason. > > If that is the case, try: > > git -p lg > > That _should_ turn on the pager, but I think it does not due to a bug > with setup_pager and aliases. Something like the patch below would make > it work (but if you are having to use "-p" manually, there is something > to fix in your cygwin environment, which does not think you are on a > terminal). > > -Peff > > <snip> I have tried `git -p log` and `git log` and neither use the pager. Should I apply the provided patch to the Git for Windows master branch? Also I'm not sure if there is a convenient way to apply a patch via email, so should I copy & paste it to a file & then apply the file? I'm assuming your patch depended on -p working but not without it, so I'm not sure if you still think the patch might help. Let me know! Thanks for your help. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-26 15:54 ` Robert Dailey @ 2014-02-26 16:41 ` Robert Dailey 2014-02-27 6:21 ` Jeff King 2014-02-27 7:36 ` Chris Packham 2 siblings, 0 replies; 11+ messages in thread From: Robert Dailey @ 2014-02-26 16:41 UTC (permalink / raw) To: Jeff King; +Cc: Chris Packham, Git Copying the patch from the email text results in corrupted patch, something isn't quite right with it so it won't let me apply it. Can you attach it as an actual file so I can try again? Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-26 15:54 ` Robert Dailey 2014-02-26 16:41 ` Robert Dailey @ 2014-02-27 6:21 ` Jeff King 2014-02-27 7:36 ` Chris Packham 2 siblings, 0 replies; 11+ messages in thread From: Jeff King @ 2014-02-27 6:21 UTC (permalink / raw) To: Robert Dailey; +Cc: Chris Packham, Git On Wed, Feb 26, 2014 at 09:54:39AM -0600, Robert Dailey wrote: > > That _should_ turn on the pager, but I think it does not due to a bug > > with setup_pager and aliases. Something like the patch below would make > > it work (but if you are having to use "-p" manually, there is something > > to fix in your cygwin environment, which does not think you are on a > > terminal). > > I have tried `git -p log` and `git log` and neither use the pager. I thought Git's behavior was a bug, but it seems to be the intended effect that "-p" is just "cancel --no-pager" and not "turn on the pager, even if stdout is not a tty". So the patch I sent is not something we would want to apply, but it might help debugging your situation (if my hunch is right that isatty() is returning false, then "git -p log" would work with it). Or perhaps a simpler way to check that is just: diff --git a/pager.c b/pager.c index 0cc75a8..6d870ac 100644 --- a/pager.c +++ b/pager.c @@ -41,8 +41,10 @@ const char *git_pager(int stdout_is_tty) { const char *pager; - if (!stdout_is_tty) + if (!stdout_is_tty) { + warning("disabling pager, stdout is not a tty"); return NULL; + } pager = getenv("GIT_PAGER"); if (!pager) { > Should I apply the provided patch to the Git for Windows master > branch? Also I'm not sure if there is a convenient way to apply a > patch via email, so should I copy & paste it to a file & then apply > the file? The usual way is to save the patch to an mbox, then use "git am" to apply it. Most Unix-y mail clients have mbox support, but I suspect many Windows ones do not. -Peff ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Cygwin + git log = no pager! 2014-02-26 15:54 ` Robert Dailey 2014-02-26 16:41 ` Robert Dailey 2014-02-27 6:21 ` Jeff King @ 2014-02-27 7:36 ` Chris Packham 2 siblings, 0 replies; 11+ messages in thread From: Chris Packham @ 2014-02-27 7:36 UTC (permalink / raw) To: Robert Dailey, Jeff King; +Cc: Git, msysgit On 27/02/14 04:54, Robert Dailey wrote: > On Wed, Feb 26, 2014 at 3:26 AM, Jeff King <peff@peff.net> wrote: >> On Mon, Feb 24, 2014 at 01:34:34PM -0600, Robert Dailey wrote: >> >>> So I set GIT_PAGER to 'echo custom pager' as you instructed, and I >>> noticed that wasn't being printed when I ran my git log alias. So what >>> I did after that was set GIT_TRACE=1 and here is the output I see >>> before my logs start printing: >>> [...] >>> Does using an alias have something to do with this? >> >> The aliases shouldn't matter (and I constructed a scenario like the one >> you showed and it starts the pager for me on Linux). It's more like git >> is deciding not to show a pager at all (e.g., it thinks your stdout is >> not a tty). Does running: >> >> git log >> >> not use a pager, but: >> >> git -p log >> >> does? In that case, I think that your stdout is not a tty for some >> reason. >> >> If that is the case, try: >> >> git -p lg >> >> That _should_ turn on the pager, but I think it does not due to a bug >> with setup_pager and aliases. Something like the patch below would make >> it work (but if you are having to use "-p" manually, there is something >> to fix in your cygwin environment, which does not think you are on a >> terminal). >> >> -Peff >> >> <snip> > > I have tried `git -p log` and `git log` and neither use the pager. > Should I apply the provided patch to the Git for Windows master > branch? That may be relevant (refer to my previous questions about what version you're using and how you got it). Are you using git via cygwin or "Git For Windows"? I believe the two are different (*caveat* I haven't used windows in years and I've never used Git For Windows, I've added the msysgit list to this email thread). If you're executing the Git For Windows installation from the cygwin bash shell that's probably why the terminal detection is getting confused. If you've installed Git For Windows you should use the Git BASH shell that comes with it. If you want to use git with other bits of cygwin I suggest uninstalling Git For Windows and installing the git package via the cygwin setup tool. > Also I'm not sure if there is a convenient way to apply a > patch via email, so should I copy & paste it to a file & then apply > the file? Save the email file in your email client. Most support saving as plain text or RFC822 format. Then 'git am <filename>' should do the trick. > I'm assuming your patch depended on -p working but not without it, so > I'm not sure if you still think the patch might help. Let me know! > Thanks for your help. > ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-02-27 7:36 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-02-22 5:18 Cygwin + git log = no pager! Robert Dailey 2014-02-22 7:39 ` Chris Packham 2014-02-23 20:33 ` Robert Dailey 2014-02-24 7:55 ` Chris Packham 2014-02-24 9:06 ` Jeff King 2014-02-24 19:34 ` Robert Dailey 2014-02-26 9:26 ` Jeff King 2014-02-26 15:54 ` Robert Dailey 2014-02-26 16:41 ` Robert Dailey 2014-02-27 6:21 ` Jeff King 2014-02-27 7:36 ` Chris Packham
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.