Re: What's the difference between `git show branch:file | diff -u - file` vs `git diff branch file`?
On Tue, Aug 23, 2011 at 2:25 PM, Marat Radchenko <marat@slonopotamus.org> wrote:
Show 13 quoted lines
> $ 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?
You said elsewhere in this thread this is private repo, so some more questions:
- is "file" above at top repo, or is it actually very/deep/path/to/a/file?
- how many entries in the tree that contain "file"?
- how is "git ls-files | wc -l"?
- how about "time git diff branch another-branch -- file >/dev/null"?
That'd remove unpack-trees code.
--
Duy