From 3c2f75b590c35675cc67dc43cabe2298bec86afc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 26 Jun 2006 13:46:52 -0700 Subject: t4013: add tests for diff/log family output options. Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 202 +++++++++++++++++++++ t/t4013/diff.diff-tree_--cc_master | 30 +++ t/t4013/diff.diff-tree_--patch-with-raw_initial | 2 + t/t4013/diff.diff-tree_--patch-with-stat_initial | 2 + ...-tree_--pretty=oneline_--patch-with-raw_initial | 2 + ...tree_--pretty=oneline_--patch-with-stat_initial | 2 + ...-pretty=oneline_--root_--patch-with-raw_initial | 33 ++++ ...pretty=oneline_--root_--patch-with-stat_initial | 35 ++++ ...ff.diff-tree_--pretty=oneline_--root_-p_initial | 29 +++ .../diff.diff-tree_--pretty=oneline_--root_initial | 6 + t/t4013/diff.diff-tree_--pretty=oneline_-p_initial | 2 + t/t4013/diff.diff-tree_--pretty=oneline_initial | 2 + ...iff.diff-tree_--pretty_--patch-with-raw_initial | 2 + ...ff.diff-tree_--pretty_--patch-with-stat_initial | 2 + .../diff.diff-tree_--pretty_--patch-with-stat_side | 43 +++++ ...f-tree_--pretty_--root_--patch-with-raw_initial | 38 ++++ ...-tree_--pretty_--root_--patch-with-stat_initial | 39 ++++ ...f-tree_--pretty_--root_--stat_--summary_initial | 15 ++ .../diff.diff-tree_--pretty_--root_--stat_initial | 12 ++ t/t4013/diff.diff-tree_--pretty_--root_-p_initial | 34 ++++ t/t4013/diff.diff-tree_--pretty_--root_initial | 11 ++ ...iff.diff-tree_--pretty_--stat_--summary_initial | 2 + t/t4013/diff.diff-tree_--pretty_--stat_initial | 2 + t/t4013/diff.diff-tree_--pretty_--summary_initial | 2 + t/t4013/diff.diff-tree_--pretty_-p_initial | 2 + t/t4013/diff.diff-tree_--pretty_-p_side | 38 ++++ t/t4013/diff.diff-tree_--pretty_initial | 2 + t/t4013/diff.diff-tree_--pretty_side | 11 ++ t/t4013/diff.diff-tree_--root_--abbrev_initial | 6 + .../diff.diff-tree_--root_--patch-with-raw_initial | 33 ++++ ...diff.diff-tree_--root_--patch-with-stat_initial | 34 ++++ t/t4013/diff.diff-tree_--root_-p_initial | 29 +++ .../diff.diff-tree_--root_-r_--abbrev=4_initial | 6 + t/t4013/diff.diff-tree_--root_-r_--abbrev_initial | 6 + t/t4013/diff.diff-tree_--root_-r_initial | 6 + t/t4013/diff.diff-tree_--root_initial | 6 + t/t4013/diff.diff-tree_-c_--abbrev_master | 5 + t/t4013/diff.diff-tree_-c_master | 5 + t/t4013/diff.diff-tree_-p_-m_master | 80 ++++++++ t/t4013/diff.diff-tree_-p_initial | 2 + t/t4013/diff.diff-tree_-p_master | 2 + t/t4013/diff.diff-tree_-r_--abbrev=4_initial | 2 + t/t4013/diff.diff-tree_-r_--abbrev_initial | 2 + t/t4013/diff.diff-tree_-r_initial | 2 + t/t4013/diff.diff-tree_initial | 2 + t/t4013/diff.diff-tree_master | 2 + t/t4013/diff.log_--patch-with-stat_master | 127 +++++++++++++ t/t4013/diff.log_--patch-with-stat_master_--_dir_ | 72 ++++++++ t/t4013/diff.log_--root_--patch-with-stat_master | 159 ++++++++++++++++ t/t4013/diff.log_--root_-p_master | 140 ++++++++++++++ t/t4013/diff.log_--root_master | 32 ++++ t/t4013/diff.log_-SF_master | 8 + t/t4013/diff.log_-p_master | 113 ++++++++++++ t/t4013/diff.log_master | 32 ++++ t/t4013/diff.show_--patch-with-raw_side | 42 +++++ t/t4013/diff.show_--patch-with-stat_--summary_side | 44 +++++ t/t4013/diff.show_--patch-with-stat_side | 43 +++++ t/t4013/diff.show_--root_initial | 34 ++++ t/t4013/diff.show_--stat_--summary_side | 13 ++ t/t4013/diff.show_--stat_side | 12 ++ t/t4013/diff.show_initial | 7 + t/t4013/diff.show_master | 36 ++++ t/t4013/diff.show_side | 38 ++++ t/t4013/diff.whatchanged_--patch-with-stat_master | 114 ++++++++++++ ...ff.whatchanged_--patch-with-stat_master_--_dir_ | 59 ++++++ ...anged_--root_--patch-with-stat_--summary_master | 158 ++++++++++++++++ ...iff.whatchanged_--root_--patch-with-stat_master | 152 ++++++++++++++++ t/t4013/diff.whatchanged_--root_-p_master | 133 ++++++++++++++ t/t4013/diff.whatchanged_--root_master | 40 ++++ t/t4013/diff.whatchanged_-SF_master | 9 + t/t4013/diff.whatchanged_-p_master | 100 ++++++++++ t/t4013/diff.whatchanged_master | 30 +++ 72 files changed, 2579 insertions(+) create mode 100755 t/t4013-diff-various.sh create mode 100644 t/t4013/diff.diff-tree_--cc_master create mode 100644 t/t4013/diff.diff-tree_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_--root_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_-p_initial create mode 100644 t/t4013/diff.diff-tree_--pretty=oneline_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_-p_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--stat_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--summary_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_-p_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_-p_side create mode 100644 t/t4013/diff.diff-tree_--pretty_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_side create mode 100644 t/t4013/diff.diff-tree_--root_--abbrev_initial create mode 100644 t/t4013/diff.diff-tree_--root_--patch-with-raw_initial create mode 100644 t/t4013/diff.diff-tree_--root_--patch-with-stat_initial create mode 100644 t/t4013/diff.diff-tree_--root_-p_initial create mode 100644 t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial create mode 100644 t/t4013/diff.diff-tree_--root_-r_--abbrev_initial create mode 100644 t/t4013/diff.diff-tree_--root_-r_initial create mode 100644 t/t4013/diff.diff-tree_--root_initial create mode 100644 t/t4013/diff.diff-tree_-c_--abbrev_master create mode 100644 t/t4013/diff.diff-tree_-c_master create mode 100644 t/t4013/diff.diff-tree_-p_-m_master create mode 100644 t/t4013/diff.diff-tree_-p_initial create mode 100644 t/t4013/diff.diff-tree_-p_master create mode 100644 t/t4013/diff.diff-tree_-r_--abbrev=4_initial create mode 100644 t/t4013/diff.diff-tree_-r_--abbrev_initial create mode 100644 t/t4013/diff.diff-tree_-r_initial create mode 100644 t/t4013/diff.diff-tree_initial create mode 100644 t/t4013/diff.diff-tree_master create mode 100644 t/t4013/diff.log_--patch-with-stat_master create mode 100644 t/t4013/diff.log_--patch-with-stat_master_--_dir_ create mode 100644 t/t4013/diff.log_--root_--patch-with-stat_master create mode 100644 t/t4013/diff.log_--root_-p_master create mode 100644 t/t4013/diff.log_--root_master create mode 100644 t/t4013/diff.log_-SF_master create mode 100644 t/t4013/diff.log_-p_master create mode 100644 t/t4013/diff.log_master create mode 100644 t/t4013/diff.show_--patch-with-raw_side create mode 100644 t/t4013/diff.show_--patch-with-stat_--summary_side create mode 100644 t/t4013/diff.show_--patch-with-stat_side create mode 100644 t/t4013/diff.show_--root_initial create mode 100644 t/t4013/diff.show_--stat_--summary_side create mode 100644 t/t4013/diff.show_--stat_side create mode 100644 t/t4013/diff.show_initial create mode 100644 t/t4013/diff.show_master create mode 100644 t/t4013/diff.show_side create mode 100644 t/t4013/diff.whatchanged_--patch-with-stat_master create mode 100644 t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ create mode 100644 t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.whatchanged_--root_--patch-with-stat_master create mode 100644 t/t4013/diff.whatchanged_--root_-p_master create mode 100644 t/t4013/diff.whatchanged_--root_master create mode 100644 t/t4013/diff.whatchanged_-SF_master create mode 100644 t/t4013/diff.whatchanged_-p_master create mode 100644 t/t4013/diff.whatchanged_master diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh new file mode 100755 index 0000000000..802e0ba01d --- /dev/null +++ b/t/t4013-diff-various.sh @@ -0,0 +1,202 @@ +#!/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 + +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 + 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 +#diff-tree --pretty --root --summary 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 +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 + +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 +log -SF 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 +whatchanged -SF master + +log --patch-with-stat master -- dir/ +whatchanged --patch-with-stat 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 + + + +EOF + +test_done diff --git a/t/t4013/diff.diff-tree_--cc_master b/t/t4013/diff.diff-tree_--cc_master new file mode 100644 index 0000000000..e57d943bdc --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_master @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--patch-with-raw_initial new file mode 100644 index 0000000000..fc177ab3f2 --- /dev/null +++ b/t/t4013/diff.diff-tree_--patch-with-raw_initial @@ -0,0 +1,2 @@ +$ git diff-tree --patch-with-raw initial +$ diff --git a/t/t4013/diff.diff-tree_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--patch-with-stat_initial new file mode 100644 index 0000000000..bd905b1c57 --- /dev/null +++ b/t/t4013/diff.diff-tree_--patch-with-stat_initial @@ -0,0 +1,2 @@ +$ git diff-tree --patch-with-stat initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial new file mode 100644 index 0000000000..7bb8b45e3e --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-raw_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty=oneline --patch-with-raw initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial new file mode 100644 index 0000000000..cbdde4f400 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--patch-with-stat_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty=oneline --patch-with-stat initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial new file mode 100644 index 0000000000..cd79f1a0ff --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-raw_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial new file mode 100644 index 0000000000..49e26fb99a --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial @@ -0,0 +1,35 @@ +$ 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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial new file mode 100644 index 0000000000..3c5092c699 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_-p_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_initial new file mode 100644 index 0000000000..08920ac658 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_-p_initial b/t/t4013/diff.diff-tree_--pretty=oneline_-p_initial new file mode 100644 index 0000000000..94b76bfef1 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_-p_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty=oneline -p initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_initial b/t/t4013/diff.diff-tree_--pretty=oneline_initial new file mode 100644 index 0000000000..d50970d574 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty=oneline_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty=oneline initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial new file mode 100644 index 0000000000..3a85316d8a --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-raw_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty --patch-with-raw initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial new file mode 100644 index 0000000000..2e08239a46 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty --patch-with-stat initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side new file mode 100644 index 0000000000..4d30e7eddc --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side @@ -0,0 +1,43 @@ +$ git diff-tree --pretty --patch-with-stat side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial new file mode 100644 index 0000000000..a3203bd19b --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial @@ -0,0 +1,38 @@ +$ git diff-tree --pretty --root --patch-with-raw initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial new file mode 100644 index 0000000000..7dfa6af3c9 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial @@ -0,0 +1,39 @@ +$ git diff-tree --pretty --root --patch-with-stat initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial new file mode 100644 index 0000000000..43bfce253e --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial @@ -0,0 +1,15 @@ +$ git diff-tree --pretty --root --stat --summary initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial new file mode 100644 index 0000000000..9154aa4d47 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial @@ -0,0 +1,12 @@ +$ git diff-tree --pretty --root --stat initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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/t/t4013/diff.diff-tree_--pretty_--root_-p_initial b/t/t4013/diff.diff-tree_--pretty_--root_-p_initial new file mode 100644 index 0000000000..d0411f64ec --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_-p_initial @@ -0,0 +1,34 @@ +$ git diff-tree --pretty --root -p initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_initial b/t/t4013/diff.diff-tree_--pretty_--root_initial new file mode 100644 index 0000000000..94e32eabb1 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_initial @@ -0,0 +1,11 @@ +$ git diff-tree --pretty --root initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial new file mode 100644 index 0000000000..c22983ac4a --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--stat_--summary_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty --stat --summary initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--stat_initial b/t/t4013/diff.diff-tree_--pretty_--stat_initial new file mode 100644 index 0000000000..8fdcfb4c0a --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--stat_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty --stat initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--summary_initial new file mode 100644 index 0000000000..9bc2c4fbad --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--summary_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty --summary initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_-p_initial b/t/t4013/diff.diff-tree_--pretty_-p_initial new file mode 100644 index 0000000000..3c9942faf4 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_-p_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty -p initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_-p_side b/t/t4013/diff.diff-tree_--pretty_-p_side new file mode 100644 index 0000000000..b993aa7b89 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_-p_side @@ -0,0 +1,38 @@ +$ git diff-tree --pretty -p side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_initial b/t/t4013/diff.diff-tree_--pretty_initial new file mode 100644 index 0000000000..14715bf7d0 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_initial @@ -0,0 +1,2 @@ +$ git diff-tree --pretty initial +$ diff --git a/t/t4013/diff.diff-tree_--pretty_side b/t/t4013/diff.diff-tree_--pretty_side new file mode 100644 index 0000000000..e9b6e1c102 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_side @@ -0,0 +1,11 @@ +$ git diff-tree --pretty side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.diff-tree_--root_--abbrev_initial b/t/t4013/diff.diff-tree_--root_--abbrev_initial new file mode 100644 index 0000000000..5aa84b2a86 --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_--abbrev_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--root_--patch-with-raw_initial new file mode 100644 index 0000000000..d295e475dd --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_--patch-with-raw_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial new file mode 100644 index 0000000000..1562b62708 --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_-p_initial b/t/t4013/diff.diff-tree_--root_-p_initial new file mode 100644 index 0000000000..3219c72fcb --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_-p_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial b/t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial new file mode 100644 index 0000000000..0c5361688c --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_-r_--abbrev=4_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_-r_--abbrev_initial b/t/t4013/diff.diff-tree_--root_-r_--abbrev_initial new file mode 100644 index 0000000000..c7b460faf6 --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_-r_--abbrev_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_-r_initial b/t/t4013/diff.diff-tree_--root_-r_initial new file mode 100644 index 0000000000..eed435e175 --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_-r_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--root_initial b/t/t4013/diff.diff-tree_--root_initial new file mode 100644 index 0000000000..ddf6b068ab --- /dev/null +++ b/t/t4013/diff.diff-tree_--root_initial @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_-c_--abbrev_master b/t/t4013/diff.diff-tree_-c_--abbrev_master new file mode 100644 index 0000000000..39d511a7cf --- /dev/null +++ b/t/t4013/diff.diff-tree_-c_--abbrev_master @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_-c_master b/t/t4013/diff.diff-tree_-c_master new file mode 100644 index 0000000000..c258efe222 --- /dev/null +++ b/t/t4013/diff.diff-tree_-c_master @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_-p_-m_master b/t/t4013/diff.diff-tree_-p_-m_master new file mode 100644 index 0000000000..1be721560a --- /dev/null +++ b/t/t4013/diff.diff-tree_-p_-m_master @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_-p_initial b/t/t4013/diff.diff-tree_-p_initial new file mode 100644 index 0000000000..e20ce88370 --- /dev/null +++ b/t/t4013/diff.diff-tree_-p_initial @@ -0,0 +1,2 @@ +$ git diff-tree -p initial +$ diff --git a/t/t4013/diff.diff-tree_-p_master b/t/t4013/diff.diff-tree_-p_master new file mode 100644 index 0000000000..b182875fb2 --- /dev/null +++ b/t/t4013/diff.diff-tree_-p_master @@ -0,0 +1,2 @@ +$ git diff-tree -p master +$ diff --git a/t/t4013/diff.diff-tree_-r_--abbrev=4_initial b/t/t4013/diff.diff-tree_-r_--abbrev=4_initial new file mode 100644 index 0000000000..c5a3aa5aa4 --- /dev/null +++ b/t/t4013/diff.diff-tree_-r_--abbrev=4_initial @@ -0,0 +1,2 @@ +$ git diff-tree -r --abbrev=4 initial +$ diff --git a/t/t4013/diff.diff-tree_-r_--abbrev_initial b/t/t4013/diff.diff-tree_-r_--abbrev_initial new file mode 100644 index 0000000000..0b689b773c --- /dev/null +++ b/t/t4013/diff.diff-tree_-r_--abbrev_initial @@ -0,0 +1,2 @@ +$ git diff-tree -r --abbrev initial +$ diff --git a/t/t4013/diff.diff-tree_-r_initial b/t/t4013/diff.diff-tree_-r_initial new file mode 100644 index 0000000000..1765d83ce4 --- /dev/null +++ b/t/t4013/diff.diff-tree_-r_initial @@ -0,0 +1,2 @@ +$ git diff-tree -r initial +$ diff --git a/t/t4013/diff.diff-tree_initial b/t/t4013/diff.diff-tree_initial new file mode 100644 index 0000000000..b49fc53457 --- /dev/null +++ b/t/t4013/diff.diff-tree_initial @@ -0,0 +1,2 @@ +$ git diff-tree initial +$ diff --git a/t/t4013/diff.diff-tree_master b/t/t4013/diff.diff-tree_master new file mode 100644 index 0000000000..fe9226f8a1 --- /dev/null +++ b/t/t4013/diff.diff-tree_master @@ -0,0 +1,2 @@ +$ git diff-tree master +$ diff --git a/t/t4013/diff.log_--patch-with-stat_master b/t/t4013/diff.log_--patch-with-stat_master new file mode 100644 index 0000000000..b97969dc98 --- /dev/null +++ b/t/t4013/diff.log_--patch-with-stat_master @@ -0,0 +1,127 @@ +$ git log --patch-with-stat master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.log_--patch-with-stat_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_ new file mode 100644 index 0000000000..71a6d0f853 --- /dev/null +++ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_ @@ -0,0 +1,72 @@ +$ git log --patch-with-stat master -- dir/ +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.log_--root_--patch-with-stat_master b/t/t4013/diff.log_--root_--patch-with-stat_master new file mode 100644 index 0000000000..1e9bdc4c1c --- /dev/null +++ b/t/t4013/diff.log_--root_--patch-with-stat_master @@ -0,0 +1,159 @@ +$ git log --root --patch-with-stat master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.log_--root_-p_master b/t/t4013/diff.log_--root_-p_master new file mode 100644 index 0000000000..2296986ad1 --- /dev/null +++ b/t/t4013/diff.log_--root_-p_master @@ -0,0 +1,140 @@ +$ git log --root -p master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.log_--root_master b/t/t4013/diff.log_--root_master new file mode 100644 index 0000000000..7554a468d1 --- /dev/null +++ b/t/t4013/diff.log_--root_master @@ -0,0 +1,32 @@ +$ git log --root master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +Date: Mon Jun 26 00:03:00 2006 +0000 + + Side + +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +commit 7952a93e09bf565b5592766a438b40cd81f4846f +Author: A U Thor +Date: Mon Jun 26 00:01:00 2006 +0000 + + Second + +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.log_-SF_master b/t/t4013/diff.log_-SF_master new file mode 100644 index 0000000000..f307b4d2a8 --- /dev/null +++ b/t/t4013/diff.log_-SF_master @@ -0,0 +1,8 @@ +$ git log -SF master +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +$ diff --git a/t/t4013/diff.log_-p_master b/t/t4013/diff.log_-p_master new file mode 100644 index 0000000000..e82a72f6f8 --- /dev/null +++ b/t/t4013/diff.log_-p_master @@ -0,0 +1,113 @@ +$ git log -p master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.log_master b/t/t4013/diff.log_master new file mode 100644 index 0000000000..7b86ed1f5d --- /dev/null +++ b/t/t4013/diff.log_master @@ -0,0 +1,32 @@ +$ git log master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +Date: Mon Jun 26 00:03:00 2006 +0000 + + Side + +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +commit 7952a93e09bf565b5592766a438b40cd81f4846f +Author: A U Thor +Date: Mon Jun 26 00:01:00 2006 +0000 + + Second + +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.show_--patch-with-raw_side b/t/t4013/diff.show_--patch-with-raw_side new file mode 100644 index 0000000000..221b46a7cc --- /dev/null +++ b/t/t4013/diff.show_--patch-with-raw_side @@ -0,0 +1,42 @@ +$ git show --patch-with-raw side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.show_--patch-with-stat_--summary_side b/t/t4013/diff.show_--patch-with-stat_--summary_side new file mode 100644 index 0000000000..377f2b7b7a --- /dev/null +++ b/t/t4013/diff.show_--patch-with-stat_--summary_side @@ -0,0 +1,44 @@ +$ git show --patch-with-stat --summary side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.show_--patch-with-stat_side b/t/t4013/diff.show_--patch-with-stat_side new file mode 100644 index 0000000000..fb14c530d2 --- /dev/null +++ b/t/t4013/diff.show_--patch-with-stat_side @@ -0,0 +1,43 @@ +$ git show --patch-with-stat side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.show_--root_initial b/t/t4013/diff.show_--root_initial new file mode 100644 index 0000000000..8c89136c4d --- /dev/null +++ b/t/t4013/diff.show_--root_initial @@ -0,0 +1,34 @@ +$ git show --root initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.show_--stat_--summary_side b/t/t4013/diff.show_--stat_--summary_side new file mode 100644 index 0000000000..5bd5977628 --- /dev/null +++ b/t/t4013/diff.show_--stat_--summary_side @@ -0,0 +1,13 @@ +$ git show --stat --summary side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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/t/t4013/diff.show_--stat_side b/t/t4013/diff.show_--stat_side new file mode 100644 index 0000000000..3b22327e48 --- /dev/null +++ b/t/t4013/diff.show_--stat_side @@ -0,0 +1,12 @@ +$ git show --stat side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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/t/t4013/diff.show_initial b/t/t4013/diff.show_initial new file mode 100644 index 0000000000..4c4066ae48 --- /dev/null +++ b/t/t4013/diff.show_initial @@ -0,0 +1,7 @@ +$ git show initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.show_master b/t/t4013/diff.show_master new file mode 100644 index 0000000000..3772a87e13 --- /dev/null +++ b/t/t4013/diff.show_master @@ -0,0 +1,36 @@ +$ git show master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.show_side b/t/t4013/diff.show_side new file mode 100644 index 0000000000..530a073b19 --- /dev/null +++ b/t/t4013/diff.show_side @@ -0,0 +1,38 @@ +$ git show side +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +$ diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master b/t/t4013/diff.whatchanged_--patch-with-stat_master new file mode 100644 index 0000000000..a89b573f45 --- /dev/null +++ b/t/t4013/diff.whatchanged_--patch-with-stat_master @@ -0,0 +1,114 @@ +$ git whatchanged --patch-with-stat master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ new file mode 100644 index 0000000000..b6d9752164 --- /dev/null +++ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ @@ -0,0 +1,59 @@ +$ git whatchanged --patch-with-stat master -- dir/ +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..f707bfa3a1 --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master @@ -0,0 +1,158 @@ +$ git whatchanged --root --patch-with-stat --summary master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master new file mode 100644 index 0000000000..61aca41711 --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master @@ -0,0 +1,152 @@ +$ git whatchanged --root --patch-with-stat master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_-p_master b/t/t4013/diff.whatchanged_--root_-p_master new file mode 100644 index 0000000000..b4cd05e576 --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_-p_master @@ -0,0 +1,133 @@ +$ git whatchanged --root -p master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_master b/t/t4013/diff.whatchanged_--root_master new file mode 100644 index 0000000000..011a22178f --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_master @@ -0,0 +1,40 @@ +$ git whatchanged --root master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 + +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +:100644 100644 8422d40... cead32e... M dir/sub +:000000 100644 0000000... b1e6722... A file1 + +commit 7952a93e09bf565b5592766a438b40cd81f4846f +Author: A U Thor +Date: Mon Jun 26 00:01:00 2006 +0000 + + Second + +:100644 100644 35d242b... 8422d40... M dir/sub +:100644 100644 01e79c3... b414108... M file0 +:100644 000000 01e79c3... 0000000... D file2 + +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial + +:000000 100644 0000000... 35d242b... A dir/sub +:000000 100644 0000000... 01e79c3... A file0 +:000000 100644 0000000... 01e79c3... A file2 +$ diff --git a/t/t4013/diff.whatchanged_-SF_master b/t/t4013/diff.whatchanged_-SF_master new file mode 100644 index 0000000000..a4fe6f8a39 --- /dev/null +++ b/t/t4013/diff.whatchanged_-SF_master @@ -0,0 +1,9 @@ +$ git whatchanged -SF master +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +:100644 100644 8422d40... cead32e... M dir/sub +$ diff --git a/t/t4013/diff.whatchanged_-p_master b/t/t4013/diff.whatchanged_-p_master new file mode 100644 index 0000000000..f9a4456725 --- /dev/null +++ b/t/t4013/diff.whatchanged_-p_master @@ -0,0 +1,100 @@ +$ git whatchanged -p master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_master b/t/t4013/diff.whatchanged_master new file mode 100644 index 0000000000..c22416c006 --- /dev/null +++ b/t/t4013/diff.whatchanged_master @@ -0,0 +1,30 @@ +$ git whatchanged master +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 + +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +Date: Mon Jun 26 00:02:00 2006 +0000 + + Third + +:100644 100644 8422d40... cead32e... M dir/sub +:000000 100644 0000000... b1e6722... A file1 + +commit 7952a93e09bf565b5592766a438b40cd81f4846f +Author: A U Thor +Date: Mon Jun 26 00:01:00 2006 +0000 + + Second + +:100644 100644 35d242b... 8422d40... M dir/sub +:100644 100644 01e79c3... b414108... M file0 +:100644 000000 01e79c3... 0000000... D file2 +$ -- cgit v1.2.1 From c6744349df5089133b7662e67aba28282b6a963f Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:21:53 +0300 Subject: Merge with_raw, with_stat and summary variables to output_format DIFF_FORMAT_* are now bit-flags instead of enumerated values. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-diff.c | 2 +- builtin-log.c | 4 +- combine-diff.c | 55 ++++++++--------- diff.c | 183 +++++++++++++++++++++++++++------------------------------ diff.h | 27 +++++---- log-tree.c | 9 ++- 6 files changed, 136 insertions(+), 144 deletions(-) diff --git a/builtin-diff.c b/builtin-diff.c index 99a2f76605..3b44296ff4 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -56,7 +56,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 diff --git a/builtin-log.c b/builtin-log.c index 44d2d136f5..e321959c56 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -176,11 +176,9 @@ 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.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; git_config(git_format_config); rev.extra_headers = extra_headers; diff --git a/combine-diff.c b/combine-diff.c index 64b20cce24..3daa8cb13e 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -771,7 +771,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re if (rev->loginfo) show_log(rev, rev->loginfo, "\n"); - if (opt->output_format == DIFF_FORMAT_RAW) { + if (opt->output_format & DIFF_FORMAT_RAW) { offset = strlen(COLONS) - num_parent; if (offset < 0) offset = 0; @@ -791,8 +791,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); @@ -818,17 +817,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,13 +836,9 @@ void diff_tree_combined(const unsigned char *sha1, struct diff_options diffopts; struct combine_diff_path *p, *paths = NULL; int i, num_paths; - int do_diffstat; - 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_RAW | DIFF_FORMAT_DIFFSTAT); diffopts.recursive = 1; /* find set of paths that everybody touches */ @@ -856,19 +846,18 @@ void diff_tree_combined(const unsigned char *sha1, /* show stat against the first parent even * when doing combined diff. */ - if (i == 0 && do_diffstat) - diffopts.output_format = DIFF_FORMAT_DIFFSTAT; + if (i == 0 && opt->output_format & DIFF_FORMAT_DIFFSTAT) + diffopts.output_format |= DIFF_FORMAT_DIFFSTAT; else - diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; + diffopts.output_format |= DIFF_FORMAT_NO_OUTPUT; diff_tree_sha1(parent[i], sha1, "", &diffopts); 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 (opt->output_format & DIFF_FORMAT_DIFFSTAT && rev->loginfo) + show_log(rev, rev->loginfo, "---\n"); diff_flush(&diffopts); - if (opt->with_stat) + if (opt->output_format & DIFF_FORMAT_DIFFSTAT) putchar('\n'); } @@ -878,17 +867,21 @@ 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); } - for (p = paths; p; p = p->next) { - show_combined_diff(p, num_parent, dense, rev); + if (opt->output_format & DIFF_FORMAT_PATCH) { + for (p = paths; p; p = p->next) { + if (p->len) + show_patch_diff(p, num_parent, dense, + rev); + } } } diff --git a/diff.c b/diff.c index fbb6c26cd9..49b2eeb741 100644 --- a/diff.c +++ b/diff.c @@ -1438,23 +1438,27 @@ int diff_setup_done(struct diff_options *options) (0 <= options->rename_limit && !options->detect_rename)) return -1; + if (options->output_format & DIFF_FORMAT_NO_OUTPUT) + options->output_format = 0; + + 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. - */ - if (options->output_format == DIFF_FORMAT_RAW) - options->with_raw = 0; - if (options->output_format == DIFF_FORMAT_DIFFSTAT) - options->with_stat = 0; - if (options->detect_rename && options->rename_limit < 0) options->rename_limit = diff_rename_limit_default; if (options->setup & DIFF_SETUP_USE_CACHE) { @@ -1526,22 +1530,20 @@ 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, "--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 +1552,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 +1740,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 +1779,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 +1988,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) @@ -2107,55 +2094,61 @@ static void diff_summary(struct diff_filepair *p) void diff_flush(struct diff_options *options) { struct diff_queue_struct *q = &diff_queued_diff; - int i; - int diff_output_format = options->output_format; - struct diffstat_t *diffstat = NULL; + int i, output_format = options->output_format; - if (diff_output_format == DIFF_FORMAT_DIFFSTAT || options->with_stat) { - diffstat = xcalloc(sizeof (struct diffstat_t), 1); - diffstat->xm.consume = diffstat_consume; - } + /* + * Order: raw, stat, summary, patch + * or: name/name-status/checkdiff (other bits clear) + */ - if (options->with_raw) { + 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); } - if (options->with_stat) { + + if (output_format & DIFF_FORMAT_DIFFSTAT) { + struct diffstat_t *diffstat; + + diffstat = xcalloc(sizeof (struct diffstat_t), 1); + 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); } - if (diffstat) { - show_stats(diffstat); - free(diffstat); + if (output_format & DIFF_FORMAT_SUMMARY) { + for (i = 0; i < q->nr; i++) + diff_summary(q->queue[i]); } - 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 (output_format & (DIFF_FORMAT_DIFFSTAT | + DIFF_FORMAT_SUMMARY)) { + 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]; + if (check_pair_status(p)) + diff_flush_patch(p, options); + } } + for (i = 0; i < q->nr; i++) + diff_free_filepair(q->queue[i]); free(q->queue); q->queue = NULL; q->nr = q->alloc = 0; diff --git a/diff.h b/diff.h index b61fdc8f1e..2b6dc0cbe4 100644 --- a/diff.h +++ b/diff.h @@ -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; @@ -151,15 +163,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 */ diff --git a/log-tree.c b/log-tree.c index ebb49f2970..7d4c51f954 100644 --- a/log-tree.c +++ b/log-tree.c @@ -163,8 +163,13 @@ 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) { + if (opt->diffopt.output_format & DIFF_FORMAT_DIFFSTAT) { + show_log(opt, opt->loginfo, "---\n"); + } else { + show_log(opt, opt->loginfo, "\n"); + } + } diff_flush(&opt->diffopt); return 1; } -- cgit v1.2.1 From a610786f4bc282410d348aba97316115a57740a0 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:23:06 +0300 Subject: Make --raw option available for all diff commands Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-diff.c | 48 ++++++++++++------------------------------------ diff.c | 2 ++ 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/builtin-diff.c b/builtin-diff.c index 3b44296ff4..91235a118a 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -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--; @@ -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, */ 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, 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, { 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, 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)); diff --git a/diff.c b/diff.c index 49b2eeb741..12f655a2fa 100644 --- a/diff.c +++ b/diff.c @@ -1533,6 +1533,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) options->output_format |= DIFF_FORMAT_PATCH; else if (opt_arg(arg, 'U', "unified", &options->context)) 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 | DIFF_FORMAT_RAW; } -- cgit v1.2.1 From c9b5ef998a3027d9f11b0820bb13896096833ccb Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:24:14 +0300 Subject: Set default diff output format after parsing command line Initialize output_format to 0 instead of DIFF_FORMAT_RAW so that we can see later if any command line options changed it. Default value is set only if output format was not specified. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-diff-files.c | 3 +++ builtin-diff-index.c | 3 +++ builtin-diff-stages.c | 3 +++ builtin-diff-tree.c | 3 +++ builtin-diff.c | 4 +++- builtin-log.c | 4 +++- diff.c | 1 - 7 files changed, 18 insertions(+), 3 deletions(-) diff --git a/builtin-diff-files.c b/builtin-diff-files.c index 5afc1d7208..a655eea91e 100644 --- a/builtin-diff-files.c +++ b/builtin-diff-files.c @@ -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), diff --git a/builtin-diff-index.c b/builtin-diff-index.c index c42ef9a7a7..b37c9e8ccb 100644 --- a/builtin-diff-index.c +++ b/builtin-diff-index.c @@ -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. diff --git a/builtin-diff-stages.c b/builtin-diff-stages.c index 7c157ca889..30931fe049 100644 --- a/builtin-diff-stages.c +++ b/builtin-diff-stages.c @@ -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) || diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index 3409a39a9f..ae1cde9d00 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -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 diff --git a/builtin-diff.c b/builtin-diff.c index 91235a118a..47e0a37e21 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -252,9 +252,11 @@ 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; + /* Do we have --cached and not have a pending object, then * default to HEAD by hand. Eek. */ diff --git a/builtin-log.c b/builtin-log.c index e321959c56..c1bf9d4ee1 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -178,7 +178,6 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; - rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; git_config(git_format_config); rev.extra_headers = extra_headers; @@ -247,6 +246,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?"); diff --git a/diff.c b/diff.c index 12f655a2fa..928345199d 100644 --- a/diff.c +++ b/diff.c @@ -1420,7 +1420,6 @@ 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; -- cgit v1.2.1 From 0e677e1a6b0d1c0e848ed19d18dda1c3c797c75e Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 Jun 2006 20:25:08 +0300 Subject: DIFF_FORMAT_RAW is not default anymore diff_setup() used to initialize output_format to DIFF_FORMAT_RAW. Now the default is 0 (no output) so don't compare against DIFF_FORMAT_RAW to see if any diff format command line flags were given. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 5 +---- revision.c | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index c1bf9d4ee1..4e5273aecf 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -24,11 +24,8 @@ static int cmd_log_wc(int argc, const char **argv, char **envp, rev->verbose_header = 1; argc = setup_revisions(argc, argv, rev, "HEAD"); if (rev->always_show_header) { - if (rev->diffopt.pickaxe || rev->diffopt.filter) { + 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 (argc > 1) diff --git a/revision.c b/revision.c index b963f2adfd..ae4ca82003 100644 --- a/revision.c +++ b/revision.c @@ -851,8 +851,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; -- cgit v1.2.1 From 39bc9a6c2051a9fc31dc9b34b40bdd3dd94a8afb Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sun, 25 Jun 2006 13:54:14 +0300 Subject: Add msg_sep to diff_options Add msg_sep variable to struct diff_options. msg_sep is printed after commit message. Default is "\n", format-patch sets it to "---\n". This also removes the second argument from show_log() because all callers derived it from the first argument: show_log(rev, rev->loginfo, ... Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 1 + combine-diff.c | 7 ++++--- diff.c | 1 + diff.h | 1 + log-tree.c | 15 ++++++--------- log-tree.h | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 4e5273aecf..71ae6c98a5 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -175,6 +175,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; + rev.diffopt.msg_sep = "---\n"; git_config(git_format_config); rev.extra_headers = extra_headers; diff --git a/combine-diff.c b/combine-diff.c index 3daa8cb13e..39fb10c145 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -701,7 +701,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++) { @@ -769,7 +769,7 @@ 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) { offset = strlen(COLONS) - num_parent; @@ -855,7 +855,8 @@ void diff_tree_combined(const unsigned char *sha1, paths = intersect_paths(paths, i, num_parent); if (opt->output_format & DIFF_FORMAT_DIFFSTAT && rev->loginfo) - show_log(rev, rev->loginfo, "---\n"); + show_log(rev, opt->msg_sep); + diff_flush(&diffopts); if (opt->output_format & DIFF_FORMAT_DIFFSTAT) putchar('\n'); diff --git a/diff.c b/diff.c index 928345199d..491b846f62 100644 --- a/diff.c +++ b/diff.c @@ -1424,6 +1424,7 @@ void diff_setup(struct diff_options *options) options->break_opt = -1; options->rename_limit = -1; options->context = 3; + options->msg_sep = "\n"; options->change = diff_change; options->add_remove = diff_addremove; diff --git a/diff.h b/diff.h index 2b6dc0cbe4..729cd02510 100644 --- a/diff.h +++ b/diff.h @@ -57,6 +57,7 @@ struct diff_options { int rename_limit; int setup; int abbrev; + const char *msg_sep; const char *stat_sep; long xdl_opts; diff --git a/log-tree.c b/log-tree.c index 7d4c51f954..ab6b682223 100644 --- a/log-tree.c +++ b/log-tree.c @@ -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,13 +164,9 @@ int log_tree_diff_flush(struct rev_info *opt) return 0; } - if (opt->loginfo && !opt->no_commit_id) { - if (opt->diffopt.output_format & DIFF_FORMAT_DIFFSTAT) { - show_log(opt, opt->loginfo, "---\n"); - } else { - show_log(opt, opt->loginfo, "\n"); - } - } + if (opt->loginfo && !opt->no_commit_id) + show_log(opt, opt->diffopt.msg_sep); + diff_flush(&opt->diffopt); return 1; } @@ -266,7 +263,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; diff --git a/log-tree.h b/log-tree.h index a26e4841ff..e82b56a20d 100644 --- a/log-tree.h +++ b/log-tree.h @@ -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 -- cgit v1.2.1 From 5e2b0636c709884e45ef941cd4514c225f204982 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sun, 25 Jun 2006 14:28:19 +0300 Subject: Don't xcalloc() struct diffstat_t Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- diff.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 491b846f62..54698f511a 100644 --- a/diff.c +++ b/diff.c @@ -2115,17 +2115,16 @@ void diff_flush(struct diff_options *options) } if (output_format & DIFF_FORMAT_DIFFSTAT) { - struct diffstat_t *diffstat; + struct diffstat_t diffstat; - diffstat = xcalloc(sizeof (struct diffstat_t), 1); - diffstat->xm.consume = diffstat_consume; + 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]; if (check_pair_status(p)) - diff_flush_stat(p, options, diffstat); + diff_flush_stat(p, options, &diffstat); } - show_stats(diffstat); - free(diffstat); + show_stats(&diffstat); } if (output_format & DIFF_FORMAT_SUMMARY) { -- cgit v1.2.1 From 9dafea267806988d7f5821780de688ca84766a40 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sun, 25 Jun 2006 15:39:35 +0300 Subject: whatchanged: Default to DIFF_FORMAT_RAW Split cmd_log_wc() to cmd_log_init() and cmd_log_walk() and set default diff output format for whatchanged to DIFF_FORMAT_RAW. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 71ae6c98a5..3b7574f6d6 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -14,22 +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.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(); @@ -51,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) @@ -66,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) @@ -76,7 +80,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) -- cgit v1.2.1 From 47979d5d5bb86d058dce77801648734abe1e593b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 26 Jun 2006 23:29:11 -0700 Subject: t4013: add more tests around -c and --cc Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 28 ++- ...ff-tree_--cc_--patch-with-stat_--summary_master | 35 ++++ ...diff-tree_--cc_--patch-with-stat_--summary_side | 39 ++++ .../diff.diff-tree_--cc_--stat_--summary_master | 6 + t/t4013/diff.diff-tree_--cc_--stat_--summary_side | 8 + t/t4013/diff.diff-tree_--cc_--stat_master | 6 + t/t4013/diff.diff-tree_-c_--stat_--summary_master | 6 + t/t4013/diff.diff-tree_-c_--stat_--summary_side | 8 + t/t4013/diff.diff-tree_-c_--stat_master | 6 + ....log_--patch-with-stat_--summary_master_--_dir_ | 72 ++++++++ ..._--root_--cc_--patch-with-stat_--summary_master | 198 +++++++++++++++++++++ ...f.log_--root_--patch-with-stat_--summary_master | 165 +++++++++++++++++ ...og_--root_-c_--patch-with-stat_--summary_master | 198 +++++++++++++++++++++ t/t4013/diff.log_-SF_-p_master | 18 ++ ...nged_--patch-with-stat_--summary_master_--_dir_ | 59 ++++++ ..._--root_--cc_--patch-with-stat_--summary_master | 198 +++++++++++++++++++++ ...ed_--root_-c_--patch-with-stat_--summary_master | 198 +++++++++++++++++++++ t/t4013/diff.whatchanged_-SF_-p_master | 18 ++ 18 files changed, 1263 insertions(+), 3 deletions(-) create mode 100644 t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side create mode 100644 t/t4013/diff.diff-tree_--cc_--stat_--summary_master create mode 100644 t/t4013/diff.diff-tree_--cc_--stat_--summary_side create mode 100644 t/t4013/diff.diff-tree_--cc_--stat_master create mode 100644 t/t4013/diff.diff-tree_-c_--stat_--summary_master create mode 100644 t/t4013/diff.diff-tree_-c_--stat_--summary_side create mode 100644 t/t4013/diff.diff-tree_-c_--stat_master create mode 100644 t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ create mode 100644 t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.log_--root_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.log_-SF_-p_master create mode 100644 t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ create mode 100644 t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master create mode 100644 t/t4013/diff.whatchanged_-SF_-p_master diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 802e0ba01d..22984e3db7 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -163,6 +163,22 @@ 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 +# this one gives an extra newline after stat, which should be removed +# diff-tree --cc --patch-with-stat master +# this one gives an extra newline after stat, which should be removed +# other than that it shows the correct example -- stat and summary are +# against the first parent, and patch-looking combined diff follows. +diff-tree --cc --patch-with-stat --summary master +# this is correct +diff-tree --cc --patch-with-stat --summary side log master log -p master @@ -170,8 +186,11 @@ 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 +log --root --patch-with-stat --summary master +log --root -c --patch-with-stat --summary master +log --root --cc --patch-with-stat --summary master log -SF master +log -SF -p master whatchanged master whatchanged -p master @@ -180,10 +199,15 @@ whatchanged --root -p master whatchanged --patch-with-stat master whatchanged --root --patch-with-stat master whatchanged --root --patch-with-stat --summary master +whatchanged --root -c --patch-with-stat --summary master +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 @@ -195,8 +219,6 @@ show --patch-with-stat side show --patch-with-raw side show --patch-with-stat --summary side - - EOF test_done diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..e6d0c80567 --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master @@ -0,0 +1,35 @@ +$ 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 +$ diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side new file mode 100644 index 0000000000..a61ad8cb13 --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master new file mode 100644 index 0000000000..712ffd2d89 --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master @@ -0,0 +1,6 @@ +$ git diff-tree --cc --stat --summary master +176b998f5d647cbd77a9d8acf4531e930754d16d + dir/sub | 2 ++ + file0 | 3 +++ + 2 files changed, 5 insertions(+), 0 deletions(-) +$ diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side new file mode 100644 index 0000000000..50362be7bf --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--cc_--stat_master b/t/t4013/diff.diff-tree_--cc_--stat_master new file mode 100644 index 0000000000..8d5bdc985a --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--stat_master @@ -0,0 +1,6 @@ +$ git diff-tree --cc --stat master +176b998f5d647cbd77a9d8acf4531e930754d16d + dir/sub | 2 ++ + file0 | 3 +++ + 2 files changed, 5 insertions(+), 0 deletions(-) +$ diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_master b/t/t4013/diff.diff-tree_-c_--stat_--summary_master new file mode 100644 index 0000000000..2d239feb5d --- /dev/null +++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_master @@ -0,0 +1,6 @@ +$ git diff-tree -c --stat --summary master +176b998f5d647cbd77a9d8acf4531e930754d16d + dir/sub | 2 ++ + file0 | 3 +++ + 2 files changed, 5 insertions(+), 0 deletions(-) +$ diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_side b/t/t4013/diff.diff-tree_-c_--stat_--summary_side new file mode 100644 index 0000000000..2afcca11f4 --- /dev/null +++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_side @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_-c_--stat_master b/t/t4013/diff.diff-tree_-c_--stat_master new file mode 100644 index 0000000000..226300b93c --- /dev/null +++ b/t/t4013/diff.diff-tree_-c_--stat_master @@ -0,0 +1,6 @@ +$ git diff-tree -c --stat master +176b998f5d647cbd77a9d8acf4531e930754d16d + dir/sub | 2 ++ + file0 | 3 +++ + 2 files changed, 5 insertions(+), 0 deletions(-) +$ diff --git a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ new file mode 100644 index 0000000000..cc5537697d --- /dev/null +++ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ @@ -0,0 +1,72 @@ +$ git log --patch-with-stat --summary master -- dir/ +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial +$ diff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..fafd9ee59e --- /dev/null +++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master @@ -0,0 +1,198 @@ +$ git log --root --cc --patch-with-stat --summary master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +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 +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..b24a504759 --- /dev/null +++ b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master @@ -0,0 +1,165 @@ +$ git log --root --patch-with-stat --summary master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +Date: Mon Jun 26 00:04:00 2006 +0000 + + Merge branch 'side' + +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..51e39cda00 --- /dev/null +++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master @@ -0,0 +1,198 @@ +$ git log --root -c --patch-with-stat --summary master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +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 +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.log_-SF_-p_master b/t/t4013/diff.log_-SF_-p_master new file mode 100644 index 0000000000..db2264c6e9 --- /dev/null +++ b/t/t4013/diff.log_-SF_-p_master @@ -0,0 +1,18 @@ +$ git log -SF -p master +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +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/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ new file mode 100644 index 0000000000..054513f312 --- /dev/null +++ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ @@ -0,0 +1,59 @@ +$ git whatchanged --patch-with-stat --summary master -- dir/ +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a +Author: A U Thor +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..370b5810ee --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master @@ -0,0 +1,198 @@ +$ git whatchanged --root --cc --patch-with-stat --summary master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +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 +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master new file mode 100644 index 0000000000..d6404b11be --- /dev/null +++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master @@ -0,0 +1,198 @@ +$ git whatchanged --root -c --patch-with-stat --summary master +commit 176b998f5d647cbd77a9d8acf4531e930754d16d +Merge: 889b315... c7a2ab9... +Author: A U Thor +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 +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 +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 +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 +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 +$ diff --git a/t/t4013/diff.whatchanged_-SF_-p_master b/t/t4013/diff.whatchanged_-SF_-p_master new file mode 100644 index 0000000000..6a76f4e604 --- /dev/null +++ b/t/t4013/diff.whatchanged_-SF_-p_master @@ -0,0 +1,18 @@ +$ git whatchanged -SF -p master +commit 889b315013ef9f2e2f90aa0b054b267c8a557847 +Author: A U Thor +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 +$ -- cgit v1.2.1 From 946c3784a3586e70c70c3a676f590654ca39a3cb Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Tue, 27 Jun 2006 15:09:17 +0300 Subject: Print empty line between raw, stat, summary and patch Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- diff.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 54698f511a..71fb0967fd 100644 --- a/diff.c +++ b/diff.c @@ -2093,15 +2093,43 @@ static void diff_summary(struct diff_filepair *p) } } +static int is_summary_empty(const struct diff_queue_struct *q) +{ + int i; + + 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; +} + 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 | @@ -2112,11 +2140,15 @@ void diff_flush(struct diff_options *options) if (check_pair_status(p)) flush_one_pair(p, options); } + separator++; } if (output_format & DIFF_FORMAT_DIFFSTAT) { struct diffstat_t diffstat; + if (separator++) + putchar('\n'); + memset(&diffstat, 0, sizeof(struct diffstat_t)); diffstat.xm.consume = diffstat_consume; for (i = 0; i < q->nr; i++) { @@ -2127,18 +2159,22 @@ void diff_flush(struct diff_options *options) show_stats(&diffstat); } - if (output_format & DIFF_FORMAT_SUMMARY) { + if (output_format & DIFF_FORMAT_SUMMARY && !is_summary_empty(q)) { + if (separator++) + putchar('\n'); + for (i = 0; i < q->nr; i++) diff_summary(q->queue[i]); } if (output_format & DIFF_FORMAT_PATCH) { - if (output_format & (DIFF_FORMAT_DIFFSTAT | - DIFF_FORMAT_SUMMARY)) { - if (options->stat_sep) + if (separator) { + if (options->stat_sep) { + /* attach patch instead of inline */ fputs(options->stat_sep, stdout); - else + } else { putchar(options->line_termination); + } } for (i = 0; i < q->nr; i++) { @@ -2150,6 +2186,7 @@ void diff_flush(struct diff_options *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; -- cgit v1.2.1 From f005df391057ce8487a6b2f9896f8e0507351be8 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Tue, 27 Jun 2006 15:39:29 +0300 Subject: diff-tree: Use ---\n as a message separator Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-diff-tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index ae1cde9d00..1e66fcac21 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -72,6 +72,7 @@ int cmd_diff_tree(int argc, const char **argv, char **envp) init_revisions(opt); opt->abbrev = 0; opt->diff = 1; + opt->diffopt.msg_sep = "---\n"; argc = setup_revisions(argc, argv, opt, NULL); while (--argc > 0) { -- cgit v1.2.1 From 17985627455901b6ae3a471b67d46239463cebb5 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Tue, 27 Jun 2006 16:27:51 +0300 Subject: log --raw: Don't descend into subdirectories by default Only do so when -r is given. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- builtin-log.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin-log.c b/builtin-log.c index 3b7574f6d6..debddb97a0 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -79,7 +79,6 @@ int cmd_log(int argc, const char **argv, char **envp) init_revisions(&rev); rev.always_show_header = 1; - rev.diffopt.recursive = 1; cmd_log_init(argc, argv, envp, &rev); return cmd_log_walk(&rev); } -- cgit v1.2.1 From 3223847a8fbd6200e38f4a8f1146ca9dc20a813e Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Tue, 27 Jun 2006 19:43:22 +0300 Subject: Fix diff-tree -s setup_revisions() calls diff_setup_done() before we can set default value for output_format. Don't convert DIFF_FORMAT_NO_OUTPUT to 0 in diff_setup_done(), it is useless and makes diff-tree believe no diff format parameters were given and thus lets it reset output_format to DIFF_FORMAT_RAW. Signed-off-by: Timo Hirvonen Signed-off-by: Junio C Hamano --- diff.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/diff.c b/diff.c index 71fb0967fd..6d04be49de 100644 --- a/diff.c +++ b/diff.c @@ -1438,9 +1438,6 @@ int diff_setup_done(struct diff_options *options) (0 <= options->rename_limit && !options->detect_rename)) return -1; - if (options->output_format & DIFF_FORMAT_NO_OUTPUT) - options->output_format = 0; - if (options->output_format & (DIFF_FORMAT_NAME | DIFF_FORMAT_NAME_STATUS | DIFF_FORMAT_CHECKDIFF | -- cgit v1.2.1 From 3969cf7db1a13a78f3b7a36d8c1084bbe0a53459 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 27 Jun 2006 15:08:19 -0700 Subject: Fix some more diff options changes. This fixes various problems in the new diff options code. - Fix --cc/-c --patch; it showed two-tree diff used internally. - Use "---\n" only where it matters -- that is, use it immediately after the commit log text when we show a commit log and something else before the patch text. - Do not output spurious extra "\n"; have an extra newline after the commit log text always when we have diff output and we are not doing oneline. - When running a pickaxe you need to go recursive. Signed-off-by: Junio C Hamano --- builtin-diff-tree.c | 1 - combine-diff.c | 24 +++++++++++++++--------- diff.c | 15 ++++++++------- log-tree.c | 17 +++++++++++++++-- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index 1e66fcac21..ae1cde9d00 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -72,7 +72,6 @@ int cmd_diff_tree(int argc, const char **argv, char **envp) init_revisions(opt); opt->abbrev = 0; opt->diff = 1; - opt->diffopt.msg_sep = "---\n"; argc = setup_revisions(argc, argv, opt, NULL); while (--argc > 0) { diff --git a/combine-diff.c b/combine-diff.c index 39fb10c145..7178b25c53 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -835,31 +835,33 @@ 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 i, num_paths, needsep, show_log_first; diffopts = *opt; - diffopts.output_format &= ~(DIFF_FORMAT_RAW | DIFF_FORMAT_DIFFSTAT); + 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 && opt->output_format & DIFF_FORMAT_DIFFSTAT) - diffopts.output_format |= DIFF_FORMAT_DIFFSTAT; + diffopts.output_format = DIFF_FORMAT_DIFFSTAT; else - diffopts.output_format |= DIFF_FORMAT_NO_OUTPUT; + diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; diff_tree_sha1(parent[i], sha1, "", &diffopts); diffcore_std(&diffopts); paths = intersect_paths(paths, i, num_parent); - if (opt->output_format & DIFF_FORMAT_DIFFSTAT && rev->loginfo) + 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->output_format & DIFF_FORMAT_DIFFSTAT) - putchar('\n'); } /* find out surviving paths */ @@ -875,9 +877,13 @@ void diff_tree_combined(const unsigned char *sha1, if (p->len) show_raw_diff(p, num_parent, rev); } - putchar(opt->line_termination); + needsep = 1; } + 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, diff --git a/diff.c b/diff.c index 6d04be49de..1c131ff4dc 100644 --- a/diff.c +++ b/diff.c @@ -1424,7 +1424,7 @@ void diff_setup(struct diff_options *options) options->break_opt = -1; options->rename_limit = -1; options->context = 3; - options->msg_sep = "\n"; + options->msg_sep = ""; options->change = diff_change; options->add_remove = diff_addremove; @@ -1455,6 +1455,11 @@ int diff_setup_done(struct diff_options *options) DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_CHECKDIFF)) options->recursive = 1; + /* + * Also pickaxe would not work very well if you do not say recursive + */ + if (options->pickaxe) + options->recursive = 1; if (options->detect_rename && options->rename_limit < 0) options->rename_limit = diff_rename_limit_default; @@ -2143,9 +2148,6 @@ void diff_flush(struct diff_options *options) if (output_format & DIFF_FORMAT_DIFFSTAT) { struct diffstat_t diffstat; - if (separator++) - putchar('\n'); - memset(&diffstat, 0, sizeof(struct diffstat_t)); diffstat.xm.consume = diffstat_consume; for (i = 0; i < q->nr; i++) { @@ -2154,14 +2156,13 @@ void diff_flush(struct diff_options *options) diff_flush_stat(p, options, &diffstat); } show_stats(&diffstat); + separator++; } if (output_format & DIFF_FORMAT_SUMMARY && !is_summary_empty(q)) { - if (separator++) - putchar('\n'); - for (i = 0; i < q->nr; i++) diff_summary(q->queue[i]); + separator++; } if (output_format & DIFF_FORMAT_PATCH) { diff --git a/log-tree.c b/log-tree.c index ab6b682223..9d8d46fa00 100644 --- a/log-tree.c +++ b/log-tree.c @@ -164,9 +164,22 @@ int log_tree_diff_flush(struct rev_info *opt) return 0; } - if (opt->loginfo && !opt->no_commit_id) + 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; } -- cgit v1.2.1 From 9e76bab14e50c46c624ae35f13c527a7a1b1185d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 27 Jun 2006 15:36:19 -0700 Subject: t4013 test updates for new output code. These are updates to the test vector that shows the "incompatibility" of the new output code. The changes are actually the good ones, so instead of keeping the older output we adjust the test to the new code. Signed-off-by: Junio C Hamano --- t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master | 1 - .../diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial | 1 - t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master | 3 +-- t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master | 3 +-- .../diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master | 3 +-- t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master | 3 +-- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master index e6d0c80567..0ac9800913 100644 --- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master +++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master @@ -4,7 +4,6 @@ $ git diff-tree --cc --patch-with-stat --summary master file0 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) - diff --cc dir/sub index cead32e,7289e35..992913c --- a/dir/sub diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial index 49e26fb99a..d5c333a378 100644 --- a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial +++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial @@ -1,6 +1,5 @@ $ git diff-tree --pretty=oneline --root --patch-with-stat initial 444ac553ac7612cc88969031b02b3767fb8a353a Initial ---- dir/sub | 2 ++ file0 | 3 +++ file2 | 3 +++ diff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master index fafd9ee59e..b652c6a823 100644 --- a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master +++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master @@ -5,12 +5,11 @@ Author: A U Thor 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 diff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master index 51e39cda00..3a155d288c 100644 --- a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master +++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master @@ -5,12 +5,11 @@ Author: A U Thor 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 diff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master index 370b5810ee..e9e17cdafb 100644 --- a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master +++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master @@ -5,12 +5,11 @@ Author: A U Thor 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 diff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master index d6404b11be..596765e804 100644 --- a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master +++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master @@ -5,12 +5,11 @@ Author: A U Thor 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 -- cgit v1.2.1 From 2c0b4dfd5a2099bdbbdfad71c3193a25c9052f2d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 28 Jun 2006 01:46:41 -0700 Subject: combine-diff.c: type sanity. In diff_tree_combined(), show_log_first boolean is initialized with rev->loginfo (pointer to a string); the intention is that if we have some string to be emitted we would want to remember that fact. Picky compilers are offended by this, so make the expression a bit type-safer. Signed-off-by: Junio C Hamano --- combine-diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/combine-diff.c b/combine-diff.c index 7178b25c53..2fd0ced395 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -841,7 +841,7 @@ void diff_tree_combined(const unsigned char *sha1, diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; diffopts.recursive = 1; - show_log_first = rev->loginfo; + show_log_first = !!rev->loginfo; needsep = 0; /* find set of paths that everybody touches */ for (i = 0; i < num_parent; i++) { -- cgit v1.2.1 From 27e1b127f32640bea68b84e0ff57d640fd31cc92 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 29 Jun 2006 00:18:52 -0700 Subject: format-patch: fix diff format option implementation The updates forgot to make the diff go recursive. --- builtin-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-log.c b/builtin-log.c index debddb97a0..bcd4e5e161 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -179,7 +179,8 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.diff = 1; rev.combine_merges = 0; rev.ignore_merges = 1; - rev.diffopt.msg_sep = "---\n"; + rev.diffopt.msg_sep = ""; + rev.diffopt.recursive = 1; git_config(git_format_config); rev.extra_headers = extra_headers; -- cgit v1.2.1 From d410e43b35a8044472606a7e7018aa64d96a5f0f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 29 Jun 2006 00:01:07 -0700 Subject: t4013: add format-patch tests. Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 10 +- ....format-patch_--attach_--stdout_initial..master | 165 +++++++++++++++++++++ ...format-patch_--attach_--stdout_initial..master^ | 106 +++++++++++++ ...ff.format-patch_--attach_--stdout_initial..side | 60 ++++++++ t/t4013/diff.format-patch_--stdout_initial..master | 120 +++++++++++++++ .../diff.format-patch_--stdout_initial..master^ | 76 ++++++++++ t/t4013/diff.format-patch_--stdout_initial..side | 45 ++++++ 7 files changed, 581 insertions(+), 1 deletion(-) create mode 100644 t/t4013/diff.format-patch_--attach_--stdout_initial..master create mode 100644 t/t4013/diff.format-patch_--attach_--stdout_initial..master^ create mode 100644 t/t4013/diff.format-patch_--attach_--stdout_initial..side create mode 100644 t/t4013/diff.format-patch_--stdout_initial..master create mode 100644 t/t4013/diff.format-patch_--stdout_initial..master^ create mode 100644 t/t4013/diff.format-patch_--stdout_initial..side diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 22984e3db7..f4f3c3a56d 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -85,6 +85,7 @@ test_expect_success setup ' +*+ [initial] Initial EOF +V=`git version | sed -e 's/^git version //'` while read cmd do case "$cmd" in @@ -99,7 +100,7 @@ do test_expect_success "git $cmd" ' { echo "\$ git $cmd" - git $cmd + git $cmd | sed -e "s/$V/g-i-t--v-e-r-s-i-o-n/" echo "\$" } >"$actual" && if test -f "$expect" @@ -219,6 +220,13 @@ 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 diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master new file mode 100644 index 0000000000..a89bbbbcfb --- /dev/null +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master @@ -0,0 +1,165 @@ +$ git format-patch --attach --stdout initial..master +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001 +From: A U Thor +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 +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 +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-- + + +$ diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ new file mode 100644 index 0000000000..4de9091a40 --- /dev/null +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ @@ -0,0 +1,106 @@ +$ git format-patch --attach --stdout initial..master^ +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001 +From: A U Thor +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 +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-- + + +$ diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side new file mode 100644 index 0000000000..3769fa6daf --- /dev/null +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side @@ -0,0 +1,60 @@ +$ git format-patch --attach --stdout initial..side +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001 +From: A U Thor +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-- + + +$ diff --git a/t/t4013/diff.format-patch_--stdout_initial..master b/t/t4013/diff.format-patch_--stdout_initial..master new file mode 100644 index 0000000000..b7b4e7ca91 --- /dev/null +++ b/t/t4013/diff.format-patch_--stdout_initial..master @@ -0,0 +1,120 @@ +$ git format-patch --stdout initial..master +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001 +From: A U Thor +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 +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 +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 + +$ diff --git a/t/t4013/diff.format-patch_--stdout_initial..master^ b/t/t4013/diff.format-patch_--stdout_initial..master^ new file mode 100644 index 0000000000..e56dd98df3 --- /dev/null +++ b/t/t4013/diff.format-patch_--stdout_initial..master^ @@ -0,0 +1,76 @@ +$ git format-patch --stdout initial..master^ +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001 +From: A U Thor +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 +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 + +$ diff --git a/t/t4013/diff.format-patch_--stdout_initial..side b/t/t4013/diff.format-patch_--stdout_initial..side new file mode 100644 index 0000000000..e7ddbf4814 --- /dev/null +++ b/t/t4013/diff.format-patch_--stdout_initial..side @@ -0,0 +1,45 @@ +$ git format-patch --stdout initial..side +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001 +From: A U Thor +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 + +$ -- cgit v1.2.1 From 026625e78eaf8ea2ae960525c367b5e8f1629fd4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 29 Jun 2006 12:00:12 -0700 Subject: t4013: note improvements brought by the new output code. Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 18 ++++++++---- .../diff.diff-tree_--cc_--patch-with-stat_master | 34 ++++++++++++++++++++++ ....diff-tree_--pretty_--root_--summary_-r_initial | 11 +++++++ ...iff.diff-tree_--pretty_--root_--summary_initial | 11 +++++++ 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 t/t4013/diff.diff-tree_--cc_--patch-with-stat_master create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--summary_initial diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index f4f3c3a56d..026832761f 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -138,7 +138,10 @@ diff-tree --pretty --summary initial diff-tree --pretty --stat --summary initial diff-tree --pretty --root -p initial diff-tree --pretty --root --stat initial -#diff-tree --pretty --root --summary 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 @@ -150,6 +153,7 @@ 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 @@ -172,11 +176,9 @@ 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 -# this one gives an extra newline after stat, which should be removed -# diff-tree --cc --patch-with-stat master -# this one gives an extra newline after stat, which should be removed -# other than that it shows the correct example -- stat and summary are -# against the first parent, and patch-looking combined diff follows. +# 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 @@ -188,7 +190,9 @@ 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 @@ -200,7 +204,9 @@ 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 diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master new file mode 100644 index 0000000000..f6ecf76366 --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master @@ -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 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial b/t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial new file mode 100644 index 0000000000..ccdaafb377 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--summary_-r_initial @@ -0,0 +1,11 @@ +$ git diff-tree --pretty --root --summary -r initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial + + create mode 100644 dir/sub + create mode 100644 file0 + create mode 100644 file2 +$ diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--summary_initial new file mode 100644 index 0000000000..ea48205537 --- /dev/null +++ b/t/t4013/diff.diff-tree_--pretty_--root_--summary_initial @@ -0,0 +1,11 @@ +$ git diff-tree --pretty --root --summary initial +commit 444ac553ac7612cc88969031b02b3767fb8a353a +Author: A U Thor +Date: Mon Jun 26 00:00:00 2006 +0000 + + Initial + + create mode 040000 dir + create mode 100644 file0 + create mode 100644 file2 +$ -- cgit v1.2.1 From 047fbe906b375e8a3a7564ad0e4443f62dd528a2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 1 Jul 2006 22:15:40 -0700 Subject: builtin-diff: turn recursive on when defaulting to --patch format. Signed-off-by: Junio C Hamano --- builtin-diff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin-diff.c b/builtin-diff.c index 47e0a37e21..d520c7ca29 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -254,8 +254,10 @@ int cmd_diff(int argc, const char **argv, char **envp) init_revisions(&rev); argc = setup_revisions(argc, argv, &rev, NULL); - if (!rev.diffopt.output_format) + 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. -- cgit v1.2.1