Browse Source

Merge branch 'th/diff'

* th/diff:
  builtin-diff: turn recursive on when defaulting to --patch format.
  t4013: note improvements brought by the new output code.
  t4013: add format-patch tests.
  format-patch: fix diff format option implementation
  combine-diff.c: type sanity.
  t4013 test updates for new output code.
  Fix some more diff options changes.
  Fix diff-tree -s
  log --raw: Don't descend into subdirectories by default
  diff-tree: Use ---\n as a message separator
  Print empty line between raw, stat, summary and patch
  t4013: add more tests around -c and --cc
  whatchanged: Default to DIFF_FORMAT_RAW
  Don't xcalloc() struct diffstat_t
  Add msg_sep to diff_options
  DIFF_FORMAT_RAW is not default anymore
  Set default diff output format after parsing command line
  Make --raw option available for all diff commands
  Merge with_raw, with_stat and summary variables to output_format
  t4013: add tests for diff/log family output options.
maint
Junio C Hamano 19 years ago
parent
commit
0c926a3d9c
  1. 3
      builtin-diff-files.c
  2. 3
      builtin-diff-index.c
  3. 3
      builtin-diff-stages.c
  4. 3
      builtin-diff-tree.c
  5. 56
      builtin-diff.c
  6. 39
      builtin-log.c
  7. 68
      combine-diff.c
  8. 221
      diff.c
  9. 28
      diff.h
  10. 23
      log-tree.c
  11. 2
      log-tree.h
  12. 3
      revision.c
  13. 238
      t/t4013-diff-various.sh
  14. 34
      t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
  15. 39
      t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
  16. 34
      t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
  17. 6
      t/t4013/diff.diff-tree_--cc_--stat_--summary_master
  18. 8
      t/t4013/diff.diff-tree_--cc_--stat_--summary_side
  19. 6
      t/t4013/diff.diff-tree_--cc_--stat_master
  20. 30
      t/t4013/diff.diff-tree_--cc_master
  21. 2
      t/t4013/diff.diff-tree_--patch-with-raw_initial
  22. 2
      t/t4013/diff.diff-tree_--patch-with-stat_initial
  23. 2
      t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial
  24. 2
      t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial
  25. 33
      t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial
  26. 34
      t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
  27. 29
      t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial
  28. 6
      t/t4013/diff.diff-tree_--pretty=oneline_--root_initial
  29. 2
      t/t4013/diff.diff-tree_--pretty=oneline_-p_initial
  30. 2
      t/t4013/diff.diff-tree_--pretty=oneline_initial
  31. 2
      t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial
  32. 2
      t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial
  33. 43
      t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
  34. 38
      t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial
  35. 39
      t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
  36. 15
      t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
  37. 12
      t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
  38. 11
      t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial
  39. 11
      t/t4013/diff.diff-tree_--pretty_--root_--summary_initial
  40. 34
      t/t4013/diff.diff-tree_--pretty_--root_-p_initial
  41. 11
      t/t4013/diff.diff-tree_--pretty_--root_initial
  42. 2
      t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial
  43. 2
      t/t4013/diff.diff-tree_--pretty_--stat_initial
  44. 2
      t/t4013/diff.diff-tree_--pretty_--summary_initial
  45. 2
      t/t4013/diff.diff-tree_--pretty_-p_initial
  46. 38
      t/t4013/diff.diff-tree_--pretty_-p_side
  47. 2
      t/t4013/diff.diff-tree_--pretty_initial
  48. 11
      t/t4013/diff.diff-tree_--pretty_side
  49. 6
      t/t4013/diff.diff-tree_--root_--abbrev_initial
  50. 33
      t/t4013/diff.diff-tree_--root_--patch-with-raw_initial
  51. 34
      t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
  52. 29
      t/t4013/diff.diff-tree_--root_-p_initial
  53. 6
      t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial
  54. 6
      t/t4013/diff.diff-tree_--root_-r_--abbrev_initial
  55. 6
      t/t4013/diff.diff-tree_--root_-r_initial
  56. 6
      t/t4013/diff.diff-tree_--root_initial
  57. 5
      t/t4013/diff.diff-tree_-c_--abbrev_master
  58. 6
      t/t4013/diff.diff-tree_-c_--stat_--summary_master
  59. 8
      t/t4013/diff.diff-tree_-c_--stat_--summary_side
  60. 6
      t/t4013/diff.diff-tree_-c_--stat_master
  61. 5
      t/t4013/diff.diff-tree_-c_master
  62. 80
      t/t4013/diff.diff-tree_-p_-m_master
  63. 2
      t/t4013/diff.diff-tree_-p_initial
  64. 2
      t/t4013/diff.diff-tree_-p_master
  65. 2
      t/t4013/diff.diff-tree_-r_--abbrev=4_initial
  66. 2
      t/t4013/diff.diff-tree_-r_--abbrev_initial
  67. 2
      t/t4013/diff.diff-tree_-r_initial
  68. 2
      t/t4013/diff.diff-tree_initial
  69. 2
      t/t4013/diff.diff-tree_master
  70. 165
      t/t4013/diff.format-patch_--attach_--stdout_initial..master
  71. 106
      t/t4013/diff.format-patch_--attach_--stdout_initial..master^
  72. 60
      t/t4013/diff.format-patch_--attach_--stdout_initial..side
  73. 120
      t/t4013/diff.format-patch_--stdout_initial..master
  74. 76
      t/t4013/diff.format-patch_--stdout_initial..master^
  75. 45
      t/t4013/diff.format-patch_--stdout_initial..side
  76. 72
      t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
  77. 127
      t/t4013/diff.log_--patch-with-stat_master
  78. 72
      t/t4013/diff.log_--patch-with-stat_master_--_dir_
  79. 197
      t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
  80. 165
      t/t4013/diff.log_--root_--patch-with-stat_--summary_master
  81. 159
      t/t4013/diff.log_--root_--patch-with-stat_master
  82. 197
      t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
  83. 140
      t/t4013/diff.log_--root_-p_master
  84. 32
      t/t4013/diff.log_--root_master
  85. 18
      t/t4013/diff.log_-SF_-p_master
  86. 8
      t/t4013/diff.log_-SF_master
  87. 113
      t/t4013/diff.log_-p_master
  88. 32
      t/t4013/diff.log_master
  89. 42
      t/t4013/diff.show_--patch-with-raw_side
  90. 44
      t/t4013/diff.show_--patch-with-stat_--summary_side
  91. 43
      t/t4013/diff.show_--patch-with-stat_side
  92. 34
      t/t4013/diff.show_--root_initial
  93. 13
      t/t4013/diff.show_--stat_--summary_side
  94. 12
      t/t4013/diff.show_--stat_side
  95. 7
      t/t4013/diff.show_initial
  96. 36
      t/t4013/diff.show_master
  97. 38
      t/t4013/diff.show_side
  98. 59
      t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
  99. 114
      t/t4013/diff.whatchanged_--patch-with-stat_master
  100. 59
      t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
  101. Some files were not shown because too many files have changed in this diff Show More

3
builtin-diff-files.c

@ -36,6 +36,9 @@ int cmd_diff_files(int argc, const char **argv, char **envp) @@ -36,6 +36,9 @@ int cmd_diff_files(int argc, const char **argv, char **envp)
usage(diff_files_usage);
argv++; argc--;
}
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;

