git log -L没有差异 [英] git log -L without diff
问题描述
我正在尝试使用 git log -L< start>,< end>:< filename>
,但我希望输出非常有限实际上只是哈希)。当--pretty以我想要的格式打印提交信息时,我没有找到一种不显示差异的方法...
例如。我试过的是:
git log --pretty = format:%H-s -L 70 ,70:./ arch / x86 / include / asm / irqflags.h
其中(根据manpage)-s被认为是压制diff的输出,但是输出是:
$ git log --pretty = format:%H-s -L 70,70:./ arch / x86 / include / asm / irqflags.h
6abcd98ffafbff81f0bfd7ee1d129e634af13245
diff --git a / include / asm-x86 / irqflags .hb / include / asm-x86 / irqflags.h
--- a / include / asm-x86 / irqflags.h
+++ b / include / asm-x86 / irqflags.h
@@ -1,2 +64,1 @@
- #ifdef CONFIG_X86_32
- #includeirqflags_32.h
+ {
96a388de5dc53a8b234b3fd41f3ae2cedc9ffd42
diff --git a / include / asm-x86 / irqflags.hb / include / asm-x86 / irqflags.h
- / dev / null
+++ b / include / asm-x86 / irqflags.h
@@ -0,0 +1,2 @@
+#ifdef CONFIG_X86_32
+#includeirqflags_32.h
我使用git版本2.10.2
-L
选项当前不是(显然永远不会)与 -s
/ - no-patch
,因为这段代码从 line_log_print
,从 log_tree_commit
的顶部< -L
有效。所述代码仅输出来自任何匹配提交的整个选择的行范围。 (也许你可以修补hack以服从差异输出选项。) (另一个明显的解决方法是使用 git rev-list 代替
git log
,除了 -L
没有正确地集成在第一位,所以 git rev-list
不处理它。)
I'm trying to use git log -L <start>,<end>:<filename>
but I would like to have very limited output (actually just hashes). While --pretty prints the commit info in the format I want, I did not find a way to not display the diff...
e.g. on linux-next what I tried is:
git log --pretty=format:"%H" -s -L 70,70:./arch/x86/include/asm/irqflags.h
where (according to the manpage) the -s is supposed to Supress the ouput of the diff, however the output is:
$ git log --pretty=format:"%H" -s -L 70,70:./arch/x86/include/asm/irqflags.h
6abcd98ffafbff81f0bfd7ee1d129e634af13245
diff --git a/include/asm-x86/irqflags.h b/include/asm-x86/irqflags.h
--- a/include/asm-x86/irqflags.h
+++ b/include/asm-x86/irqflags.h
@@ -1,2 +64,1 @@
-#ifdef CONFIG_X86_32
-# include "irqflags_32.h"
+{
96a388de5dc53a8b234b3fd41f3ae2cedc9ffd42
diff --git a/include/asm-x86/irqflags.h b/include/asm-x86/irqflags.h
--- /dev/null
+++ b/include/asm-x86/irqflags.h
@@ -0,0 +1,2 @@
+#ifdef CONFIG_X86_32
+# include "irqflags_32.h"
I am using git version 2.10.2
The -L
option is not currently (and apparently never was) compatible with -s
/ --no-patch
, because of this code called from line_log_print
, called from the top of log_tree_commit
when -L
is in effect. Said code simply outputs the entire chosen line-range from any matched commit. (You could patch the hack to obey the diff output options, perhaps.)
(The other obvious workaround would be to use git rev-list
instead of git log
, except that -L
is, as that first link notes, not properly integrated in the first place, so that git rev-list
does not handle it.)
这篇关于git log -L没有差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!