summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 011f427)
raw | patch | inline | side by side (parent: 011f427)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 15 Nov 2005 01:53:22 +0000 (17:53 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 17 Nov 2005 00:20:40 +0000 (16:20 -0800) |
A new option, --full-index, is introduced to diff family. This
causes the full object name of pre- and post-images to appear on
the index line of patch formatted output, to be used in
conjunction with --allow-binary-replacement option of git-apply.
Signed-off-by: Junio C Hamano <junkio@cox.net>
causes the full object name of pre- and post-images to appear on
the index line of patch formatted output, to be used in
conjunction with --allow-binary-replacement option of git-apply.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/diff-options.txt | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
index 8eef86e474aee14bb6743f0f81d6aa802ef8a621..6b496ede2550cf573a3a7ce37db908e6b3ab631e 100644 (file)
--name-status::
Show only names and status of changed files.
+--full-index::
+ Instead of the first handful characters, show full
+ object name of pre- and post-image blob on the "index"
+ line when generating a patch format output.
+
-B::
Break complete rewrite changes into pairs of delete and create.
index fca61f32f07fae0fb2e5f83e268ebce293a06ec5..0391e8c42336cda9c83eeb1b9ac8f1378e4a43f9 100644 (file)
--- a/diff.c
+++ b/diff.c
memset(one->sha1, 0, 20);
}
-static void run_diff(struct diff_filepair *p)
+static void run_diff(struct diff_filepair *p, struct diff_options *o)
{
const char *pgm = external_diff();
char msg[PATH_MAX*2+300], *xfrm_msg;
if (memcmp(one->sha1, two->sha1, 20)) {
char one_sha1[41];
+ const char *index_fmt = o->full_index ? "index %s..%s" : "index %.7s..%.7s";
memcpy(one_sha1, sha1_to_hex(one->sha1), 41);
len += snprintf(msg + len, sizeof(msg) - len,
- "index %.7s..%.7s", one_sha1,
- sha1_to_hex(two->sha1));
+ index_fmt, one_sha1, sha1_to_hex(two->sha1));
if (one->mode == two->mode)
len += snprintf(msg + len, sizeof(msg) - len,
" %06o", one->mode);
options->line_termination = 0;
else if (!strncmp(arg, "-l", 2))
options->rename_limit = strtoul(arg+2, NULL, 10);
+ else if (!strcmp(arg, "--full-index"))
+ options->full_index = 1;
else if (!strcmp(arg, "--name-only"))
options->output_format = DIFF_FORMAT_NAME;
else if (!strcmp(arg, "--name-status"))
return 0;
}
-static void diff_flush_patch(struct diff_filepair *p)
+static void diff_flush_patch(struct diff_filepair *p, struct diff_options *o)
{
if (diff_unmodified_pair(p))
return;
(DIFF_FILE_VALID(p->two) && S_ISDIR(p->two->mode)))
return; /* no tree diffs in patch format */
- run_diff(p);
+ run_diff(p, o);
}
int diff_queue_is_empty(void)
die("internal error in diff-resolve-rename-copy");
switch (diff_output_format) {
case DIFF_FORMAT_PATCH:
- diff_flush_patch(p);
+ diff_flush_patch(p, options);
break;
case DIFF_FORMAT_RAW:
case DIFF_FORMAT_NAME_STATUS:
index 12590791cbefe8717891365b6d417f60c51f684f..9b2e1e62bbe6f621d2d39ec7707eccd75ff76aac 100644 (file)
--- a/diff.h
+++ b/diff.h
const char *orderfile;
const char *pickaxe;
unsigned recursive:1,
- tree_in_recursive:1;
+ tree_in_recursive:1,
+ full_index:1;
int break_opt;
int detect_rename;
int find_copies_harder;
" -u synonym for -p.\n" \
" --name-only show only names of changed files.\n" \
" --name-status show names and status of changed files.\n" \
+" --full-index show full object name on index ines.\n" \
" -R swap input file pairs.\n" \
" -B detect complete rewrites.\n" \
" -M detect renames.\n" \