counsel-git-log produces "error code 1" #652

Closed
glucas opened this Issue Sep 6, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@glucas
Contributor

glucas commented Sep 6, 2016

Trying out counsel-git-log for the first time and I always get an error code. I'm running on Windows so my guess is some issue with my environment, but figured it is worth reporting.

@glucas

This comment has been minimized.

Show comment
Hide comment
@glucas

glucas Sep 6, 2016

Contributor

In the *counsel* buffer I found:

'GIT_PAGER' is not recognized as an internal or external command, operable program or batch file.

Looking at the source, I think the problem is setting GIT_PAGER in-line with with the git log command, in counsel-git-log-function. That won't work in a Windows cmd shell.

Contributor

glucas commented Sep 6, 2016

In the *counsel* buffer I found:

'GIT_PAGER' is not recognized as an internal or external command, operable program or batch file.

Looking at the source, I think the problem is setting GIT_PAGER in-line with with the git log command, in counsel-git-log-function. That won't work in a Windows cmd shell.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Sep 6, 2016

Owner

Just try running the same command in the shell. This is what counsel-git-log-function calls for input test:

$ GIT_PAGER=cat git log --grep 'test'
Owner

abo-abo commented Sep 6, 2016

Just try running the same command in the shell. This is what counsel-git-log-function calls for input test:

$ GIT_PAGER=cat git log --grep 'test'
@glucas

This comment has been minimized.

Show comment
Hide comment
@glucas

glucas Sep 6, 2016

Contributor

Thanks for the quick reply. I updated my comment above: my shell isn't bash so setting the variable this way doesn't work.

Not sure the best way to do this without depending on the Unix-style variable. This works with something like

cmd /C "set GIT_PAGER=cat && git log --grep 'test'"

to run the command in a separate shell. Otherwise something like setting and then reverting the variable would be necessary.

Maybe just requiring a bash-style shell is sufficient here. (Note however that counsel-git-grep etc work fine for me -- this is the first case I've hit where the shell is an issue.)

Contributor

glucas commented Sep 6, 2016

Thanks for the quick reply. I updated my comment above: my shell isn't bash so setting the variable this way doesn't work.

Not sure the best way to do this without depending on the Unix-style variable. This works with something like

cmd /C "set GIT_PAGER=cat && git log --grep 'test'"

to run the command in a separate shell. Otherwise something like setting and then reverting the variable would be necessary.

Maybe just requiring a bash-style shell is sufficient here. (Note however that counsel-git-grep etc work fine for me -- this is the first case I've hit where the shell is an issue.)

@abo-abo abo-abo closed this in b73264e Sep 6, 2016

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Sep 6, 2016

Owner

Customize counsel-git-log-cmd and see if it works. You're on Windows, right?

Owner

abo-abo commented Sep 6, 2016

Customize counsel-git-log-cmd and see if it works. You're on Windows, right?

@glucas

This comment has been minimized.

Show comment
Hide comment
@glucas

glucas Sep 6, 2016

Contributor

Yes, I'm on Windows.

Thanks, this works for me:

(setq counsel-git-log-cmd "git log --grep \"%s\"")

This also works:

(setq counsel-git-log-cmd "set GIT_PAGER=cat && git log --grep \"%s\"")
Contributor

glucas commented Sep 6, 2016

Yes, I'm on Windows.

Thanks, this works for me:

(setq counsel-git-log-cmd "git log --grep \"%s\"")

This also works:

(setq counsel-git-log-cmd "set GIT_PAGER=cat && git log --grep \"%s\"")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment