{"thread":{"id":"32208","subject":"[PATCH 0/4] t4041 (diff-submodule-option): minor cleanup","startedAt":"2012-11-27T08:41:28Z","lastAt":"2012-11-27T17:56:54Z","messageCount":8,"participants":["Ramkumar Ramachandra","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"203974","messageId":"1354005692-2809-1-git-send-email-artagnon@gmail.com","threadId":"32208","inReplyTo":null,"subject":"[PATCH 0/4] t4041 (diff-submodule-option): minor cleanup","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-11-27T08:41:28Z","receivedAt":"2012-11-27T08:41:28Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nThis is the result of one lazy afternoon.\n\nRam\n\nRamkumar Ramachandra (4):\n  t4041 (diff-submodule-option): parse digests sensibly\n  t4041 (diff-submodule-option): rewrite add_file() routine\n  t4041 (diff-submodule-option): modernize style\n  t4041 (diff-submodule-option): change tense of test names\n\n t/t4041-diff-submodule-option.sh |  484 +++++++++++++++++++-------------------\n 1 files changed, 240 insertions(+), 244 deletions(-)\n\n-- \n1.7.8.1.362.g5d6df.dirty\n"},{"id":"203975","messageId":"1354005692-2809-2-git-send-email-artagnon@gmail.com","threadId":"32208","inReplyTo":"1354005692-2809-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/4] t4041 (diff-submodule-option): parse digests sensibly","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-11-27T08:41:29Z","receivedAt":"2012-11-27T08:41:29Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"`git rev-list --max-count=1 HEAD` is a roundabout way of saying `git\nrev-parse --verify HEAD`; replace a bunch of instances of the former\nwith the latter.  Also, don't unnecessarily `cut -c1-7` the rev-parse\noutput when the `--short` option is available.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 5377639..cfb71e5 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -21,7 +21,7 @@ add_file () {\n \t\ttest_tick &&\n \t\tgit commit -m \"Add $name\"\n \tdone >/dev/null\n-\tgit rev-parse --verify HEAD | cut -c1-7\n+\tgit rev-parse --short --verify HEAD\n \tcd \"$owd\"\n }\n commit_file () {\n@@ -33,7 +33,7 @@ test_create_repo sm1 &&\n add_file . foo >/dev/null\n \n head1=$(add_file sm1 foo1 foo2)\n-fullhead1=$(cd sm1; git rev-list --max-count=1 $head1)\n+fullhead1=$(cd sm1; git rev-parse --verify $head1)\n \n test_expect_success 'added submodule' \"\n \tgit add sm1 &&\n@@ -116,8 +116,8 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-fullhead2=$(cd sm1; git rev-list --max-count=1 $head2)\n test_expect_success 'modified submodule(forward) --submodule=short' \"\n+fullhead2=$(cd sm1; git rev-parse --verify $head2)\n \tgit diff --submodule=short >actual &&\n \tcat >expected <<-EOF &&\n diff --git a/sm1 b/sm1\n@@ -135,7 +135,7 @@ commit_file sm1 &&\n head3=$(\n \tcd sm1 &&\n \tgit reset --hard HEAD~2 >/dev/null &&\n-\tgit rev-parse --verify HEAD | cut -c1-7\n+\tgit rev-parse --short --verify HEAD\n )\n \n test_expect_success 'modified submodule(backward)' \"\n@@ -220,8 +220,8 @@ EOF\n rm -f sm1 &&\n test_create_repo sm1 &&\n head6=$(add_file sm1 foo6 foo7)\n-fullhead6=$(cd sm1; git rev-list --max-count=1 $head6)\n test_expect_success 'nonexistent commit' \"\n+fullhead6=$(cd sm1; git rev-parse --verify $head6)\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n Submodule sm1 $head4...$head6 (commits not present)\n@@ -318,8 +318,8 @@ EOF\n \"\n \n (cd sm1; git commit -mchange foo6 >/dev/null) &&\n-head8=$(cd sm1; git rev-parse --verify HEAD | cut -c1-7) &&\n test_expect_success 'submodule is modified' \"\n+head8=$(cd sm1; git rev-parse --short --verify HEAD) &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n Submodule sm1 $head6..$head8:\n@@ -461,7 +461,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-fullhead7=$(cd sm2; git rev-list --max-count=1 $head7)\n+fullhead7=$(cd sm2; git rev-parse --verify $head7)\n \n test_expect_success 'given commit --submodule=short' \"\n \tgit diff-index -p --submodule=short HEAD^ >actual &&\n-- \n1.7.8.1.362.g5d6df.dirty\n"},{"id":"203976","messageId":"1354005692-2809-3-git-send-email-artagnon@gmail.com","threadId":"32208","inReplyTo":"1354005692-2809-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/4] t4041 (diff-submodule-option): rewrite add_file() routine","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-11-27T08:41:30Z","receivedAt":"2012-11-27T08:41:30Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Instead of \"cd there and then come back\", use the \"cd there in a\nsubshell\" pattern.  Also fix '&&' chaining in one place.\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |   13 +++++--------\n 1 files changed, 5 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex cfb71e5..103c690 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -11,18 +11,15 @@ This test tries to verify the sanity of the --submodule option of git diff.\n . ./test-lib.sh\n \n add_file () {\n-\tsm=$1\n-\tshift\n-\towd=$(pwd)\n-\tcd \"$sm\"\n-\tfor name; do\n+\t(cd \"$1\" &&\n+\t    shift &&\n+\t    for name; do\n \t\techo \"$name\" > \"$name\" &&\n \t\tgit add \"$name\" &&\n \t\ttest_tick &&\n \t\tgit commit -m \"Add $name\"\n-\tdone >/dev/null\n-\tgit rev-parse --short --verify HEAD\n-\tcd \"$owd\"\n+\t    done >/dev/null &&\n+\t    git rev-parse --short --verify HEAD)\n }\n commit_file () {\n \ttest_tick &&\n-- \n1.7.8.1.362.g5d6df.dirty\n"},{"id":"203978","messageId":"1354005692-2809-4-git-send-email-artagnon@gmail.com","threadId":"32208","inReplyTo":"1354005692-2809-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/4] t4041 (diff-submodule-option): modernize style","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-11-27T08:41:31Z","receivedAt":"2012-11-27T08:41:31Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"- Enclose tests in single quotes as opposed to double quotes.  This is\n  the prevalent style in other tests.\n- Remove the unused variable $head4_full.\n- Indent the expected output so that it lines up with the rest of the\n  test text.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  459 +++++++++++++++++++-------------------\n 1 files changed, 229 insertions(+), 230 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 103c690..f61c664 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -32,41 +32,41 @@ add_file . foo >/dev/null\n head1=$(add_file sm1 foo1 foo2)\n fullhead1=$(cd sm1; git rev-parse --verify $head1)\n \n-test_expect_success 'added submodule' \"\n+test_expect_success 'added submodule' '\n \tgit add sm1 &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 0000000...$head1 (new submodule)\n-EOF\n+\tSubmodule sm1 0000000...$head1 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'added submodule, set diff.submodule' \"\n+test_expect_success 'added submodule, set diff.submodule' '\n \tgit config diff.submodule log &&\n \tgit add sm1 &&\n \tgit diff --cached >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 0000000...$head1 (new submodule)\n-EOF\n+\tSubmodule sm1 0000000...$head1 (new submodule)\n+\tEOF\n \tgit config --unset diff.submodule &&\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success '--submodule=short overrides diff.submodule' \"\n+test_expect_success '--submodule=short overrides diff.submodule' '\n \ttest_config diff.submodule log &&\n \tgit add sm1 &&\n \tgit diff --submodule=short --cached >actual &&\n \tcat >expected <<-EOF &&\n-diff --git a/sm1 b/sm1\n-new file mode 160000\n-index 0000000..$head1\n---- /dev/null\n-+++ b/sm1\n-@@ -0,0 +1 @@\n-+Subproject commit $fullhead1\n-EOF\n+\tdiff --git a/sm1 b/sm1\n+\tnew file mode 160000\n+\tindex 0000000..$head1\n+\t--- /dev/null\n+\t+++ b/sm1\n+\t@@ -0,0 +1 @@\n+\t+Subproject commit $fullhead1\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n test_expect_success 'diff.submodule does not affect plumbing' '\n \ttest_config diff.submodule log &&\n@@ -86,47 +86,47 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' \"\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tSubmodule sm1 $head1..$head2:\n+\t  > Add foo3\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule(forward)' \"\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tSubmodule sm1 $head1..$head2:\n+\t  > Add foo3\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule(forward) --submodule' \"\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tSubmodule sm1 $head1..$head2:\n+\t  > Add foo3\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule(forward) --submodule=short' \"\n fullhead2=$(cd sm1; git rev-parse --verify $head2)\n+test_expect_success 'modified submodule(forward) --submodule=short' '\n \tgit diff --submodule=short >actual &&\n \tcat >expected <<-EOF &&\n-diff --git a/sm1 b/sm1\n-index $head1..$head2 160000\n---- a/sm1\n-+++ b/sm1\n-@@ -1 +1 @@\n--Subproject commit $fullhead1\n-+Subproject commit $fullhead2\n-EOF\n+\tdiff --git a/sm1 b/sm1\n+\tindex $head1..$head2 160000\n+\t--- a/sm1\n+\t+++ b/sm1\n+\t@@ -1 +1 @@\n+\t-Subproject commit $fullhead1\n+\t+Subproject commit $fullhead2\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n commit_file sm1 &&\n head3=$(\n@@ -135,29 +135,28 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' \"\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head2..$head3 (rewind):\n-  < Add foo3\n-  < Add foo2\n-EOF\n+\tSubmodule sm1 $head2..$head3 (rewind):\n+\t  < Add foo3\n+\t  < Add foo2\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-head4=$(add_file sm1 foo4 foo5) &&\n-head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)\n-test_expect_success 'modified submodule(backward and forward)' \"\n+head4=$(add_file sm1 foo4 foo5)\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head2...$head4:\n-  > Add foo5\n-  > Add foo4\n-  < Add foo3\n-  < Add foo2\n-EOF\n+\tSubmodule sm1 $head2...$head4:\n+\t  > Add foo5\n+\t  > Add foo4\n+\t  < Add foo3\n+\t  < Add foo2\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n commit_file sm1 &&\n mv sm1 sm1-bak &&\n@@ -167,319 +166,319 @@ git add sm1 &&\n rm -f sm1 &&\n mv sm1-bak sm1\n \n-test_expect_success 'typechanged submodule(submodule->blob), --cached' \"\n+test_expect_success 'typechanged submodule(submodule->blob), --cached' '\n \tgit diff --submodule=log --cached >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head4...0000000 (submodule deleted)\n-diff --git a/sm1 b/sm1\n-new file mode 100644\n-index 0000000..$head5\n---- /dev/null\n-+++ b/sm1\n-@@ -0,0 +1 @@\n-+sm1\n-EOF\n+\tSubmodule sm1 $head4...0000000 (submodule deleted)\n+\tdiff --git a/sm1 b/sm1\n+\tnew file mode 100644\n+\tindex 0000000..$head5\n+\t--- /dev/null\n+\t+++ b/sm1\n+\t@@ -0,0 +1 @@\n+\t+sm1\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'typechanged submodule(submodule->blob)' \"\n+test_expect_success 'typechanged submodule(submodule->blob)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n-diff --git a/sm1 b/sm1\n-deleted file mode 100644\n-index $head5..0000000\n---- a/sm1\n-+++ /dev/null\n-@@ -1 +0,0 @@\n--sm1\n-Submodule sm1 0000000...$head4 (new submodule)\n-EOF\n+\tdiff --git a/sm1 b/sm1\n+\tdeleted file mode 100644\n+\tindex $head5..0000000\n+\t--- a/sm1\n+\t+++ /dev/null\n+\t@@ -1 +0,0 @@\n+\t-sm1\n+\tSubmodule sm1 0000000...$head4 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n rm -rf sm1 &&\n git checkout-index sm1\n-test_expect_success 'typechanged submodule(submodule->blob)' \"\n+test_expect_success 'typechanged submodule(submodule->blob)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head4...0000000 (submodule deleted)\n-diff --git a/sm1 b/sm1\n-new file mode 100644\n-index 0000000..$head5\n---- /dev/null\n-+++ b/sm1\n-@@ -0,0 +1 @@\n-+sm1\n-EOF\n+\tSubmodule sm1 $head4...0000000 (submodule deleted)\n+\tdiff --git a/sm1 b/sm1\n+\tnew file mode 100644\n+\tindex 0000000..$head5\n+\t--- /dev/null\n+\t+++ b/sm1\n+\t@@ -0,0 +1 @@\n+\t+sm1\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n rm -f sm1 &&\n test_create_repo sm1 &&\n head6=$(add_file sm1 foo6 foo7)\n-test_expect_success 'nonexistent commit' \"\n fullhead6=$(cd sm1; git rev-parse --verify $head6)\n+test_expect_success 'nonexistent commit' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head4...$head6 (commits not present)\n-EOF\n+\tSubmodule sm1 $head4...$head6 (commits not present)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n commit_file\n-test_expect_success 'typechanged submodule(blob->submodule)' \"\n+test_expect_success 'typechanged submodule(blob->submodule)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-diff --git a/sm1 b/sm1\n-deleted file mode 100644\n-index $head5..0000000\n---- a/sm1\n-+++ /dev/null\n-@@ -1 +0,0 @@\n--sm1\n-Submodule sm1 0000000...$head6 (new submodule)\n-EOF\n+\tdiff --git a/sm1 b/sm1\n+\tdeleted file mode 100644\n+\tindex $head5..0000000\n+\t--- a/sm1\n+\t+++ /dev/null\n+\t@@ -1 +0,0 @@\n+\t-sm1\n+\tSubmodule sm1 0000000...$head6 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n commit_file sm1 &&\n-test_expect_success 'submodule is up to date' \"\n+test_expect_success 'submodule is up to date' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-EOF\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked content' \"\n+test_expect_success 'submodule contains untracked content' '\n \techo new > sm1/new-file &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains untracked content\n-EOF\n+\tSubmodule sm1 contains untracked content\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked content (untracked ignored)' \"\n+test_expect_success 'submodule contains untracked content (untracked ignored)' '\n \tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked content (dirty ignored)' \"\n+test_expect_success 'submodule contains untracked content (dirty ignored)' '\n \tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked content (all ignored)' \"\n+test_expect_success 'submodule contains untracked content (all ignored)' '\n \tgit diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked and modifed content' \"\n+test_expect_success 'submodule contains untracked and modifed content' '\n \techo new > sm1/foo6 &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains untracked content\n-Submodule sm1 contains modified content\n-EOF\n+\tSubmodule sm1 contains untracked content\n+\tSubmodule sm1 contains modified content\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' \"\n+test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' '\n \techo new > sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains modified content\n-EOF\n+\tSubmodule sm1 contains modified content\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' \"\n+test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '\n \techo new > sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'submodule contains untracked and modifed content (all ignored)' \"\n+test_expect_success 'submodule contains untracked and modifed content (all ignored)' '\n \techo new > sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'submodule contains modifed content' \"\n+test_expect_success 'submodule contains modifed content' '\n \trm -f sm1/new-file &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains modified content\n-EOF\n+\tSubmodule sm1 contains modified content\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n (cd sm1; git commit -mchange foo6 >/dev/null) &&\n-test_expect_success 'submodule is modified' \"\n head8=$(cd sm1; git rev-parse --short --verify HEAD) &&\n+test_expect_success 'submodule is modified' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked content' \"\n+test_expect_success 'modified submodule contains untracked content' '\n \techo new > sm1/new-file &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains untracked content\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 contains untracked content\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked content (untracked ignored)' \"\n+test_expect_success 'modified submodule contains untracked content (untracked ignored)' '\n \tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked content (dirty ignored)' \"\n+test_expect_success 'modified submodule contains untracked content (dirty ignored)' '\n \tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked content (all ignored)' \"\n+test_expect_success 'modified submodule contains untracked content (all ignored)' '\n \tgit diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked and modifed content' \"\n+test_expect_success 'modified submodule contains untracked and modifed content' '\n \techo modification >> sm1/foo6 &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains untracked content\n-Submodule sm1 contains modified content\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 contains untracked content\n+\tSubmodule sm1 contains modified content\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' \"\n+test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' '\n \techo modification >> sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains modified content\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 contains modified content\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' \"\n+test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' '\n \techo modification >> sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' \"\n+test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '\n \techo modification >> sm1/foo6 &&\n \tgit diff-index -p --ignore-submodules --submodule=log HEAD >actual &&\n \t! test -s actual\n-\"\n+'\n \n-test_expect_success 'modified submodule contains modifed content' \"\n+test_expect_success 'modified submodule contains modifed content' '\n \trm -f sm1/new-file &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 contains modified content\n-Submodule sm1 $head6..$head8:\n-  > change\n-EOF\n+\tSubmodule sm1 contains modified content\n+\tSubmodule sm1 $head6..$head8:\n+\t  > change\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n rm -rf sm1\n-test_expect_success 'deleted submodule' \"\n+test_expect_success 'deleted submodule' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6...0000000 (submodule deleted)\n-EOF\n+\tSubmodule sm1 $head6...0000000 (submodule deleted)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n test_create_repo sm2 &&\n head7=$(add_file sm2 foo8 foo9) &&\n git add sm2\n \n-test_expect_success 'multiple submodules' \"\n+test_expect_success 'multiple submodules' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6...0000000 (submodule deleted)\n-Submodule sm2 0000000...$head7 (new submodule)\n-EOF\n+\tSubmodule sm1 $head6...0000000 (submodule deleted)\n+\tSubmodule sm2 0000000...$head7 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'path filter' \"\n+test_expect_success 'path filter' '\n \tgit diff-index -p --submodule=log HEAD sm2 >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm2 0000000...$head7 (new submodule)\n-EOF\n+\tSubmodule sm2 0000000...$head7 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n commit_file sm2\n-test_expect_success 'given commit' \"\n+test_expect_success 'given commit' '\n \tgit diff-index -p --submodule=log HEAD^ >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6...0000000 (submodule deleted)\n-Submodule sm2 0000000...$head7 (new submodule)\n-EOF\n+\tSubmodule sm1 $head6...0000000 (submodule deleted)\n+\tSubmodule sm2 0000000...$head7 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'given commit --submodule' \"\n+test_expect_success 'given commit --submodule' '\n \tgit diff-index -p --submodule HEAD^ >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6...0000000 (submodule deleted)\n-Submodule sm2 0000000...$head7 (new submodule)\n-EOF\n+\tSubmodule sm1 $head6...0000000 (submodule deleted)\n+\tSubmodule sm2 0000000...$head7 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n-\"\n+'\n \n fullhead7=$(cd sm2; git rev-parse --verify $head7)\n \n-test_expect_success 'given commit --submodule=short' \"\n+test_expect_success 'given commit --submodule=short' '\n \tgit diff-index -p --submodule=short HEAD^ >actual &&\n \tcat >expected <<-EOF &&\n-diff --git a/sm1 b/sm1\n-deleted file mode 160000\n-index $head6..0000000\n---- a/sm1\n-+++ /dev/null\n-@@ -1 +0,0 @@\n--Subproject commit $fullhead6\n-diff --git a/sm2 b/sm2\n-new file mode 160000\n-index 0000000..$head7\n---- /dev/null\n-+++ b/sm2\n-@@ -0,0 +1 @@\n-+Subproject commit $fullhead7\n-EOF\n-\ttest_cmp expected actual\n-\"\n+\tdiff --git a/sm1 b/sm1\n+\tdeleted file mode 160000\n+\tindex $head6..0000000\n+\t--- a/sm1\n+\t+++ /dev/null\n+\t@@ -1 +0,0 @@\n+\t-Subproject commit $fullhead6\n+\tdiff --git a/sm2 b/sm2\n+\tnew file mode 160000\n+\tindex 0000000..$head7\n+\t--- /dev/null\n+\t+++ b/sm2\n+\t@@ -0,0 +1 @@\n+\t+Subproject commit $fullhead7\n+\tEOF\n+\ttest_cmp expected actual\n+'\n \n test_expect_success 'setup .git file for sm2' '\n \t(cd sm2 &&\n@@ -491,9 +490,9 @@ test_expect_success 'setup .git file for sm2' '\n test_expect_success 'diff --submodule with .git file' '\n \tgit diff --submodule HEAD^ >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head6...0000000 (submodule deleted)\n-Submodule sm2 0000000...$head7 (new submodule)\n-EOF\n+\tSubmodule sm1 $head6...0000000 (submodule deleted)\n+\tSubmodule sm2 0000000...$head7 (new submodule)\n+\tEOF\n \ttest_cmp expected actual\n '\n \n-- \n1.7.8.1.362.g5d6df.dirty\n"},{"id":"203977","messageId":"1354005692-2809-5-git-send-email-artagnon@gmail.com","threadId":"32208","inReplyTo":"1354005692-2809-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 4/4] t4041 (diff-submodule-option): change tense of test names","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-11-27T08:41:32Z","receivedAt":"2012-11-27T08:41:32Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Change the tense of test names from past to present, as this is the\nprevalent style.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |   24 ++++++++++++------------\n 1 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex f61c664..25cefba 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -32,7 +32,7 @@ add_file . foo >/dev/null\n head1=$(add_file sm1 foo1 foo2)\n fullhead1=$(cd sm1; git rev-parse --verify $head1)\n \n-test_expect_success 'added submodule' '\n+test_expect_success 'add submodule' '\n \tgit add sm1 &&\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n@@ -41,7 +41,7 @@ test_expect_success 'added submodule' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'added submodule, set diff.submodule' '\n+test_expect_success 'add submodule, set diff.submodule' '\n \tgit config diff.submodule log &&\n \tgit add sm1 &&\n \tgit diff --cached >actual &&\n@@ -86,7 +86,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_success 'modify submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -95,7 +95,7 @@ test_expect_success 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_success 'modify submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -104,7 +104,7 @@ test_expect_success 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_success 'modify submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -114,7 +114,7 @@ test_expect_success 'modified submodule(forward) --submodule' '\n '\n \n fullhead2=$(cd sm1; git rev-parse --verify $head2)\n-test_expect_success 'modified submodule(forward) --submodule=short' '\n+test_expect_success 'modify submodule(forward) --submodule=short' '\n \tgit diff --submodule=short >actual &&\n \tcat >expected <<-EOF &&\n \tdiff --git a/sm1 b/sm1\n@@ -135,7 +135,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_success 'modify submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -146,7 +146,7 @@ test_expect_success 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_success 'modify submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n@@ -166,7 +166,7 @@ git add sm1 &&\n rm -f sm1 &&\n mv sm1-bak sm1\n \n-test_expect_success 'typechanged submodule(submodule->blob), --cached' '\n+test_expect_success 'typechange submodule(submodule->blob), --cached' '\n \tgit diff --submodule=log --cached >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head4...0000000 (submodule deleted)\n@@ -181,7 +181,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --cached' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'typechanged submodule(submodule->blob)' '\n+test_expect_success 'typechange submodule(submodule->blob)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tdiff --git a/sm1 b/sm1\n@@ -198,7 +198,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' '\n \n rm -rf sm1 &&\n git checkout-index sm1\n-test_expect_success 'typechanged submodule(submodule->blob)' '\n+test_expect_success 'typechange submodule(submodule->blob)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head4...0000000 (submodule deleted)\n@@ -226,7 +226,7 @@ test_expect_success 'nonexistent commit' '\n '\n \n commit_file\n-test_expect_success 'typechanged submodule(blob->submodule)' '\n+test_expect_success 'typechange submodule(blob->submodule)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tdiff --git a/sm1 b/sm1\n-- \n1.7.8.1.362.g5d6df.dirty\n"},{"id":"204000","messageId":"7vtxsblzdv.fsf@alter.siamese.dyndns.org","threadId":"32208","inReplyTo":"1354005692-2809-2-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 1/4] t4041 (diff-submodule-option): parse digests sensibly","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-27T17:38:36Z","receivedAt":"2012-11-27T17:38:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> `git rev-list --max-count=1 HEAD` is a roundabout way of saying `git\n> rev-parse --verify HEAD`; replace a bunch of instances of the former\n> with the latter.  Also, don't unnecessarily `cut -c1-7` the rev-parse\n> output when the `--short` option is available.\n>\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  t/t4041-diff-submodule-option.sh |   14 +++++++-------\n>  1 files changed, 7 insertions(+), 7 deletions(-)\n>\n> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\n> index 5377639..cfb71e5 100755\n> --- a/t/t4041-diff-submodule-option.sh\n> +++ b/t/t4041-diff-submodule-option.sh\n> @@ -21,7 +21,7 @@ add_file () {\n>  \t\ttest_tick &&\n>  \t\tgit commit -m \"Add $name\"\n>  \tdone >/dev/null\n> -\tgit rev-parse --verify HEAD | cut -c1-7\n> +\tgit rev-parse --short --verify HEAD\n>  \tcd \"$owd\"\n>  }\n>  commit_file () {\n> @@ -33,7 +33,7 @@ test_create_repo sm1 &&\n>  add_file . foo >/dev/null\n>  \n>  head1=$(add_file sm1 foo1 foo2)\n> -fullhead1=$(cd sm1; git rev-list --max-count=1 $head1)\n> +fullhead1=$(cd sm1; git rev-parse --verify $head1)\n\nThat still is a roundabout way to say \"git rev-parse --verify HEAD\",\nno?  Why feed a shortened one to get the expanded result when you\nknow the full representation of HEAD is what you want?\n\n>  test_expect_success 'added submodule' \"\n>  \tgit add sm1 &&\n> @@ -116,8 +116,8 @@ EOF\n>  \ttest_cmp expected actual\n>  \"\n>  \n> -fullhead2=$(cd sm1; git rev-list --max-count=1 $head2)\n>  test_expect_success 'modified submodule(forward) --submodule=short' \"\n> +fullhead2=$(cd sm1; git rev-parse --verify $head2)\n>  \tgit diff --submodule=short >actual &&\n>  \tcat >expected <<-EOF &&\n>  diff --git a/sm1 b/sm1\n> @@ -135,7 +135,7 @@ commit_file sm1 &&\n>  head3=$(\n>  \tcd sm1 &&\n>  \tgit reset --hard HEAD~2 >/dev/null &&\n> -\tgit rev-parse --verify HEAD | cut -c1-7\n> +\tgit rev-parse --short --verify HEAD\n>  )\n>  \n>  test_expect_success 'modified submodule(backward)' \"\n> @@ -220,8 +220,8 @@ EOF\n>  rm -f sm1 &&\n>  test_create_repo sm1 &&\n>  head6=$(add_file sm1 foo6 foo7)\n> -fullhead6=$(cd sm1; git rev-list --max-count=1 $head6)\n>  test_expect_success 'nonexistent commit' \"\n> +fullhead6=$(cd sm1; git rev-parse --verify $head6)\n>  \tgit diff-index -p --submodule=log HEAD >actual &&\n>  \tcat >expected <<-EOF &&\n>  Submodule sm1 $head4...$head6 (commits not present)\n> @@ -318,8 +318,8 @@ EOF\n>  \"\n>  \n>  (cd sm1; git commit -mchange foo6 >/dev/null) &&\n> -head8=$(cd sm1; git rev-parse --verify HEAD | cut -c1-7) &&\n>  test_expect_success 'submodule is modified' \"\n> +head8=$(cd sm1; git rev-parse --short --verify HEAD) &&\n>  \tgit diff-index -p --submodule=log HEAD >actual &&\n>  \tcat >expected <<-EOF &&\n>  Submodule sm1 $head6..$head8:\n> @@ -461,7 +461,7 @@ EOF\n>  \ttest_cmp expected actual\n>  \"\n>  \n> -fullhead7=$(cd sm2; git rev-list --max-count=1 $head7)\n> +fullhead7=$(cd sm2; git rev-parse --verify $head7)\n>  \n>  test_expect_success 'given commit --submodule=short' \"\n>  \tgit diff-index -p --submodule=short HEAD^ >actual &&\n"},{"id":"204009","messageId":"7vpq2zlyrm.fsf@alter.siamese.dyndns.org","threadId":"32208","inReplyTo":"1354005692-2809-5-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 4/4] t4041 (diff-submodule-option): change tense of test names","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-27T17:51:57Z","receivedAt":"2012-11-27T17:51:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Change the tense of test names from past to present, as this is the\n> prevalent style.\n>\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n\nI see most of them are not \"past\" but \"past particle\" used as if\nthey are adjectives.\n\nFor example, I think this test\n\n> -test_expect_success 'added submodule' '\n\ntries to say \"See what happens to an added submodule\".\n\nThe same for the others.\n\n> -test_expect_success 'modified submodule(forward)' '\n\n\"See what is shown for modified submodule.\"\n\n> -test_expect_success 'typechanged submodule(submodule->blob), --cached' '\n\n\"See what is shown for typechanged one, when --cached option is\ngiven\".\n\nSo I do not think this patch is needed; the current wording looks\nnot so grammatically kosher, but still is understandable.  Updated\nresult isn't.\n"},{"id":"204011","messageId":"7vlidnlyjd.fsf@alter.siamese.dyndns.org","threadId":"32208","inReplyTo":"1354005692-2809-3-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 2/4] t4041 (diff-submodule-option): rewrite add_file() routine","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-27T17:56:54Z","receivedAt":"2012-11-27T17:56:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Instead of \"cd there and then come back\", use the \"cd there in a\n> subshell\" pattern.  Also fix '&&' chaining in one place.\n>\n> Suggested-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  t/t4041-diff-submodule-option.sh |   13 +++++--------\n>  1 files changed, 5 insertions(+), 8 deletions(-)\n>\n> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\n> index cfb71e5..103c690 100755\n> --- a/t/t4041-diff-submodule-option.sh\n> +++ b/t/t4041-diff-submodule-option.sh\n> @@ -11,18 +11,15 @@ This test tries to verify the sanity of the --submodule option of git diff.\n>  . ./test-lib.sh\n>  \n>  add_file () {\n> +\t(cd \"$1\" &&\n> +\t    shift &&\n> +\t    for name; do\n>  \t\techo \"$name\" > \"$name\" &&\n>  \t\tgit add \"$name\" &&\n>  \t\ttest_tick &&\n>  \t\tgit commit -m \"Add $name\"\n> +\t    done >/dev/null &&\n> +\t    git rev-parse --short --verify HEAD)\n\nWhile at it, why not do the \"indent with a single tab\", and other\nstyle fixes?  e.g.\n\n\t(\n\t\tcd \"$1\" &&\n                shift &&\n                for name\n                do\n\t\t\techo \"$name\" >\"$name\" &&\n                        git add $name\" &&\n                        test_tick &&\n                        git commit -m \"Add $name\" || exit\n\t\tdone >/dev/null &&\n\t\tgit rev-parse --short --verify HEAD\n\t)\n\nThe \"|| exit\" is needed to catch failures inside the loop (not that\n\"git commit\" there is likely to fail, so it is just for\ncompleteness).\n"}]}