summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-18 20:30:07 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-18 20:30:07 -0700
commite69a6f47c4e25a20170eb989a55257d0399f795b (patch)
tree4891b8d55a9d188ad695c7da5c35c3744d1909b6 /combine-diff.c
parentc4398286fa5245cf54d73f6016444179d73f140b (diff)
parenta5a818ee4877e4458e8e6741a03ac3b19941d58a (diff)
downloadgit-e69a6f47c4e25a20170eb989a55257d0399f795b.tar.gz
Merge branch 'jc/diff-prefix'
* jc/diff-prefix: diff: vary default prefix depending on what are compared
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c
index dcb90b1701..de83c6972e 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -683,9 +683,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
int i, show_hunks;
int working_tree_file = is_null_sha1(elem->sha1);
int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
+ const char *a_prefix, *b_prefix;
mmfile_t result_file;
context = opt->context;
+ a_prefix = opt->a_prefix ? opt->a_prefix : "a/";
+ b_prefix = opt->b_prefix ? opt->b_prefix : "b/";
+
/* Read the result of merge first */
if (!working_tree_file)
result = grab_blob(elem->sha1, &result_size);
@@ -861,13 +865,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
dump_quoted_path("--- ", "", "/dev/null",
c_meta, c_reset);
else
- dump_quoted_path("--- ", opt->a_prefix, elem->path,
+ dump_quoted_path("--- ", a_prefix, elem->path,
c_meta, c_reset);
if (deleted)
dump_quoted_path("+++ ", "", "/dev/null",
c_meta, c_reset);
else
- dump_quoted_path("+++ ", opt->b_prefix, elem->path,
+ dump_quoted_path("+++ ", b_prefix, elem->path,
c_meta, c_reset);
dump_sline(sline, cnt, num_parent,
DIFF_OPT_TST(opt, COLOR_DIFF));