Emacs: why shell-command “git log” works, but “git shortlog” doesn't?

女生的网名这么多〃 提交于 2019-11-30 08:24:06

问题


I can't figure this out. Why do these behave differently:

(shell-command "git log")
(shell-command "git shortlog")

First one works as expected: returns 0 and prints stuff to shell output buffer. Second one returns 0 but prints nothing. Why is that?

Also

  1. both git log and git shortlog work perfectly in ansi-term
  2. both git log and git shortlog give a warning but still work in shell

回答1:


man git-shortlog

If no revisions are passed on the command line and either standard input is not a terminal or there is no current branch, git shortlog will output a summary of the log read from standard input, without reference to the current repository.

You must explicitly provide reference to work in your case,

Use, git shortlog HEAD instead.



来源:https://stackoverflow.com/questions/19741957/emacs-why-shell-command-git-log-works-but-git-shortlog-doesnt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!