aboutsummaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-13 10:41:54 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-13 10:41:54 -0700
commita613b534bca2d56f2ad67b3a7f0cf2b34f031260 (patch)
tree2a54a3d0666577bf01234e5771e16dec7ccb240d /diff-lib.c
parent4bdbfb15b2d2ad1fbe144dcde386e71bcdff91d0 (diff)
parent095ce9538b738db28d5e9a6e05d94c7e3f55f39d (diff)
downloadgit-a613b534bca2d56f2ad67b3a7f0cf2b34f031260.tar.gz
git-a613b534bca2d56f2ad67b3a7f0cf2b34f031260.tar.xz
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
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 2870de400..3b5f2242a 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -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;
}