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

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

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

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

glucas opened this issue Sep 6, 2016 · 5 comments

Comments

@glucas
Copy link
Contributor

@glucas 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
Copy link
Contributor Author

@glucas 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
Copy link
Owner

@abo-abo 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
Copy link
Contributor Author

@glucas 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
Copy link
Owner

@abo-abo abo-abo commented Sep 6, 2016

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

@glucas
Copy link
Contributor Author

@glucas 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.