diff-files: show unmerged entries correctly
Earlier, e9c8409
(diff-index --cached --raw: show tree entry on the LHS
for unmerged entries., 2007-01-05) taught the command to show the object
name and the mode from the entry coming from the tree side when comparing
a tree with an unmerged index.
This is a belated companion patch that teaches diff-files to show the mode
from the entry coming from the working tree side, when comparing an
unmerged index and the working tree.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
10
diff-lib.c
10
diff-lib.c
@ -111,6 +111,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;
|
||||
|
||||
@ -129,7 +131,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);
|
||||
@ -137,7 +139,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];
|
||||
@ -183,7 +187,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);
|
||||
pair = diff_unmerge(&revs->diffopt, ce->name);
|
||||
if (wt_mode)
|
||||
pair->two->mode = wt_mode;
|
||||
if (ce_stage(ce) != diff_unmerged_stage)
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user