Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pager is not utilized for aliases using '!' syntax to run git #85

Closed
rcdailey opened this issue Apr 9, 2015 · 10 comments
Closed

Pager is not utilized for aliases using '!' syntax to run git #85

rcdailey opened this issue Apr 9, 2015 · 10 comments

Comments

@rcdailey
Copy link

rcdailey commented Apr 9, 2015

I'm running the 3rd iteration of the developer preview.

When I run my git alias to show my log graph with special formatting, pagination is not being used when it should. I have core.pager set to less.

I have the following aliases in my .gitconfig:

[alias]
    short-log-base = log --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) | %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)'
    l = !git short-log-base

I have not verified this but I suspect the usage of ! to execute git to chain aliases together is the root cause. I say this because if I run git short-log-base, pagination works. But if I run git l, pagination does not work. In the logs below, I show the differences between the two. Note in the trace that less is not executed for the former example.

|-- robert@M5536:/e/code/frontend (timeline-ids) --|
$ GIT_TRACE=1 git l -1
14:09:51.997143 git.c:557               trace: exec: 'git-l' '-1'
14:09:51.997143 run-command.c:351       trace: run_command: 'git-l' '-1'
14:09:51.999147 run-command.c:351       trace: run_command: 'git short-log-base' '-1'
14:09:52.068563 git.c:557               trace: exec: 'git-short-log-base' '-1'
14:09:52.069564 run-command.c:351       trace: run_command: 'git-short-log-base' '-1'
14:09:52.070565 git.c:282               trace: alias expansion: short-log-base => 'log' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset) | %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)'
14:09:52.071565 git.c:348               trace: built-in: git 'log' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset) | %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)' '-1'
5a382db | (6 days ago) (HEAD, timeline-ids) Robert Dailey - [TOOLING] WIP: Backward compatibility option in LC for legacy timeline export

|-- robert@M5536:/e/code/frontend (timeline-ids) --|
$ GIT_TRACE=1 git short-log-base -1
14:10:18.343755 git.c:557               trace: exec: 'git-short-log-base' '-1'
14:10:18.344756 run-command.c:351       trace: run_command: 'git-short-log-base' '-1'
14:10:18.345757 git.c:282               trace: alias expansion: short-log-base => 'log' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset) | %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)'
14:10:18.346769 git.c:348               trace: built-in: git 'log' '--abbrev-commit' '--decorate' '--date=relative' '--format=format:%C(bold blue)%h%C(reset) | %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)%an%C(reset) - %C(white)%s%C(reset)' '-1'
14:10:18.367786 run-command.c:351       trace: run_command: 'less'
5a382db | (6 days ago) (HEAD, timeline-ids) Robert Dailey - [TOOLING] WIP: Backward compatibility option in LC for legacy timeline exp
@kblees
Copy link

kblees commented Apr 9, 2015

Could you try that in a native console window (cmd //c "start bash -li")? Sounds similar to the pager problems in a second mintty window (see issue #74).

Suspected cause: when git starts another process (which the '!' alias would do), it dup()licates the in/out/err descriptors (in run-command.c::start_command). This means that the in/out/err streams of the child process no longer match MSYS_TTY_HANDLES.

@dscho
Copy link
Member

dscho commented Apr 9, 2015

@kblees good analysis!

@kblees kblees mentioned this issue Apr 10, 2015
3 tasks
@rcdailey

This comment was marked as abuse.

@kblees
Copy link

kblees commented Apr 13, 2015

I ran the command from CMD in Windows and pager works as expected.

Thanks, so it seems to be caused by mintty as well...

so would this issue be specific to the Git for Windows project

Yes

or better reported to the original git mailing list

No

@dscho
Copy link
Member

dscho commented Apr 22, 2015

@rcdailey if you have not done so yet, could you please set up a Git SDK and test the kb/msys-tty branch: https://github.com/dscho/git/commits/kb/msys-tty -- it should fix this problem, but I'd like to read your confirmation that it does fix that.

@rcdailey

This comment was marked as abuse.

@dscho
Copy link
Member

dscho commented Apr 22, 2015

The git version shows what appears to be a shorthand SHA1 hash at the end, which doesn't align with what shows up on your branch

That's okay, you built the master of git-for-windows. Which is at a different SHA-1.

Thanks for the feedback! We can finally close this ticket, thanks to the excellent contribution of @kblees.

@dscho dscho closed this as completed Apr 22, 2015
@rcdailey

This comment was marked as abuse.

@dscho
Copy link
Member

dscho commented Apr 22, 2015

I switched to your branch and ran make

You probably wanted to run make install so that the newly built git.exe would be found on the $PATH.

@dscho
Copy link
Member

dscho commented Apr 22, 2015

if I was running a build off of master, that means I did not test your changes.

Not so. By the time you tested, I had merged the branch into master after running my own set of (unfortunately interactive) tests.

jeffhostetler pushed a commit to jeffhostetler/git that referenced this issue Jun 3, 2020
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this issue May 14, 2021
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this issue Jun 21, 2021
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this issue Aug 18, 2021
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this issue Jun 16, 2022
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this issue Jul 23, 2024
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this issue Jan 20, 2025
Most of these were done in private before microsoft/git. However,
the following pull requests modified the core feature:

	git-for-windows#85
	git-for-windows#89
	git-for-windows#91
	git-for-windows#98
	git-for-windows#243
	git-for-windows#263

Signed-off-by: Derrick Stolee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants