Re: Cygwin + git log = no pager!

2014-02-26 Thread Robert Dailey
On Wed, Feb 26, 2014 at 3:26 AM, Jeff King p...@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.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-26 Thread Robert Dailey
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.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-26 Thread Jeff King
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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-26 Thread Chris Packham
On 27/02/14 04:54, Robert Dailey wrote:
 On Wed, Feb 26, 2014 at 3:26 AM, Jeff King p...@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.
 

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-24 Thread Jeff King
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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-24 Thread Robert Dailey
On Mon, Feb 24, 2014 at 3:06 AM, Jeff King p...@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?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-23 Thread Robert Dailey
On Sat, Feb 22, 2014 at 1:39 AM, Chris Packham judge.pack...@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.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-23 Thread Chris Packham
On 24/02/14 09:33, Robert Dailey wrote:
 On Sat, Feb 22, 2014 at 1:39 AM, Chris Packham judge.pack...@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).


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cygwin + git log = no pager!

2014-02-21 Thread Robert Dailey
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.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cygwin + git log = no pager!

2014-02-21 Thread Chris Packham
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.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html