What's the difference between `git show branch:file | diff -u - file` vs `git diff branch file`?
- From
Marat Radchenko <marat@slonopotamus.org>
- Date
- Aug 23, 2011, 07:25 UTC
- Message-ID
- <loom.20110823T091132-107@post.gmane.org>
$ time git show branch:file | diff -u - file > /dev/null
real 0m0.003s user 0m0.000s sys 0m0.000s
$ time git diff branch -- file > /dev/null
real 0m31.442s user 0m31.040s sys 0m0.380s
What does git diff do so it takes that much time? And is there any flag to git diff so that it will work as fast as show + diff? I thought these two are equivalent but from run time it is obvious that they aren't.
gprof output: http://slonopotamus.org/git-diff/git-diff-branch.gprof.txt