/*
* Make sure there are NO revision (i.e. pending object) parameter,
* rev.max_count is reasonable (0 <= n <= 3),

3
builtin-diff-index.c

@ -28,6 +28,9 @@ int cmd_diff_index(int argc, const char **argv, char **envp) @@ -28,6 +28,9 @@ int cmd_diff_index(int argc, const char **argv, char **envp)
else
usage(diff_cache_usage);
}
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;

/*
* Make sure there is one revision (i.e. pending object),
* and there is no revision filtering parameters.

3
builtin-diff-stages.c

@ -85,6 +85,9 @@ int cmd_diff_stages(int ac, const char **av, char **envp) @@ -85,6 +85,9 @@ int cmd_diff_stages(int ac, const char **av, char **envp)
ac--; av++;
}

if (!diff_options.output_format)
diff_options.output_format = DIFF_FORMAT_RAW;

if (ac < 3 ||
sscanf(av[1], "%d", &stage1) != 1 ||
! (0 <= stage1 && stage1 <= 3) ||

3
builtin-diff-tree.c

@ -84,6 +84,9 @@ int cmd_diff_tree(int argc, const char **argv, char **envp) @@ -84,6 +84,9 @@ int cmd_diff_tree(int argc, const char **argv, char **envp)
usage(diff_tree_usage);
}

if (!opt->diffopt.output_format)
opt->diffopt.output_format = DIFF_FORMAT_RAW;

/*
* NOTE! We expect "a ^b" to be equal to "a..b", so we
* reverse the order of the objects if the second one

56
builtin-diff.c

@ -39,8 +39,6 @@ static int builtin_diff_files(struct rev_info *revs, @@ -39,8 +39,6 @@ static int builtin_diff_files(struct rev_info *revs,
revs->max_count = 3;
else if (!strcmp(arg, "-q"))
silent = 1;
else if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
@ -56,7 +54,7 @@ static int builtin_diff_files(struct rev_info *revs, @@ -56,7 +54,7 @@ static int builtin_diff_files(struct rev_info *revs,
3 < revs->max_count)
usage(builtin_diff_usage);
if (revs->max_count < 0 &&
(revs->diffopt.output_format == DIFF_FORMAT_PATCH))
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
revs->combine_merges = revs->dense_combined_merges = 1;
/*
* Backward compatibility wart - "diff-files -s" used to
@ -107,14 +105,9 @@ static int builtin_diff_b_f(struct rev_info *revs, @@ -107,14 +105,9 @@ static int builtin_diff_b_f(struct rev_info *revs,
/* Blob vs file in the working tree*/
struct stat st;

while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
}
if (argc > 1)
usage(builtin_diff_usage);

