Merge branch 'jc/fix-diff-files-unmerged' into maint

* jc/fix-diff-files-unmerged:
  diff-files: show unmerged entries correctly
  diff: remove often unused parameters from diff_unmerge()
  diff.c: return filepair from diff_unmerge()
  test: use $_z40 from test-lib
This commit is contained in:
Junio C Hamano
2011-05-13 10:41:54 -07:00
16 changed files with 120 additions and 36 deletions

View File

@ -112,6 +112,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
if (ce_stage(ce)) {
struct combine_diff_path *dpath;
struct diff_filepair *pair;
unsigned int wt_mode = 0;
int num_compare_stages = 0;
size_t path_len;
@ -130,7 +132,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
changed = check_removed(ce, &st);
if (!changed)
dpath->mode = ce_mode_from_stat(ce, st.st_mode);
wt_mode = ce_mode_from_stat(ce, st.st_mode);
else {
if (changed < 0) {
perror(ce->name);
@ -138,7 +140,9 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
}
if (silent_on_removed)
continue;
wt_mode = 0;
}
dpath->mode = wt_mode;
while (i < entries) {
struct cache_entry *nce = active_cache[i];
@ -184,7 +188,9 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
* Show the diff for the 'ce' if we found the one
* from the desired stage.
*/
diff_unmerge(&revs->diffopt, ce->name, 0, null_sha1);
pair = diff_unmerge(&revs->diffopt, ce->name);
if (wt_mode)
pair->two->mode = wt_mode;
if (ce_stage(ce) != diff_unmerged_stage)
continue;
}
@ -373,8 +379,9 @@ static void do_oneway_diff(struct unpack_trees_options *o,
match_missing = !revs->ignore_merges;
if (cached && idx && ce_stage(idx)) {
diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode,
idx->sha1);
struct diff_filepair *pair;
pair = diff_unmerge(&revs->diffopt, idx->name);
fill_filespec(pair->one, idx->sha1, idx->ce_mode);
return;
}