Re: 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 29, 2011, 14:48 UTC
- Message-ID
- <loom.20110829T155805-331@post.gmane.org>
- In-Reply-To
- <CACsJy8DMqjMfb5wVMnsrZhP8yv2rF1wyQ6LM6b-PVcYY1SXkcQ@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds <at> gmail.com> writes:
> - is "file" above at top repo, or is it actually very/deep/path/to/a/file?
3 levels deep. Most parent dir (one after repo root) contains 20k files.
> - how many entries in the tree that contain "file"?
Sorry, didn't understand this.
> - how is "git ls-files | wc -l"?
$ time git ls-files | wc -l 603137
real 0m0.417s user 0m0.440s sys 0m0.060s
> - how about "time git diff branch another-branch -- file >/dev/null"? > That'd remove unpack-trees code.
Pretty fast: $ time git diff branch:file other_branch:file > /dev/null
real 0m0.278s user 0m0.210s sys 0m0.060s
One more test: git diff HEAD branch -- file > /dev/null
real 0m0.276s user 0m0.240s sys 0m0.030s
So the only troubled variant is `git diff branch -- file`.