1

See the following example (in the LLVM source tree cloned from https://github.com/llvm-mirror/llvm). Why sometimes the file names are printed and sometimes don't? Thanks.

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
user1424739
  • 11,937
  • 17
  • 63
  • 152

1 Answers1

1

Add the -f (or --showname) option to be sure to always see the filename in 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

As mentioned for that option:

By default the filename is shown if there is any line that came from a file with a different name, due to rename detection.

That must have been the case for Instruction.h, and not for Hello.cpp.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250