diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-22 22:54:37 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-22 22:54:37 -0800 |
commit | 50f3ac29cbadbf7e0ff099b493b00cfa4129e1e0 (patch) | |
tree | 72b756b4c7d60709b7484cceeb3a1d82a18a86af /combine-diff.c | |
parent | builtin-reflog.c: fix typo that accesses an unset variable (diff) | |
parent | builtin-reflog.c: don't install new reflog on write failure (diff) | |
download | tgif-50f3ac29cbadbf7e0ff099b493b00cfa4129e1e0.tar.xz |
Merge branch 'bc/reflog-fix' into js/reflog-delete
* bc/reflog-fix: (1490 commits)
builtin-reflog.c: don't install new reflog on write failure
hash: fix lookup_hash semantics
gitweb: Better chopping in commit search results
builtin-tag.c: remove cruft
git-merge-index documentation: clarify synopsis
send-email: fix In-Reply-To regression
git-reset --hard and git-read-tree --reset: fix read_cache_unmerged()
Teach git-grep --name-only as synonym for -l
diff: fix java funcname pattern for solaris
t3404: use configured shell instead of /bin/sh
git_config_*: don't assume we are parsing a config file
prefix_path: use is_absolute_path() instead of *orig == '/'
git-clean: handle errors if removing files fails
Clarified the meaning of git-add -u in the documentation
git-clone.sh: properly configure remote even if remote's head is dangling
git.el: Set process-environment instead of invoking env
Documentation/git-stash: document options for git stash list
send-email: squelch warning due to comparing undefined $_ to ""
cvsexportcommit: be graceful when "cvs status" reorders the arguments
Rename git-core rpm to just git and rename the meta-pacakge to git-all.
...
Conflicts:
Documentation/git-reflog.txt
t/t1410-reflog.sh
Diffstat (limited to 'combine-diff.c')
-rw-r--r-- | combine-diff.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/combine-diff.c b/combine-diff.c index fe5a2a1953..0e19cbaacc 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -226,7 +226,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file, state.num_parent = num_parent; state.n = n; - xdl_diff(&parent_file, result_file, &xpp, &xecfg, &ecb); + xdi_diff(&parent_file, result_file, &xpp, &xecfg, &ecb); free(parent_file.ptr); /* Assign line numbers for this parent. @@ -646,12 +646,19 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt, sline->p_lno[i] = sline->p_lno[j]; } -static void dump_quoted_path(const char *prefix, const char *path, +static void dump_quoted_path(const char *head, + const char *prefix, + const char *path, const char *c_meta, const char *c_reset) { - printf("%s%s", c_meta, prefix); - quote_c_style(path, NULL, stdout, 0); - printf("%s\n", c_reset); + static struct strbuf buf = STRBUF_INIT; + + strbuf_reset(&buf); + strbuf_addstr(&buf, c_meta); + strbuf_addstr(&buf, head); + quote_two_c_style(&buf, prefix, path, 0); + strbuf_addstr(&buf, c_reset); + puts(buf.buf); } static void show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -664,7 +671,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, int mode_differs = 0; int i, show_hunks; int working_tree_file = is_null_sha1(elem->sha1); - int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV; + int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV; mmfile_t result_file; context = opt->context; @@ -784,7 +791,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, if (show_hunks || mode_differs || working_tree_file) { const char *abb; - int use_color = opt->color_diff; + int use_color = DIFF_OPT_TST(opt, COLOR_DIFF); const char *c_meta = diff_get_color(use_color, DIFF_METAINFO); const char *c_reset = diff_get_color(use_color, DIFF_RESET); int added = 0; @@ -793,7 +800,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, if (rev->loginfo && !rev->no_commit_id) show_log(rev, opt->msg_sep); dump_quoted_path(dense ? "diff --cc " : "diff --combined ", - elem->path, c_meta, c_reset); + "", elem->path, c_meta, c_reset); printf("%sindex ", c_meta); for (i = 0; i < num_parent; i++) { abb = find_unique_abbrev(elem->parent[i].sha1, @@ -829,14 +836,19 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, printf("%s\n", c_reset); } if (added) - dump_quoted_path("--- /dev/", "null", c_meta, c_reset); + dump_quoted_path("--- ", "", "/dev/null", + c_meta, c_reset); else - dump_quoted_path("--- a/", elem->path, c_meta, c_reset); + dump_quoted_path("--- ", opt->a_prefix, elem->path, + c_meta, c_reset); if (deleted) - dump_quoted_path("+++ /dev/", "null", c_meta, c_reset); + dump_quoted_path("+++ ", "", "/dev/null", + c_meta, c_reset); else - dump_quoted_path("+++ b/", elem->path, c_meta, c_reset); - dump_sline(sline, cnt, num_parent, opt->color_diff); + dump_quoted_path("+++ ", opt->b_prefix, elem->path, + c_meta, c_reset); + dump_sline(sline, cnt, num_parent, + DIFF_OPT_TST(opt, COLOR_DIFF)); } free(result); @@ -929,8 +941,8 @@ void diff_tree_combined(const unsigned char *sha1, diffopts = *opt; diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; - diffopts.recursive = 1; - diffopts.allow_external = 0; + DIFF_OPT_SET(&diffopts, RECURSIVE); + DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL); show_log_first = !!rev->loginfo && !rev->no_commit_id; needsep = 0; |