为什么"git blame -e"有时会打印文件名,有时不打印?



请参阅以下示例(在从 https://github.com/llvm-mirror/llvm 克隆的LLVM源代码树中)。为什么有时打印文件名,有时不打印?谢谢。

llvm$ git blame -e  ./include/llvm/IR/Instruction.h
3a8b0f00e6d2 include/llvm/Instruction.h    (<sabre@nondot.org>                2002-09-10 15:36:11 +0000   1) //===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
9769ab22265b include/llvm/Instruction.h    (<brukman+llvm@gmail.com>          2005-04-21 20:19:05 +0000   2) //
6fbcc26f1460 include/llvm/Instruction.h    (<criswell@uiuc.edu>               2003-10-20 20:19:47 +0000   3) //                     The LLVM Compiler Infrastructure
llvm$ git blame -e ./lib/Transforms/Hello/Hello.cpp | head -n 3
180e568a7058 (<sabre@nondot.org>         2002-08-08 20:10:38 +0000  1) //===- Hello.cpp - Example code from "Writing an LLVM Pass" ---------------===//
fd93908ae8b9 (<brukman+llvm@gmail.com>   2005-04-21 23:48:37 +0000  2) //
b576c94c15af (<criswell@uiuc.edu>        2003-10-20 19:43:21 +0000  3) //                     The LLVM Compiler Infrastructure

添加-f(或--showname)选项以确保始终git blame中看到文件名。

 > git blame --show-name -e ./lib/Transforms/Hello/Hello.cpp | head -3
180e568a7058 lib/Transforms/Hello/Hello.cpp (<sabre@nondot.org>         2002-08-08 20:10:38 +0000  1) //===- Hello.cpp - Example code from "Writing an LLVM Pass" ---------------===//
fd93908ae8b9 lib/Transforms/Hello/Hello.cpp (<brukman+llvm@gmail.com>   2005-04-21 23:48:37 +0000  2) //
b576c94c15af lib/Transforms/Hello/Hello.cpp (<criswell@uiuc.edu>        2003-10-20 19:43:21 +0000  3) //                     The LLVM Compiler Infrastructure

如该选项所述:

默认情况下,如果

由于重命名检测,有任何行来自具有不同名称的文件,则会显示文件名。

Instruction.h一定是这样,而不是Hello.cpp

相关内容

  • 没有找到相关文章

最新更新