1

请参阅以下示例(在从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
4

1 回答 1

1

添加-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

于 2019-01-16T06:03:39.097 回答