You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git log or git show does not work when setting pager.<cmd> in version 2.11.0(2) or later #1077
Does it really? Have you verified that args.argv[1] is the command (not the first parameter)?
diff-highlight | less: No such file or directory
This indicates to me that the pager.<cmd> value is interpreted as path, not as command-line. From the documentation, it is not clear that it was ever meant to refer to a command-line instead of a path...
However, from the source code it appears as if the value is actually passed to the shell, so it is a bit puzzling that it is not interpreted correctly.
it is a bit puzzling that it is not interpreted correctly.
The reason is that a special "we have arguments" handling kicks in because in the Windows case apparently not only argv[0] is set to the pager value, but also argv[1]. This is a bug. I am continuing to investigate.
I think this patch should also be applied, it is a fix for commit 382b41b.
It seems that commit 382b41b is copied from execv_dashed_external()without updating the index. In this scope, args.argv[0] is git and args.argv[1] (equals argv[0]) is a builtin command. Because get_builtin() returns non-NULL.
I chose to apply a slightly different patch, which also made the calls conciser and reordered to allow an early die() without having to initialize the args first.
Activity
dscho commentedon Mar 2, 2017
Does it really? Have you verified that
args.argv[1]is the command (not the first parameter)?This indicates to me that the
pager.<cmd>value is interpreted as path, not as command-line. From the documentation, it is not clear that it was ever meant to refer to a command-line instead of a path...However, from the source code it appears as if the value is actually passed to the shell, so it is a bit puzzling that it is not interpreted correctly.
dscho commentedon Mar 2, 2017
The reason is that a special "we have arguments" handling kicks in because in the Windows case apparently not only
argv[0]is set to the pager value, but alsoargv[1]. This is a bug. I am continuing to investigate.dscho commentedon Mar 2, 2017
Hah. The problem is that
isatty(1)returns non-zero even after the pager was started and stdout redirected.mingw: fix isatty() after dup2()
hattya commentedon Mar 3, 2017
Thank you for the fix!
I think this patch should also be applied, it is a fix for commit 382b41b.
It seems that commit 382b41b is copied from
execv_dashed_external()without updating the index. In this scope,args.argv[0]isgitandargs.argv[1](equalsargv[0]) is a builtin command. Becauseget_builtin()returns non-NULL.dscho commentedon Mar 3, 2017
@hattya Uh oh. I must have been real tired when I looked at your patch. You are absolutely correct! Thanks!
dscho commentedon Mar 3, 2017
BTW the code in question should only kick in after an alias was expanded. So I think you would need something like
git -c pager.log 'diff-highlight | less' -c alias.lg=log lg -1 -pto trigger that bug.
fixup! git: avoid calling aliased builtins via their dashed form
dscho commentedon Mar 3, 2017
I chose to apply a slightly different patch, which also made the calls conciser and reordered to allow an early
die()without having to initialize theargsfirst.hattya commentedon Mar 5, 2017
Sorry, I thought I tested with
git logandgit show, but their aliases...mingw: fix isatty() after dup2()
226 remaining items
mingw: fix isatty() after dup2()
mingw: fix isatty() after dup2()
mingw: fix isatty() after dup2()
mingw: fix isatty() after dup2()
mingw: fix isatty() after dup2()