if (lstat(path, &st))
die("'%s': %s", path, strerror(errno));
if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
@ -137,14 +130,9 @@ static int builtin_diff_blobs(struct rev_info *revs, @@ -137,14 +130,9 @@ static int builtin_diff_blobs(struct rev_info *revs,
*/
unsigned mode = canon_mode(S_IFREG | 0644);

while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
}
if (argc > 1)
usage(builtin_diff_usage);

stuff_change(&revs->diffopt,
mode, mode,
blob[1].sha1, blob[0].sha1,
@ -162,8 +150,6 @@ static int builtin_diff_index(struct rev_info *revs, @@ -162,8 +150,6 @@ static int builtin_diff_index(struct rev_info *revs,
const char *arg = argv[1];
if (!strcmp(arg, "--cached"))
cached = 1;
else if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
@ -185,14 +171,9 @@ static int builtin_diff_tree(struct rev_info *revs, @@ -185,14 +171,9 @@ static int builtin_diff_tree(struct rev_info *revs,
{
const unsigned char *(sha1[2]);
int swap = 0;
while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
}

if (argc > 1)
usage(builtin_diff_usage);

/* We saw two trees, ent[0] and ent[1].
* if ent[1] is unintesting, they are swapped
@ -214,14 +195,9 @@ static int builtin_diff_combined(struct rev_info *revs, @@ -214,14 +195,9 @@ static int builtin_diff_combined(struct rev_info *revs,
const unsigned char (*parent)[20];
int i;

while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--raw"))
revs->diffopt.output_format = DIFF_FORMAT_RAW;
else
usage(builtin_diff_usage);
argv++; argc--;
}
if (argc > 1)
usage(builtin_diff_usage);

if (!revs->dense_combined_merges && !revs->combine_merges)
revs->dense_combined_merges = revs->combine_merges = 1;
parent = xmalloc(ents * sizeof(*parent));
@ -276,9 +252,13 @@ int cmd_diff(int argc, const char **argv, char **envp) @@ -276,9 +252,13 @@ int cmd_diff(int argc, const char **argv, char **envp)

git_config(git_diff_config);
init_revisions(&rev);
rev.diffopt.output_format = DIFF_FORMAT_PATCH;

argc = setup_revisions(argc, argv, &rev, NULL);
if (!rev.diffopt.output_format) {
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
diff_setup_done(&rev.diffopt);
}

/* Do we have --cached and not have a pending object, then
* default to HEAD by hand. Eek.
*/

39
builtin-log.c

@ -14,25 +14,22 @@ @@ -14,25 +14,22 @@
/* this is in builtin-diff.c */
void add_head(struct rev_info *revs);

static int cmd_log_wc(int argc, const char **argv, char **envp,
static void cmd_log_init(int argc, const char **argv, char **envp,
struct rev_info *rev)
{
struct commit *commit;

rev->abbrev = DEFAULT_ABBREV;
rev->commit_format = CMIT_FMT_DEFAULT;
rev->verbose_header = 1;
argc = setup_revisions(argc, argv, rev, "HEAD");
if (rev->always_show_header) {
if (rev->diffopt.pickaxe || rev->diffopt.filter) {
rev->always_show_header = 0;
if (rev->diffopt.output_format == DIFF_FORMAT_RAW)
rev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
}
}

if (rev->diffopt.pickaxe || rev->diffopt.filter)
rev->always_show_header = 0;
if (argc > 1)
die("unrecognized argument: %s", argv[1]);
}

static int cmd_log_walk(struct rev_info *rev)
{
struct commit *commit;

prepare_revision_walk(rev);
setup_pager();
@ -54,7 +51,10 @@ int cmd_whatchanged(int argc, const char **argv, char **envp) @@ -54,7 +51,10 @@ int cmd_whatchanged(int argc, const char **argv, char **envp)
rev.diff = 1;
rev.diffopt.recursive = 1;
rev.simplify_history = 0;
return cmd_log_wc(argc, argv, envp, &rev);
cmd_log_init(argc, argv, envp, &rev);
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;
return cmd_log_walk(&rev);
}

int cmd_show(int argc, const char **argv, char **envp)
@ -69,7 +69,8 @@ int cmd_show(int argc, const char **argv, char **envp) @@ -69,7 +69,8 @@ int cmd_show(int argc, const char **argv, char **envp)
rev.always_show_header = 1;
rev.ignore_merges = 0;
rev.no_walk = 1;
return cmd_log_wc(argc, argv, envp, &rev);
cmd_log_init(argc, argv, envp, &rev);
return cmd_log_walk(&rev);
}

int cmd_log(int argc, const char **argv, char **envp)
@ -78,8 +79,8 @@ int cmd_log(int argc, const char **argv, char **envp) @@ -78,8 +79,8 @@ int cmd_log(int argc, const char **argv, char **envp)

init_revisions(&rev);
rev.always_show_header = 1;
rev.diffopt.recursive = 1;
return cmd_log_wc(argc, argv, envp, &rev);
cmd_log_init(argc, argv, envp, &rev);
return cmd_log_walk(&rev);
}

static int istitlechar(char c)
@ -237,11 +238,10 @@ int cmd_format_patch(int argc, const char **argv, char **envp) @@ -237,11 +238,10 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
rev.commit_format = CMIT_FMT_EMAIL;
rev.verbose_header = 1;
rev.diff = 1;
rev.diffopt.with_raw = 0;
rev.diffopt.with_stat = 1;
rev.combine_merges = 0;
rev.ignore_merges = 1;
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
rev.diffopt.msg_sep = "";
rev.diffopt.recursive = 1;

git_config(git_format_config);
rev.extra_headers = extra_headers;
@ -312,6 +312,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp) @@ -312,6 +312,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
if (argc > 1)
die ("unrecognized argument: %s", argv[1]);

if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;

if (output_directory) {
if (use_stdout)
die("standard output, or directory, which one?");

68
combine-diff.c

@ -702,7 +702,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -702,7 +702,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
const char *abb;

if (rev->loginfo)
show_log(rev, rev->loginfo, "\n");
show_log(rev, opt->msg_sep);
dump_quoted_path(dense ? "diff --cc " : "diff --combined ", elem->path);
printf("index ");
for (i = 0; i < num_parent; i++) {
@ -770,9 +770,9 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re @@ -770,9 +770,9 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
inter_name_termination = 0;

if (rev->loginfo)
show_log(rev, rev->loginfo, "\n");
show_log(rev, opt->msg_sep);

if (opt->output_format == DIFF_FORMAT_RAW) {
if (opt->output_format & DIFF_FORMAT_RAW) {
offset = strlen(COLONS) - num_parent;
if (offset < 0)
offset = 0;
@ -792,8 +792,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re @@ -792,8 +792,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
printf(" %s ", diff_unique_abbrev(p->sha1, opt->abbrev));
}

if (opt->output_format == DIFF_FORMAT_RAW ||
opt->output_format == DIFF_FORMAT_NAME_STATUS) {
if (opt->output_format & (DIFF_FORMAT_RAW | DIFF_FORMAT_NAME_STATUS)) {
for (i = 0; i < num_parent; i++)
putchar(p->parent[i].status);
putchar(inter_name_termination);
@ -819,17 +818,12 @@ void show_combined_diff(struct combine_diff_path *p, @@ -819,17 +818,12 @@ void show_combined_diff(struct combine_diff_path *p,
struct diff_options *opt = &rev->diffopt;
if (!p->len)
return;
switch (opt->output_format) {
case DIFF_FORMAT_RAW:
case DIFF_FORMAT_NAME_STATUS:
case DIFF_FORMAT_NAME:
if (opt->output_format & (DIFF_FORMAT_RAW |
DIFF_FORMAT_NAME |
DIFF_FORMAT_NAME_STATUS)) {
show_raw_diff(p, num_parent, rev);
return;
case DIFF_FORMAT_PATCH:
} else if (opt->output_format & DIFF_FORMAT_PATCH) {
show_patch_diff(p, num_parent, dense, rev);
return;
default:
return;
}
}

@ -842,22 +836,20 @@ void diff_tree_combined(const unsigned char *sha1, @@ -842,22 +836,20 @@ void diff_tree_combined(const unsigned char *sha1,
struct diff_options *opt = &rev->diffopt;
struct diff_options diffopts;
struct combine_diff_path *p, *paths = NULL;
int i, num_paths;
int do_diffstat;
int i, num_paths, needsep, show_log_first;

do_diffstat = (opt->output_format == DIFF_FORMAT_DIFFSTAT ||
opt->with_stat);
diffopts = *opt;
diffopts.with_raw = 0;
diffopts.with_stat = 0;
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
diffopts.recursive = 1;

show_log_first = !!rev->loginfo;
needsep = 0;
/* find set of paths that everybody touches */
for (i = 0; i < num_parent; i++) {
/* show stat against the first parent even
* when doing combined diff.
*/
if (i == 0 && do_diffstat)
if (i == 0 && opt->output_format & DIFF_FORMAT_DIFFSTAT)
diffopts.output_format = DIFF_FORMAT_DIFFSTAT;
else
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
@ -865,12 +857,12 @@ void diff_tree_combined(const unsigned char *sha1, @@ -865,12 +857,12 @@ void diff_tree_combined(const unsigned char *sha1,
diffcore_std(&diffopts);
paths = intersect_paths(paths, i, num_parent);

if (do_diffstat && rev->loginfo)
show_log(rev, rev->loginfo,
opt->with_stat ? "---\n" : "\n");
if (show_log_first && i == 0) {
show_log(rev, opt->msg_sep);
if (rev->verbose_header && opt->output_format)
putchar(opt->line_termination);
}
diff_flush(&diffopts);
if (opt->with_stat)
putchar('\n');
}

/* find out surviving paths */
@ -879,17 +871,25 @@ void diff_tree_combined(const unsigned char *sha1, @@ -879,17 +871,25 @@ void diff_tree_combined(const unsigned char *sha1,
num_paths++;
}
if (num_paths) {
if (opt->with_raw) {
int saved_format = opt->output_format;
opt->output_format = DIFF_FORMAT_RAW;
if (opt->output_format & (DIFF_FORMAT_RAW |
DIFF_FORMAT_NAME |
DIFF_FORMAT_NAME_STATUS)) {
for (p = paths; p; p = p->next) {
show_combined_diff(p, num_parent, dense, rev);
if (p->len)
show_raw_diff(p, num_parent, rev);
}
opt->output_format = saved_format;
putchar(opt->line_termination);
needsep = 1;
}
for (p = paths; p; p = p->next) {
show_combined_diff(p, num_parent, dense, rev);
else if (opt->output_format & DIFF_FORMAT_DIFFSTAT)
needsep = 1;
if (opt->output_format & DIFF_FORMAT_PATCH) {
if (needsep)
putchar(opt->line_termination);
for (p = paths; p; p = p->next) {
if (p->len)
show_patch_diff(p, num_parent, dense,
rev);
}
}
}


221
diff.c

@ -1420,11 +1420,11 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o) @@ -1420,11 +1420,11 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o)
void diff_setup(struct diff_options *options)
{
memset(options, 0, sizeof(*options));
options->output_format = DIFF_FORMAT_RAW;
options->line_termination = '\n';
options->break_opt = -1;
options->rename_limit = -1;
options->context = 3;
options->msg_sep = "";

options->change = diff_change;
options->add_remove = diff_addremove;
@ -1438,22 +1438,28 @@ int diff_setup_done(struct diff_options *options) @@ -1438,22 +1438,28 @@ int diff_setup_done(struct diff_options *options)
(0 <= options->rename_limit && !options->detect_rename))
return -1;

if (options->output_format & (DIFF_FORMAT_NAME |
DIFF_FORMAT_NAME_STATUS |
DIFF_FORMAT_CHECKDIFF |
DIFF_FORMAT_NO_OUTPUT))
options->output_format &= ~(DIFF_FORMAT_RAW |
DIFF_FORMAT_DIFFSTAT |
DIFF_FORMAT_SUMMARY |
DIFF_FORMAT_PATCH);

/*
* These cases always need recursive; we do not drop caller-supplied
* recursive bits for other formats here.
*/
if ((options->output_format == DIFF_FORMAT_PATCH) ||
(options->output_format == DIFF_FORMAT_DIFFSTAT) ||
(options->output_format == DIFF_FORMAT_CHECKDIFF))
if (options->output_format & (DIFF_FORMAT_PATCH |
DIFF_FORMAT_DIFFSTAT |
DIFF_FORMAT_CHECKDIFF))
options->recursive = 1;

/*
* These combinations do not make sense.
* Also pickaxe would not work very well if you do not say recursive
*/
if (options->output_format == DIFF_FORMAT_RAW)
options->with_raw = 0;
if (options->output_format == DIFF_FORMAT_DIFFSTAT)
options->with_stat = 0;
if (options->pickaxe)
options->recursive = 1;

if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;
@ -1526,22 +1532,22 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) @@ -1526,22 +1532,22 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
{
const char *arg = av[0];
if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
options->output_format = DIFF_FORMAT_PATCH;
options->output_format |= DIFF_FORMAT_PATCH;
else if (opt_arg(arg, 'U', "unified", &options->context))
options->output_format = DIFF_FORMAT_PATCH;
options->output_format |= DIFF_FORMAT_PATCH;
else if (!strcmp(arg, "--raw"))
options->output_format |= DIFF_FORMAT_RAW;
else if (!strcmp(arg, "--patch-with-raw")) {
options->output_format = DIFF_FORMAT_PATCH;
options->with_raw = 1;
options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW;
}
else if (!strcmp(arg, "--stat"))
options->output_format = DIFF_FORMAT_DIFFSTAT;
options->output_format |= DIFF_FORMAT_DIFFSTAT;
else if (!strcmp(arg, "--check"))
options->output_format = DIFF_FORMAT_CHECKDIFF;
options->output_format |= DIFF_FORMAT_CHECKDIFF;
else if (!strcmp(arg, "--summary"))
options->summary = 1;
options->output_format |= DIFF_FORMAT_SUMMARY;
else if (!strcmp(arg, "--patch-with-stat")) {
options->output_format = DIFF_FORMAT_PATCH;
options->with_stat = 1;
options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT;
}
else if (!strcmp(arg, "-z"))
options->line_termination = 0;
@ -1550,19 +1556,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) @@ -1550,19 +1556,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (!strcmp(arg, "--full-index"))
options->full_index = 1;
else if (!strcmp(arg, "--binary")) {
options->output_format = DIFF_FORMAT_PATCH;
options->output_format |= DIFF_FORMAT_PATCH;
options->full_index = options->binary = 1;
}
else if (!strcmp(arg, "--name-only"))
options->output_format = DIFF_FORMAT_NAME;
options->output_format |= DIFF_FORMAT_NAME;
else if (!strcmp(arg, "--name-status"))
options->output_format = DIFF_FORMAT_NAME_STATUS;
options->output_format |= DIFF_FORMAT_NAME_STATUS;
else if (!strcmp(arg, "-R"))
options->reverse_diff = 1;
else if (!strncmp(arg, "-S", 2))
options->pickaxe = arg + 2;
else if (!strcmp(arg, "-s"))
options->output_format = DIFF_FORMAT_NO_OUTPUT;
else if (!strcmp(arg, "-s")) {
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
}
else if (!strncmp(arg, "-O", 2))
options->orderfile = arg + 2;
else if (!strncmp(arg, "--diff-filter=", 14))
@ -1737,15 +1744,17 @@ const char *diff_unique_abbrev(const unsigned char *sha1, int len) @@ -1737,15 +1744,17 @@ const char *diff_unique_abbrev(const unsigned char *sha1, int len)
}

static void diff_flush_raw(struct diff_filepair *p,
int line_termination,
int inter_name_termination,
struct diff_options *options,
int output_format)
struct diff_options *options)
{
int two_paths;
char status[10];
int abbrev = options->abbrev;
const char *path_one, *path_two;
int inter_name_termination = '\t';
int line_termination = options->line_termination;

if (!line_termination)
inter_name_termination = 0;

path_one = p->one->path;
path_two = p->two->path;
@ -1774,7 +1783,7 @@ static void diff_flush_raw(struct diff_filepair *p, @@ -1774,7 +1783,7 @@ static void diff_flush_raw(struct diff_filepair *p,
two_paths = 0;
break;
}
if (output_format != DIFF_FORMAT_NAME_STATUS) {
if (!(options->output_format & DIFF_FORMAT_NAME_STATUS)) {
printf(":%06o %06o %s ",
p->one->mode, p->two->mode,
diff_unique_abbrev(p->one->sha1, abbrev));
@ -1983,48 +1992,30 @@ static void diff_resolve_rename_copy(void) @@ -1983,48 +1992,30 @@ static void diff_resolve_rename_copy(void)
diff_debug_queue("resolve-rename-copy done", q);
}

static void flush_one_pair(struct diff_filepair *p,
int diff_output_format,
struct diff_options *options,
struct diffstat_t *diffstat)
static int check_pair_status(struct diff_filepair *p)
{
int inter_name_termination = '\t';
int line_termination = options->line_termination;
if (!line_termination)
inter_name_termination = 0;

switch (p->status) {
case DIFF_STATUS_UNKNOWN:
break;
return 0;
case 0:
die("internal error in diff-resolve-rename-copy");
break;
default:
switch (diff_output_format) {
case DIFF_FORMAT_DIFFSTAT:
diff_flush_stat(p, options, diffstat);
break;
case DIFF_FORMAT_CHECKDIFF:
diff_flush_checkdiff(p, options);
break;
case DIFF_FORMAT_PATCH:
diff_flush_patch(p, options);
break;
case DIFF_FORMAT_RAW:
case DIFF_FORMAT_NAME_STATUS:
diff_flush_raw(p, line_termination,
inter_name_termination,
options, diff_output_format);
break;
case DIFF_FORMAT_NAME:
diff_flush_name(p, line_termination);
break;
case DIFF_FORMAT_NO_OUTPUT:
break;
}
return 1;
}
}

static void flush_one_pair(struct diff_filepair *p, struct diff_options *opt)
{
int fmt = opt->output_format;

if (fmt & DIFF_FORMAT_CHECKDIFF)
diff_flush_checkdiff(p, opt);
else if (fmt & (DIFF_FORMAT_RAW | DIFF_FORMAT_NAME_STATUS))
diff_flush_raw(p, opt);
else if (fmt & DIFF_FORMAT_NAME)
diff_flush_name(p, opt->line_termination);
}

static void show_file_mode_name(const char *newdelete, struct diff_filespec *fs)
{
if (fs->mode)
@ -2243,58 +2234,96 @@ int diff_flush_patch_id(struct diff_options *options, unsigned char *sha1) @@ -2243,58 +2234,96 @@ int diff_flush_patch_id(struct diff_options *options, unsigned char *sha1)
return result;
}

void diff_flush(struct diff_options *options)
static int is_summary_empty(const struct diff_queue_struct *q)
{
struct diff_queue_struct *q = &diff_queued_diff;
int i;
int diff_output_format = options->output_format;
struct diffstat_t *diffstat = NULL;

if (diff_output_format == DIFF_FORMAT_DIFFSTAT || options->with_stat) {
diffstat = xcalloc(sizeof (struct diffstat_t), 1);
diffstat->xm.consume = diffstat_consume;
for (i = 0; i < q->nr; i++) {
const struct diff_filepair *p = q->queue[i];

switch (p->status) {
case DIFF_STATUS_DELETED:
case DIFF_STATUS_ADDED:
case DIFF_STATUS_COPIED:
case DIFF_STATUS_RENAMED:
return 0;
default:
if (p->score)
return 0;
if (p->one->mode && p->two->mode &&
p->one->mode != p->two->mode)
return 0;
break;
}
}
return 1;
}

if (options->with_raw) {
void diff_flush(struct diff_options *options)
{
struct diff_queue_struct *q = &diff_queued_diff;
int i, output_format = options->output_format;
int separator = 0;

/*
* Order: raw, stat, summary, patch
* or: name/name-status/checkdiff (other bits clear)
*/
if (!q->nr)
goto free_queue;

if (output_format & (DIFF_FORMAT_RAW |
DIFF_FORMAT_NAME |
DIFF_FORMAT_NAME_STATUS |
DIFF_FORMAT_CHECKDIFF)) {
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
flush_one_pair(p, DIFF_FORMAT_RAW, options, NULL);
if (check_pair_status(p))
flush_one_pair(p, options);
}
putchar(options->line_termination);
separator++;
}
if (options->with_stat) {

if (output_format & DIFF_FORMAT_DIFFSTAT) {
struct diffstat_t diffstat;

memset(&diffstat, 0, sizeof(struct diffstat_t));
diffstat.xm.consume = diffstat_consume;
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
flush_one_pair(p, DIFF_FORMAT_DIFFSTAT, options,
diffstat);
if (check_pair_status(p))
diff_flush_stat(p, options, &diffstat);
}
show_stats(diffstat);
free(diffstat);
diffstat = NULL;
if (options->summary)
for (i = 0; i < q->nr; i++)
diff_summary(q->queue[i]);
if (options->stat_sep)
fputs(options->stat_sep, stdout);
else
putchar(options->line_termination);
}
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
flush_one_pair(p, diff_output_format, options, diffstat);
show_stats(&diffstat);
separator++;
}

if (diffstat) {
show_stats(diffstat);
free(diffstat);
if (output_format & DIFF_FORMAT_SUMMARY && !is_summary_empty(q)) {
for (i = 0; i < q->nr; i++)
diff_summary(q->queue[i]);
separator++;
}

for (i = 0; i < q->nr; i++) {
if (diffstat && options->summary)
diff_summary(q->queue[i]);
diff_free_filepair(q->queue[i]);
if (output_format & DIFF_FORMAT_PATCH) {
if (separator) {
if (options->stat_sep) {
/* attach patch instead of inline */
fputs(options->stat_sep, stdout);
} else {
putchar(options->line_termination);
}
}

for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
if (check_pair_status(p))
diff_flush_patch(p, options);
}
}

for (i = 0; i < q->nr; i++)
diff_free_filepair(q->queue[i]);
free_queue:
free(q->queue);
q->queue = NULL;
q->nr = q->alloc = 0;

28
diff.h

@ -20,19 +20,31 @@ typedef void (*add_remove_fn_t)(struct diff_options *options, @@ -20,19 +20,31 @@ typedef void (*add_remove_fn_t)(struct diff_options *options,
const unsigned char *sha1,
const char *base, const char *path);

#define DIFF_FORMAT_RAW 0x0001
#define DIFF_FORMAT_DIFFSTAT 0x0002
#define DIFF_FORMAT_SUMMARY 0x0004
#define DIFF_FORMAT_PATCH 0x0008

/* These override all above */
#define DIFF_FORMAT_NAME 0x0010
#define DIFF_FORMAT_NAME_STATUS 0x0020
#define DIFF_FORMAT_CHECKDIFF 0x0040

/* Same as output_format = 0 but we know that -s flag was given
* and we should not give default value to output_format.
*/
#define DIFF_FORMAT_NO_OUTPUT 0x0080

struct diff_options {
const char *filter;
const char *orderfile;
const char *pickaxe;
unsigned recursive:1,
with_raw:1,
with_stat:1,
tree_in_recursive:1,
binary:1,
full_index:1,
silent_on_remove:1,
find_copies_harder:1,
summary:1,
color_diff:1;
int context;
int break_opt;
@ -45,6 +57,7 @@ struct diff_options { @@ -45,6 +57,7 @@ struct diff_options {
int rename_limit;
int setup;
int abbrev;
const char *msg_sep;
const char *stat_sep;
long xdl_opts;

@ -151,15 +164,6 @@ extern void diffcore_std_no_resolve(struct diff_options *); @@ -151,15 +164,6 @@ extern void diffcore_std_no_resolve(struct diff_options *);
" show all files diff when -S is used and hit is found.\n"

extern int diff_queue_is_empty(void);

#define DIFF_FORMAT_RAW 1
#define DIFF_FORMAT_PATCH 2
#define DIFF_FORMAT_NO_OUTPUT 3
#define DIFF_FORMAT_NAME 4
#define DIFF_FORMAT_NAME_STATUS 5
#define DIFF_FORMAT_DIFFSTAT 6
#define DIFF_FORMAT_CHECKDIFF 7

extern void diff_flush(struct diff_options*);

/* diff-raw status letters */

23
log-tree.c

@ -43,9 +43,10 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff) @@ -43,9 +43,10 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff)
return at;
}

void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
void show_log(struct rev_info *opt, const char *sep)
{
static char this_header[16384];
struct log_info *log = opt->loginfo;
struct commit *commit = log->commit, *parent = log->parent;
int abbrev = opt->diffopt.abbrev;
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
@ -163,8 +164,22 @@ int log_tree_diff_flush(struct rev_info *opt) @@ -163,8 +164,22 @@ int log_tree_diff_flush(struct rev_info *opt)
return 0;
}

if (opt->loginfo && !opt->no_commit_id)
show_log(opt, opt->loginfo, opt->diffopt.with_stat ? "---\n" : "\n");
if (opt->loginfo && !opt->no_commit_id) {
/* When showing a verbose header (i.e. log message),
* and not in --pretty=oneline format, we would want
* an extra newline between the end of log and the
* output for readability.
*/
show_log(opt, opt->diffopt.msg_sep);
if (opt->verbose_header &&
opt->commit_format != CMIT_FMT_ONELINE) {
int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
if ((pch & opt->diffopt.output_format) == pch)
printf("---%c", opt->diffopt.line_termination);
else
putchar(opt->diffopt.line_termination);
}
}
diff_flush(&opt->diffopt);
return 1;
}
@ -261,7 +276,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit) @@ -261,7 +276,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
shown = log_tree_diff(opt, commit, &log);
if (!shown && opt->loginfo && opt->always_show_header) {
log.parent = NULL;
show_log(opt, opt->loginfo, "");
show_log(opt, "");
shown = 1;
}
opt->loginfo = NULL;

2
log-tree.h

@ -11,6 +11,6 @@ void init_log_tree_opt(struct rev_info *); @@ -11,6 +11,6 @@ void init_log_tree_opt(struct rev_info *);
int log_tree_diff_flush(struct rev_info *);
int log_tree_commit(struct rev_info *, struct commit *);
int log_tree_opt_parse(struct rev_info *, const char **, int);
void show_log(struct rev_info *opt, struct log_info *log, const char *sep);
void show_log(struct rev_info *opt, const char *sep);

#endif

3
revision.c

@ -852,8 +852,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch @@ -852,8 +852,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
}
if (revs->combine_merges) {
revs->ignore_merges = 0;
if (revs->dense_combined_merges &&
(revs->diffopt.output_format != DIFF_FORMAT_DIFFSTAT))
if (revs->dense_combined_merges && !revs->diffopt.output_format)
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
}
revs->diffopt.abbrev = revs->abbrev;

238
t/t4013-diff-various.sh

@ -0,0 +1,238 @@ @@ -0,0 +1,238 @@
#!/bin/sh
#
# Copyright (c) 2006 Junio C Hamano
#

test_description='Various diff formatting options'

. ./test-lib.sh

test_expect_success setup '

GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

mkdir dir &&
for i in 1 2 3; do echo $i; done >file0 &&
for i in A B; do echo $i; done >dir/sub &&
cat file0 >file2 &&
git add file0 file2 dir/sub &&
git commit -m Initial &&

git branch initial &&
git branch side &&

GIT_AUTHOR_DATE="2006-06-26 00:01:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

for i in 4 5 6; do echo $i; done >>file0 &&
for i in C D; do echo $i; done >>dir/sub &&
rm -f file2 &&
git update-index --remove file0 file2 dir/sub &&
git commit -m Second &&

GIT_AUTHOR_DATE="2006-06-26 00:02:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

for i in A B C; do echo $i; done >file1 &&
git add file1 &&
for i in E F; do echo $i; done >>dir/sub &&
git update-index dir/sub &&
git commit -m Third &&

GIT_AUTHOR_DATE="2006-06-26 00:03:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:03:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

git checkout side &&
for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
cat dir/sub >file3 &&
git add file3 &&
git update-index file0 dir/sub &&
git commit -m Side &&

GIT_AUTHOR_DATE="2006-06-26 00:04:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

git checkout master &&
git pull -s ours . side &&

GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
git update-index file0 dir/sub &&

EDITOR=: VISUAL=: git commit --amend &&
git show-branch
'

: <<\EOF
! [initial] Initial
* [master] Merge branch 'side'
! [side] Side
---
- [master] Merge branch 'side'
*+ [side] Side
* [master^] Second
+*+ [initial] Initial
EOF

V=`git version | sed -e 's/^git version //'`
while read cmd
do
case "$cmd" in
'' | '#'*) continue ;;
esac
test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
cnt=`expr $test_count + 1`
pfx=`printf "%04d" $cnt`
expect="../t4013/diff.$test"
actual="$pfx-diff.$test"

test_expect_success "git $cmd" '
{
echo "\$ git $cmd"
git $cmd | sed -e "s/$V/g-i-t--v-e-r-s-i-o-n/"
echo "\$"
} >"$actual" &&
if test -f "$expect"
then
diff -u "$expect" "$actual" &&
rm -f "$actual"
else
# this is to help developing new tests.
cp "$actual" "$expect"
false
fi
'
done <<\EOF
diff-tree initial
diff-tree -r initial
diff-tree -r --abbrev initial
diff-tree -r --abbrev=4 initial
diff-tree --root initial
diff-tree --root --abbrev initial
diff-tree --root -r initial
diff-tree --root -r --abbrev initial
diff-tree --root -r --abbrev=4 initial
diff-tree -p initial
diff-tree --root -p initial
diff-tree --patch-with-stat initial
diff-tree --root --patch-with-stat initial
diff-tree --patch-with-raw initial
diff-tree --root --patch-with-raw initial

diff-tree --pretty initial
diff-tree --pretty --root initial
diff-tree --pretty -p initial
diff-tree --pretty --stat initial
diff-tree --pretty --summary initial
diff-tree --pretty --stat --summary initial
diff-tree --pretty --root -p initial
diff-tree --pretty --root --stat initial
# improved by Timo's patch
diff-tree --pretty --root --summary initial
# improved by Timo's patch
diff-tree --pretty --root --summary -r initial
diff-tree --pretty --root --stat --summary initial
diff-tree --pretty --patch-with-stat initial
diff-tree --pretty --root --patch-with-stat initial
diff-tree --pretty --patch-with-raw initial
diff-tree --pretty --root --patch-with-raw initial

diff-tree --pretty=oneline initial
diff-tree --pretty=oneline --root initial
diff-tree --pretty=oneline -p initial
diff-tree --pretty=oneline --root -p initial
diff-tree --pretty=oneline --patch-with-stat initial
# improved by Timo's patch
diff-tree --pretty=oneline --root --patch-with-stat initial
diff-tree --pretty=oneline --patch-with-raw initial
diff-tree --pretty=oneline --root --patch-with-raw initial

diff-tree --pretty side
diff-tree --pretty -p side
diff-tree --pretty --patch-with-stat side

diff-tree master
diff-tree -p master
diff-tree -p -m master
diff-tree -c master
diff-tree -c --abbrev master
diff-tree --cc master
# stat only should show the diffstat with the first parent
diff-tree -c --stat master
diff-tree --cc --stat master
diff-tree -c --stat --summary master
diff-tree --cc --stat --summary master
# stat summary should show the diffstat and summary with the first parent
diff-tree -c --stat --summary side
diff-tree --cc --stat --summary side
# improved by Timo's patch
diff-tree --cc --patch-with-stat master
# improved by Timo's patch
diff-tree --cc --patch-with-stat --summary master
# this is correct
diff-tree --cc --patch-with-stat --summary side

log master
log -p master
log --root master
log --root -p master
log --patch-with-stat master
log --root --patch-with-stat master
log --root --patch-with-stat --summary master
# improved by Timo's patch
log --root -c --patch-with-stat --summary master
# improved by Timo's patch
log --root --cc --patch-with-stat --summary master
log -SF master
log -SF -p master

whatchanged master
whatchanged -p master
whatchanged --root master
whatchanged --root -p master
whatchanged --patch-with-stat master
whatchanged --root --patch-with-stat master
whatchanged --root --patch-with-stat --summary master
# improved by Timo's patch
whatchanged --root -c --patch-with-stat --summary master
# improved by Timo's patch
whatchanged --root --cc --patch-with-stat --summary master
whatchanged -SF master
whatchanged -SF -p master

log --patch-with-stat master -- dir/
whatchanged --patch-with-stat master -- dir/
log --patch-with-stat --summary master -- dir/
whatchanged --patch-with-stat --summary master -- dir/

show initial
show --root initial
show side
show master
show --stat side
show --stat --summary side
show --patch-with-stat side
show --patch-with-raw side
show --patch-with-stat --summary side

format-patch --stdout initial..side
format-patch --stdout initial..master^
format-patch --stdout initial..master
format-patch --attach --stdout initial..side
format-patch --attach --stdout initial..master^
format-patch --attach --stdout initial..master

EOF

test_done

34
t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git diff-tree --cc --patch-with-stat --summary master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --cc file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C
$

39
t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
$ git diff-tree --cc --patch-with-stat --summary side
c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

34
t/t4013/diff.diff-tree_--cc_--patch-with-stat_master

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git diff-tree --cc --patch-with-stat master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --cc file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C
$

6
t/t4013/diff.diff-tree_--cc_--stat_--summary_master

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --cc --stat --summary master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
$

8
t/t4013/diff.diff-tree_--cc_--stat_--summary_side

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
$ git diff-tree --cc --stat --summary side
c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3
$

6
t/t4013/diff.diff-tree_--cc_--stat_master

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --cc --stat master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
$

30
t/t4013/diff.diff-tree_--cc_master

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
$ git diff-tree --cc master
176b998f5d647cbd77a9d8acf4531e930754d16d
diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --cc file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C
$

2
t/t4013/diff.diff-tree_--patch-with-raw_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --patch-with-raw initial
$

2
t/t4013/diff.diff-tree_--patch-with-stat_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --patch-with-stat initial
$

2
t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty=oneline --patch-with-raw initial
$

2
t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty=oneline --patch-with-stat initial
$

33
t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
$ git diff-tree --pretty=oneline --root --patch-with-raw initial
444ac553ac7612cc88969031b02b3767fb8a353a Initial
:000000 100644 0000000000000000000000000000000000000000 35d242ba79ae89ac695e26b3d4c27a8e6f028f9e A dir/sub
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

34
t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git diff-tree --pretty=oneline --root --patch-with-stat initial
444ac553ac7612cc88969031b02b3767fb8a353a Initial
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

29
t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
$ git diff-tree --pretty=oneline --root -p initial
444ac553ac7612cc88969031b02b3767fb8a353a Initial
diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

6
t/t4013/diff.diff-tree_--pretty=oneline_--root_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --pretty=oneline --root initial
444ac553ac7612cc88969031b02b3767fb8a353a Initial
:000000 040000 0000000000000000000000000000000000000000 da7a33fa77d8066d6698643940ce5860fe2d7fb3 A dir
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2
$

2
t/t4013/diff.diff-tree_--pretty=oneline_-p_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty=oneline -p initial
$

2
t/t4013/diff.diff-tree_--pretty=oneline_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty=oneline initial
$

2
t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty --patch-with-raw initial
$

2
t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty --patch-with-stat initial
$

43
t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
$ git diff-tree --pretty --patch-with-stat side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

38
t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
$ git diff-tree --pretty --root --patch-with-raw initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

:000000 100644 0000000000000000000000000000000000000000 35d242ba79ae89ac695e26b3d4c27a8e6f028f9e A dir/sub
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

39
t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
$ git diff-tree --pretty --root --patch-with-stat initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

15
t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
$ git diff-tree --pretty --root --stat --summary initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)
create mode 100644 dir/sub
create mode 100644 file0
create mode 100644 file2
$

12
t/t4013/diff.diff-tree_--pretty_--root_--stat_initial

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
$ git diff-tree --pretty --root --stat initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)
$

11
t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
$ git diff-tree --pretty --root --summary -r initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

create mode 100644 dir/sub
create mode 100644 file0
create mode 100644 file2
$

11
t/t4013/diff.diff-tree_--pretty_--root_--summary_initial

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
$ git diff-tree --pretty --root --summary initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

create mode 040000 dir
create mode 100644 file0
create mode 100644 file2
$

34
t/t4013/diff.diff-tree_--pretty_--root_-p_initial

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git diff-tree --pretty --root -p initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

11
t/t4013/diff.diff-tree_--pretty_--root_initial

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
$ git diff-tree --pretty --root initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

:000000 040000 0000000000000000000000000000000000000000 da7a33fa77d8066d6698643940ce5860fe2d7fb3 A dir
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2
$

2
t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty --stat --summary initial
$

2
t/t4013/diff.diff-tree_--pretty_--stat_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty --stat initial
$

2
t/t4013/diff.diff-tree_--pretty_--summary_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty --summary initial
$

2
t/t4013/diff.diff-tree_--pretty_-p_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty -p initial
$

38
t/t4013/diff.diff-tree_--pretty_-p_side

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
$ git diff-tree --pretty -p side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

2
t/t4013/diff.diff-tree_--pretty_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree --pretty initial
$

11
t/t4013/diff.diff-tree_--pretty_side

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
$ git diff-tree --pretty side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

:040000 040000 da7a33fa77d8066d6698643940ce5860fe2d7fb3 f977ed46ae6873c1c30ab878e15a4accedc3618b M dir
:100644 100644 01e79c32a8c99c557f0757da7cb6d65b3414466d f4615da674c09df322d6ba8d6b21ecfb1b1ba510 M file0
:000000 100644 0000000000000000000000000000000000000000 7289e35bff32727c08dda207511bec138fdb9ea5 A file3
$

6
t/t4013/diff.diff-tree_--root_--abbrev_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --root --abbrev initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 040000 0000000... da7a33f... A dir
:000000 100644 0000000... 01e79c3... A file0
:000000 100644 0000000... 01e79c3... A file2
$

33
t/t4013/diff.diff-tree_--root_--patch-with-raw_initial

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
$ git diff-tree --root --patch-with-raw initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000000000000000000000000000000000000000 35d242ba79ae89ac695e26b3d4c27a8e6f028f9e A dir/sub
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

34
t/t4013/diff.diff-tree_--root_--patch-with-stat_initial

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git diff-tree --root --patch-with-stat initial
444ac553ac7612cc88969031b02b3767fb8a353a
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

29
t/t4013/diff.diff-tree_--root_-p_initial

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
$ git diff-tree --root -p initial
444ac553ac7612cc88969031b02b3767fb8a353a
diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

6
t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --root -r --abbrev=4 initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000... 35d2... A dir/sub
:000000 100644 0000... 01e7... A file0
:000000 100644 0000... 01e7... A file2
$

6
t/t4013/diff.diff-tree_--root_-r_--abbrev_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --root -r --abbrev initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000000... 35d242b... A dir/sub
:000000 100644 0000000... 01e79c3... A file0
:000000 100644 0000000... 01e79c3... A file2
$

6
t/t4013/diff.diff-tree_--root_-r_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --root -r initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000000000000000000000000000000000000000 35d242ba79ae89ac695e26b3d4c27a8e6f028f9e A dir/sub
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2
$

6
t/t4013/diff.diff-tree_--root_initial

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree --root initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 040000 0000000000000000000000000000000000000000 da7a33fa77d8066d6698643940ce5860fe2d7fb3 A dir
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2
$

5
t/t4013/diff.diff-tree_-c_--abbrev_master

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
$ git diff-tree -c --abbrev master
176b998f5d647cbd77a9d8acf4531e930754d16d
::100644 100644 100644 cead32e... 7289e35... 992913c... MM dir/sub
::100644 100644 100644 b414108... f4615da... 10a8a9f... MM file0
$

6
t/t4013/diff.diff-tree_-c_--stat_--summary_master

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree -c --stat --summary master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
$

8
t/t4013/diff.diff-tree_-c_--stat_--summary_side

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
$ git diff-tree -c --stat --summary side
c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3
$

6
t/t4013/diff.diff-tree_-c_--stat_master

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
$ git diff-tree -c --stat master
176b998f5d647cbd77a9d8acf4531e930754d16d
dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
$

5
t/t4013/diff.diff-tree_-c_master

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
$ git diff-tree -c master
176b998f5d647cbd77a9d8acf4531e930754d16d
::100644 100644 100644 cead32e925b1420c84c14cbf7cf755e7e45af8ad 7289e35bff32727c08dda207511bec138fdb9ea5 992913c5aa0a5476d10c49ed0f21fc0c6d1aedf3 MM dir/sub
::100644 100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 f4615da674c09df322d6ba8d6b21ecfb1b1ba510 10a8a9f3657f91a156b9f0184ed79a20adef9f7f MM file0
$

80
t/t4013/diff.diff-tree_-p_-m_master

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
$ git diff-tree -p -m master
176b998f5d647cbd77a9d8acf4531e930754d16d
diff --git a/dir/sub b/dir/sub
index cead32e..992913c 100644
--- a/dir/sub
+++ b/dir/sub
@@ -4,3 +4,5 @@ C
D
E
F
+1
+2
diff --git a/file0 b/file0
index b414108..10a8a9f 100644
--- a/file0
+++ b/file0
@@ -4,3 +4,6 @@
4
5
6
+A
+B
+C
176b998f5d647cbd77a9d8acf4531e930754d16d
diff --git a/dir/sub b/dir/sub
index 7289e35..992913c 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,4 +1,8 @@
A
B
+C
+D
+E
+F
1
2
diff --git a/file0 b/file0
index f4615da..10a8a9f 100644
--- a/file0
+++ b/file0
@@ -1,6 +1,9 @@
1
2
3
+4
+5
+6
A
B
C
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3
diff --git a/file3 b/file3
deleted file mode 100644
index 7289e35..0000000
--- a/file3
+++ /dev/null
@@ -1,4 +0,0 @@
-A
-B
-1
-2
$

2
t/t4013/diff.diff-tree_-p_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree -p initial
$

2
t/t4013/diff.diff-tree_-p_master

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree -p master
$

2
t/t4013/diff.diff-tree_-r_--abbrev=4_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree -r --abbrev=4 initial
$

2
t/t4013/diff.diff-tree_-r_--abbrev_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree -r --abbrev initial
$

2
t/t4013/diff.diff-tree_-r_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree -r initial
$

2
t/t4013/diff.diff-tree_initial

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree initial
$

2
t/t4013/diff.diff-tree_master

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
$ git diff-tree master
$

165
t/t4013/diff.format-patch_--attach_--stdout_initial..master

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
$ git format-patch --attach --stdout initial..master
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000
Subject: [PATCH] Second
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

--------------g-i-t--v-e-r-s-i-o-n--



From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:02:00 +0000
Subject: [PATCH] Third
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

--------------g-i-t--v-e-r-s-i-o-n--



From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:03:00 +0000
Subject: [PATCH] Side
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

--------------g-i-t--v-e-r-s-i-o-n--


$

106
t/t4013/diff.format-patch_--attach_--stdout_initial..master^

@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
$ git format-patch --attach --stdout initial..master^
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000
Subject: [PATCH] Second
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

--------------g-i-t--v-e-r-s-i-o-n--



From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:02:00 +0000
Subject: [PATCH] Third
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

--------------g-i-t--v-e-r-s-i-o-n--


$

60
t/t4013/diff.format-patch_--attach_--stdout_initial..side

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
$ git format-patch --attach --stdout initial..side
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:03:00 +0000
Subject: [PATCH] Side
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------g-i-t--v-e-r-s-i-o-n"

This is a multi-part message in MIME format.
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
--------------g-i-t--v-e-r-s-i-o-n
Content-Type: text/x-patch;
name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

--------------g-i-t--v-e-r-s-i-o-n--


$

120
t/t4013/diff.format-patch_--stdout_initial..master

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
$ git format-patch --stdout initial..master
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000
Subject: [PATCH] Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3
--
g-i-t--v-e-r-s-i-o-n


From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:02:00 +0000
Subject: [PATCH] Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C
--
g-i-t--v-e-r-s-i-o-n


From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:03:00 +0000
Subject: [PATCH] Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
--
g-i-t--v-e-r-s-i-o-n

$

76
t/t4013/diff.format-patch_--stdout_initial..master^

@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
$ git format-patch --stdout initial..master^
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000
Subject: [PATCH] Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3
--
g-i-t--v-e-r-s-i-o-n


From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:02:00 +0000
Subject: [PATCH] Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C
--
g-i-t--v-e-r-s-i-o-n

$

45
t/t4013/diff.format-patch_--stdout_initial..side

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
$ git format-patch --stdout initial..side
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:03:00 +0000
Subject: [PATCH] Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
--
g-i-t--v-e-r-s-i-o-n

$

72
t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
$ git log --patch-with-stat --summary master -- dir/
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

127
t/t4013/diff.log_--patch-with-stat_master

@ -0,0 +1,127 @@ @@ -0,0 +1,127 @@
$ git log --patch-with-stat master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

72
t/t4013/diff.log_--patch-with-stat_master_--_dir_

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
$ git log --patch-with-stat master -- dir/
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

197
t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master

@ -0,0 +1,197 @@ @@ -0,0 +1,197 @@
$ git log --root --cc --patch-with-stat --summary master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --cc file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 file1

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)
delete mode 100644 file2

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)
create mode 100644 dir/sub
create mode 100644 file0
create mode 100644 file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

165
t/t4013/diff.log_--root_--patch-with-stat_--summary_master

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
$ git log --root --patch-with-stat --summary master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 file1

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)
delete mode 100644 file2

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)
create mode 100644 dir/sub
create mode 100644 file0
create mode 100644 file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

159
t/t4013/diff.log_--root_--patch-with-stat_master

@ -0,0 +1,159 @@ @@ -0,0 +1,159 @@
$ git log --root --patch-with-stat master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

197
t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master

@ -0,0 +1,197 @@ @@ -0,0 +1,197 @@
$ git log --root -c --patch-with-stat --summary master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

dir/sub | 2 ++
file0 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --combined dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --combined file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 file1

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)
delete mode 100644 file2

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 +++
3 files changed, 8 insertions(+), 0 deletions(-)
create mode 100644 dir/sub
create mode 100644 file0
create mode 100644 file2

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

140
t/t4013/diff.log_--root_-p_master

@ -0,0 +1,140 @@ @@ -0,0 +1,140 @@
$ git log --root -p master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

32
t/t4013/diff.log_--root_master

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
$ git log --root master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

18
t/t4013/diff.log_-SF_-p_master

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
$ git log -SF -p master
commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
$

8
t/t4013/diff.log_-SF_master

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
$ git log -SF master
commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

$

113
t/t4013/diff.log_-p_master

@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
$ git log -p master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

32
t/t4013/diff.log_master

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
$ git log master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second

commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

42
t/t4013/diff.show_--patch-with-raw_side

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
$ git show --patch-with-raw side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

:100644 100644 35d242b... 7289e35... M dir/sub
:100644 100644 01e79c3... f4615da... M file0
:000000 100644 0000000... 7289e35... A file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

44
t/t4013/diff.show_--patch-with-stat_--summary_side

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
$ git show --patch-with-stat --summary side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

43
t/t4013/diff.show_--patch-with-stat_side

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
$ git show --patch-with-stat side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

34
t/t4013/diff.show_--root_initial

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
$ git show --root initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial

diff --git a/dir/sub b/dir/sub
new file mode 100644
index 0000000..35d242b
--- /dev/null
+++ b/dir/sub
@@ -0,0 +1,2 @@
+A
+B
diff --git a/file0 b/file0
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file0
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/file2 b/file2
new file mode 100644
index 0000000..01e79c3
--- /dev/null
+++ b/file2
@@ -0,0 +1,3 @@
+1
+2
+3
$

13
t/t4013/diff.show_--stat_--summary_side

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
$ git show --stat --summary side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 file3
$

12
t/t4013/diff.show_--stat_side

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
$ git show --stat side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)
$

7
t/t4013/diff.show_initial

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
$ git show initial
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000

Initial
$

36
t/t4013/diff.show_master

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
$ git show master
commit 176b998f5d647cbd77a9d8acf4531e930754d16d
Merge: 889b315... c7a2ab9...
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub
+++ b/dir/sub
@@@ -1,6 -1,4 +1,8 @@@
A
B
+C
+D
+E
+F
+ 1
+ 2
diff --cc file0
index b414108,f4615da..10a8a9f
--- a/file0
+++ b/file0
@@@ -1,6 -1,6 +1,9 @@@
1
2
3
+4
+5
+6
+ A
+ B
+ C
$

38
t/t4013/diff.show_side

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
$ git show side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

59
t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
$ git whatchanged --patch-with-stat --summary master -- dir/
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
$

114
t/t4013/diff.whatchanged_--patch-with-stat_master

@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
$ git whatchanged --patch-with-stat master
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
file0 | 3 +++
file3 | 4 ++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
file1 | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F
diff --git a/file1 b/file1
new file mode 100644
index 0000000..b1e6722
--- /dev/null
+++ b/file1
@@ -0,0 +1,3 @@
+A
+B
+C

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
file0 | 3 +++
file2 | 3 ---
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
diff --git a/file0 b/file0
index 01e79c3..b414108 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+4
+5
+6
diff --git a/file2 b/file2
deleted file mode 100644
index 01e79c3..0000000
--- a/file2
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3
$

59
t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
$ git whatchanged --patch-with-stat master -- dir/
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Side
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2

commit 889b315013ef9f2e2f90aa0b054b267c8a557847
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 8422d40..cead32e 100644
--- a/dir/sub
+++ b/dir/sub
@@ -2,3 +2,5 @@ A
B
C
D
+E
+F

commit 7952a93e09bf565b5592766a438b40cd81f4846f
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000

Second
---
dir/sub | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dir/sub b/dir/sub
index 35d242b..8422d40 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+C
+D
$

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save