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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user