diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-10 15:24:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-10 15:24:54 -0700 |
commit | 03adeeaad6c039aadda074de9509f4d845739d55 (patch) | |
tree | 826dba3c67172a391714d5d804dff638844e8025 /builtin/diff.c | |
parent | 423a9e28fc144624437cb00ce853b741891ae623 (diff) | |
parent | c479d14a80743b1cb86d77695607f4c81f7d8797 (diff) | |
download | git-03adeeaad6c039aadda074de9509f4d845739d55.tar.gz git-03adeeaad6c039aadda074de9509f4d845739d55.tar.xz |
Merge branch 'jk/maint-null-in-trees' into maint-1.7.11
"git diff" had a confusion between taking data from a path in the
working tree and taking data from an object that happens to have
name 0{40} recorded in a tree.
* jk/maint-null-in-trees:
fsck: detect null sha1 in tree entries
do not write null sha1s to on-disk index
diff: do not use null sha1 as a sentinel value
Diffstat (limited to 'builtin/diff.c')
-rw-r--r-- | builtin/diff.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/diff.c b/builtin/diff.c index da8f6aac2..bf7229875 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -29,6 +29,8 @@ static void stuff_change(struct diff_options *opt, unsigned old_mode, unsigned new_mode, const unsigned char *old_sha1, const unsigned char *new_sha1, + int old_sha1_valid, + int new_sha1_valid, const char *old_name, const char *new_name) { @@ -54,8 +56,8 @@ static void stuff_change(struct diff_options *opt, one = alloc_filespec(old_name); two = alloc_filespec(new_name); - fill_filespec(one, old_sha1, old_mode); - fill_filespec(two, new_sha1, new_mode); + fill_filespec(one, old_sha1, old_sha1_valid, old_mode); + fill_filespec(two, new_sha1, new_sha1_valid, new_mode); diff_queue(&diff_queued_diff, one, two); } @@ -84,6 +86,7 @@ static int builtin_diff_b_f(struct rev_info *revs, stuff_change(&revs->diffopt, blob[0].mode, canon_mode(st.st_mode), blob[0].sha1, null_sha1, + 1, 0, path, path); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); @@ -108,6 +111,7 @@ static int builtin_diff_blobs(struct rev_info *revs, stuff_change(&revs->diffopt, blob[0].mode, blob[1].mode, blob[0].sha1, blob[1].sha1, + 1, 1, blob[0].name, blob[1].name); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); |