git/builtin
Nguyễn Thái Ngọc Duy a2b7a3b3a9 diff: support --cached on unborn branches
"git diff --cached" (without revision) used to mean "git diff --cached
HEAD" (i.e. the user was too lazy to type HEAD). This "correctly"
failed when there was no commit yet. But was that correctness useful?

This patch changes the definition of what particular command means.
It is a request to show what _would_ be committed without further "git
add". The internal implementation is the same "git diff --cached HEAD"
when HEAD exists, but when there is no commit yet, it compares the index
with an empty tree object to achieve the desired result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 15:04:30 -08:00
..
add.c Merge branch 'nd/maint-fix-add-typo-detection' (early part) 2010-12-08 11:25:52 -08:00
annotate.c
…
apply.c Merge branch 'fc/apply-p2-get-header-name' into maint 2010-12-09 10:36:36 -08:00
archive.c
…
bisect--helper.c
…
blame.c Merge branch 'jn/parse-options-extra' 2010-12-12 21:49:53 -08:00
branch.c builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc. 2010-12-19 10:43:53 -08:00
bundle.c
…
cat-file.c
…
check-attr.c
…
check-ref-format.c
…
checkout-index.c Merge branch 'jn/git-cmd-h-bypass-setup' 2010-12-12 21:49:50 -08:00
checkout.c
…
clean.c
…
clone.c
…
commit-tree.c
…
commit.c Merge branch 'maint' 2011-01-12 21:26:51 -08:00
config.c
…
count-objects.c
…
describe.c Merge branch 'tf/commit-list-prefix' 2010-12-22 14:40:17 -08:00
diff-files.c
…
diff-index.c
…
diff-tree.c
…
diff.c diff: support --cached on unborn branches 2011-02-07 15:04:30 -08:00
fast-export.c
…
fetch-pack.c
…
fetch.c Merge branch 'jl/fetch-submodule-recursive' 2010-12-16 12:57:15 -08:00
fmt-merge-msg.c
…
for-each-ref.c
…
fsck.c
…
gc.c Merge branch 'jn/git-cmd-h-bypass-setup' 2010-12-12 21:49:50 -08:00
grep.c thread-utils.h: simplify the inclusion 2010-12-10 12:58:06 -08:00
hash-object.c
…
help.c
…
index-pack.c
…
init-db.c Remove all logic from get_git_work_tree() 2010-12-22 14:34:24 -08:00
log.c Merge branch 'tc/format-patch-p' 2010-12-12 21:49:52 -08:00
ls-files.c Merge branch 'jn/git-cmd-h-bypass-setup' 2010-12-12 21:49:50 -08:00
ls-remote.c
…
ls-tree.c
…
mailinfo.c
…
mailsplit.c
…
merge-base.c
…
merge-file.c
…
merge-index.c
…
merge-ours.c
…
merge-recursive.c
…
merge-tree.c
…
merge.c Merge branch 'jn/git-cmd-h-bypass-setup' 2010-12-12 21:49:50 -08:00
mktag.c
…
mktree.c
…
mv.c
…
name-rev.c
…
notes.c Merge branch 'jh/notes-merge' 2010-12-08 11:24:12 -08:00
pack-objects.c thread-utils.h: simplify the inclusion 2010-12-10 12:58:06 -08:00
pack-redundant.c
…
pack-refs.c
…
patch-id.c
…
prune-packed.c
…
prune.c
…
push.c
…
read-tree.c
…
receive-pack.c
…
reflog.c
…
remote-ext.c remote-ext: do not segfault for blank lines 2011-01-18 10:18:25 -08:00
remote-fd.c
…
remote.c
…
replace.c
…
rerere.c
…
reset.c
…
rev-list.c
…
rev-parse.c
…
revert.c Merge branch 'jn/cherry-pick-refresh-index' into maint 2010-12-09 10:36:51 -08:00
rm.c builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc. 2010-12-19 10:44:06 -08:00
send-pack.c
…
shortlog.c parse-options: Don't call parse_options_check() so much 2010-12-06 16:51:36 -08:00
show-branch.c
…
show-ref.c
…
stripspace.c
…
symbolic-ref.c
…
tag.c Merge branch 'mg/maint-tag-rfc1991' 2010-12-08 11:24:13 -08:00
tar-tree.c
…
unpack-file.c
…
unpack-objects.c
…
update-index.c Merge branch 'jn/parse-options-extra' 2010-12-12 21:49:53 -08:00
update-ref.c
…
update-server-info.c
…
upload-archive.c
…
var.c
…
verify-pack.c
…
verify-tag.c Merge branch 'mg/maint-tag-rfc1991' 2010-12-08 11:24:13 -08:00
write-tree.c
…