From 171ddd91771f042e49db49ff068694b5ed6f845d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Wed, 11 Apr 2007 16:58:08 -0700 Subject: Add testcase for format-patch --subject-prefix (take 3) Add testcase for format-patch --subject-prefix support. Signed-off-by: Robin H. Johnson Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 488e075c16..8f4c29a6b5 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -241,6 +241,7 @@ format-patch --attach --stdout initial..master format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master +format-patch --inline --stdout --subject-prefix=TESTCASE initial..master diff --abbrev initial..side diff -r initial..side -- cgit v1.2.3 From dbd21447361364d646f3972738a475a92f711513 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Sun, 1 Jul 2007 17:48:59 -0700 Subject: format-patch: Add format.subjectprefix config option This change lets you use the format.subjectprefix config option to override the default subject prefix. Signed-off-by: Adam Roben Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 8f4c29a6b5..b453b42af7 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -242,6 +242,8 @@ format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master +config format.subjectprefix DIFFERENT_PREFIX +format-patch --inline --stdout initial..master^^ diff --abbrev initial..side diff -r initial..side -- cgit v1.2.3 From 3cb567386d5d0349bfb5e3aaf85e973faf685dda Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 3 Jul 2007 16:01:06 +0100 Subject: diff --no-index: fix --name-status with added files Without this patch, an added file would be reported as /dev/null. Noticed by David Kastrup. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 8f4c29a6b5..4e7d68dda2 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -17,6 +17,7 @@ test_expect_success setup ' export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && mkdir dir && + mkdir dir2 && 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 && @@ -252,6 +253,7 @@ diff --patch-with-stat initial..side diff --patch-with-raw initial..side diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side +diff --name-status dir2 dir EOF test_done -- cgit v1.2.3 From a5a27c79b7e77e28462b6d089e827391b67d3e5f Mon Sep 17 00:00:00 2001 From: Daniel Barkalow Date: Mon, 18 Feb 2008 22:56:13 -0500 Subject: Add a --cover-letter option to format-patch If --cover-letter is provided, generate a cover letter message before the patches, numbered 0. Original patch thanks to Johannes Schindelin Signed-off-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 9eec754221..6b4d1c52bb 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -245,6 +245,7 @@ format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master config format.subjectprefix DIFFERENT_PREFIX format-patch --inline --stdout initial..master^^ +format-patch --stdout --cover-letter -n initial..master^ diff --abbrev initial..side diff -r initial..side -- cgit v1.2.3 From 3af828634fa5bdbca1b2061a81df8b3fa73b0d34 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 23 May 2008 22:28:56 -0700 Subject: tests: do not use implicit "git diff --no-index" As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 6b4d1c52bb..4c038ccec1 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -112,7 +112,7 @@ do } >"$actual" && if test -f "$expect" then - git diff "$expect" "$actual" && + test_cmp "$expect" "$actual" && rm -f "$actual" else # this is to help developing new tests. -- cgit v1.2.3 From 0569e9b8cea20d5eedfec66730a9711a0907ab0d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 23 May 2008 22:28:56 -0700 Subject: "git diff": do not ignore index without --no-index Even if "foo" and/or "bar" does not exist in index, "git diff foo bar" should not change behaviour drastically from "git diff foo bar baz" or "git diff foo". A feature that "sometimes works and is handy" is an unreliable cute hack. "git diff foo bar" outside a git repository continues to work as a more colourful alternative to "diff -u" as before. Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 4c038ccec1..9337b81064 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -257,6 +257,7 @@ diff --patch-with-raw initial..side diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side diff --name-status dir2 dir +diff --no-index --name-status dir2 dir EOF test_done -- cgit v1.2.3 From bfdbee98109c5ad2dbbc392e7eed1ae688acc039 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 8 Aug 2008 02:26:28 -0700 Subject: tests: use $TEST_DIRECTORY to refer to the t/ directory Many test scripts assumed that they will start in a 'trash' subdirectory that is a single level down from the t/ directory, and referred to their test vector files by asking for files like "../t9999/expect". This will break if we move the 'trash' subdirectory elsewhere. To solve this, we earlier introduced "$TEST_DIRECTORY" so that they can refer to t/ directory reliably. This finally makes all the tests use it to refer to the outside environment. With this patch, and a one-liner not included here (because it would contradict with what Dscho really wants to do): | diff --git a/t/test-lib.sh b/t/test-lib.sh | index 70ea7e0..60e69e4 100644 | --- a/t/test-lib.sh | +++ b/t/test-lib.sh | @@ -485,7 +485,7 @@ fi | . ../GIT-BUILD-OPTIONS | | # Test repository | -test="trash directory" | +test="trash directory/another level/yet another" | rm -fr "$test" || { | trap - exit | echo >&5 "FATAL: Cannot prepare test area" all the tests still pass, but we would want extra sets of eyeballs on this type of change to really make sure. [jc: with help from Stephan Beyer on http-push tests I do not run myself; credits for locating silly quoting errors go to Olivier Marin.] Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 9337b81064..1a6b52234d 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -99,7 +99,7 @@ do test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'` cnt=`expr $test_count + 1` pfx=`printf "%04d" $cnt` - expect="../t4013/diff.$test" + expect="$TEST_DIRECTORY/t4013/diff.$test" actual="$pfx-diff.$test" test_expect_success "git $cmd" ' -- cgit v1.2.3 From b75271d93a9e4be960d53fc4f955802530e0e733 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Fri, 10 Oct 2008 21:56:15 -0400 Subject: "git diff {3,}": do not reverse order of arguments According to the message of commit 0fe7c1de16f71312e6adac4b85bddf0d62a47168, "git diff" with three or more trees expects the merged tree first followed by the parents, in order. However, this command reversed the order of its arguments, resulting in confusing diffs. A comment /* Again, the revs are all reverse */ suggested there was a reason for this, but I can't figure out the reason, so I removed the reversal of the arguments. Test case included. Signed-off-by: Matt McCutchen Signed-off-by: Shawn O. Pearce --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 1a6b52234d..fe6080da57 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -258,6 +258,7 @@ diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side diff --name-status dir2 dir diff --no-index --name-status dir2 dir +diff master master^ side EOF test_done -- cgit v1.2.3 From a567fdcb016e8e882ec0a1e044c9caac8f70e693 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Thu, 2 Oct 2008 16:55:39 -0400 Subject: format-patch: autonumber by default format-patch is most commonly used for multiple patches at once when sending a patchset, in which case we want to number the patches; on the other hand, single patches are not usually expected to be numbered. In other words, the typical behavior expected from format-patch is the one obtained by enabling autonumber, so we set it to be the default. Users that want to disable numbering for a particular patchset can do so with the existing -N command-line switch. Users that want to change the default behavior can use the format.numbering config key. Signed-off-by: Brian Gernhardt Test-updates-by: Jeff King Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index fe6080da57..aeb5405cfe 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -236,12 +236,15 @@ show --patch-with-stat --summary side format-patch --stdout initial..side format-patch --stdout initial..master^ format-patch --stdout initial..master +format-patch --stdout --no-numbered initial..master +format-patch --stdout --numbered initial..master format-patch --attach --stdout initial..side format-patch --attach --stdout initial..master^ format-patch --attach --stdout initial..master format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master +format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master config format.subjectprefix DIFFERENT_PREFIX format-patch --inline --stdout initial..master^^ -- cgit v1.2.3 From e423ffd8a6f46a14ecbb637d909290bd3579cebd Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Tue, 6 Jan 2009 19:53:32 +0100 Subject: diff: accept -- when using --no-index Accept -- as an "end of options" marker even when using --no-index. Previously, the -- triggered a "normal" index/tree diff and subsequently failed because of the unrecognized (in that mode) --no-index. Note that the second loop can treat '--' as a normal option, because the preceding checks ensure it is the third-to-last argument. While at it, fix the parsing of "-q" option in --no-index mode as well. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index aeb5405cfe..aba53202f8 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -261,6 +261,7 @@ diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side diff --name-status dir2 dir diff --no-index --name-status dir2 dir +diff --no-index --name-status -- dir2 dir diff master master^ side EOF -- cgit v1.2.3 From d61027b21f403a74ba16191756d22717a2e95bd4 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Wed, 18 Feb 2009 01:48:06 -0500 Subject: Skip timestamp differences for diff --no-index We display empty diffs for files whose timestamps have changed. Usually, refreshing the index makes those empty diffs go away. However, when not using the index they are not very useful and there is no option to suppress them. This forces on the skip_stat_unmatch option for diff --no-index, suppressing any empty diffs. This option is also used for diffs against the index when "diff.autorefreshindex" is set, but that option does not apply to diff --no-index. Signed-off-by: Michael Spang Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index aba53202f8..9c709022ef 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -74,6 +74,10 @@ test_expect_success setup ' for i in 1 2; do echo $i; done >>dir/sub && git update-index file0 dir/sub && + mkdir dir3 && + cp dir/sub dir3/sub && + test-chmtime +1 dir3/sub && + git config log.showroot false && git commit --amend && git show-branch @@ -262,6 +266,7 @@ diff --patch-with-raw -r initial..side diff --name-status dir2 dir diff --no-index --name-status dir2 dir diff --no-index --name-status -- dir2 dir +diff --no-index dir dir3 diff master master^ side EOF -- cgit v1.2.3 From f37bfb7a4d965e821591c98e66fe7a4e396377b5 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 19 Feb 2009 12:13:37 +0100 Subject: Test diff --dirstat functionality This is only a very rudimentary test, but it was untested before. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index aba53202f8..f140b9cd49 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -263,6 +263,7 @@ diff --name-status dir2 dir diff --no-index --name-status dir2 dir diff --no-index --name-status -- dir2 dir diff master master^ side +diff --dirstat master~1 master~2 EOF test_done -- cgit v1.2.3 From 28fd76bd0413e386ce5176cfac0fad7317145b91 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 19 Feb 2009 12:13:40 +0100 Subject: Test log --decorate Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index f140b9cd49..e5715f35cf 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -203,6 +203,7 @@ log --root -c --patch-with-stat --summary master log --root --cc --patch-with-stat --summary master log -SF master log -SF -p master +log --decorate --all whatchanged master whatchanged -p master -- cgit v1.2.3 From fcbc6efc7c56973e0a308012d2ae1b42c6b11a33 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 19 Feb 2009 12:13:41 +0100 Subject: Test rev-list --parents/--children Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index e5715f35cf..0f359ca28e 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -205,6 +205,9 @@ log -SF master log -SF -p master log --decorate --all +rev-list --parents HEAD +rev-list --children HEAD + whatchanged master whatchanged -p master whatchanged --root master -- cgit v1.2.3 From 8586f98bd29bd4ad3d0e62a3be4a4d59ff8b27cd Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 5 Feb 2009 21:20:56 +0100 Subject: test-lib: Simplify test counting. Since the test case counter was incremented very late, there were a few users of the counter had to do their own incrementing. Now we increment it early and simplify these users. Signed-off-by: Johannes Sixt --- t/t4013-diff-various.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 9cd5a6e685..426e64e828 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -101,8 +101,7 @@ do '' | '#'*) continue ;; esac test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'` - cnt=`expr $test_count + 1` - pfx=`printf "%04d" $cnt` + pfx=`printf "%04d" $test_count` expect="$TEST_DIRECTORY/t4013/diff.$test" actual="$pfx-diff.$test" -- cgit v1.2.3 From 108dab2811701c20d6d6e8d9fe8af88e41d65d77 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sun, 22 Mar 2009 19:14:05 -0700 Subject: format-patch: --attach/inline uses filename instead of SHA1 Currently when format-patch is used with --attach or --inline the patch attachment has the SHA1 of the commit for its filename. This replaces the SHA1 with the filename used by format-patch when outputting to files. Fix tests relying on the SHA1 output and add a test showing how the --suffix option affects the attachment filename output. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 426e64e828..6592a4f29d 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -246,6 +246,7 @@ format-patch --stdout initial..master format-patch --stdout --no-numbered initial..master format-patch --stdout --numbered initial..master format-patch --attach --stdout initial..side +format-patch --attach --stdout --suffix=.diff initial..side format-patch --attach --stdout initial..master^ format-patch --attach --stdout initial..master format-patch --inline --stdout initial..side -- cgit v1.2.3 From 747e25050bfef8f3a7c882954b654cf6d97fc63e Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sun, 22 Mar 2009 19:14:06 -0700 Subject: format-patch: --numbered-files and --stdout aren't mutually exclusive For example: git format-patch --numbered-files --stdout --attach HEAD~~ will create two messages with files 1 and 2 attached respectively. There is no effect when using --numbered-files and --stdout together without an --attach or --inline, the --numbered-files option will be ignored. Add a test to show this. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t4013-diff-various.sh') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 6592a4f29d..8b33321f8c 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -251,7 +251,7 @@ format-patch --attach --stdout initial..master^ format-patch --attach --stdout initial..master format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ -format-patch --inline --stdout initial..master +format-patch --inline --stdout --numbered-files initial..master format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master config format.subjectprefix DIFFERENT_PREFIX -- cgit v1.2.3