{"thread":{"id":"39459","subject":"[PATCH v5 0/8] Improve git-pull test coverage","startedAt":"2015-05-29T11:44:37Z","lastAt":"2015-05-29T18:08:10Z","messageCount":10,"participants":["Paul Tan","Junio C Hamano"],"isPatch":true,"patchVersion":5,"patchTotal":8},"messages":[{"id":"262409","messageId":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":null,"subject":"[PATCH v5 0/8] Improve git-pull test coverage","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:37Z","receivedAt":"2015-05-29T11:44:37Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"This is a re-roll of [1].\n\nThis patch series improves test coverage of git-pull.sh, and is part of my\nGSoC project to rewrite git-pull into a builtin. Improving test coverage\nhelps to prevent regressions that could occur due to the rewrite.\n\nThanks Junio, Johannes and Stefan for the reviews last round.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/269236\n\nPaul Tan (8):\n  t5520: prevent field splitting in content comparisons\n  t5520: test no merge candidates cases\n  t5520: test for failure if index has unresolved entries\n  t5520: test work tree fast-forward when fetch updates head\n  t5520: test --rebase with multiple branches\n  t5520: test --rebase failure on unborn branch with index\n  t5521: test --dry-run does not make any changes\n  t5520: check reflog action in fast-forward merge\n\n t/t5520-pull.sh         | 198 +++++++++++++++++++++++++++++++++++++++---------\n t/t5521-pull-options.sh |  13 ++++\n 2 files changed, 175 insertions(+), 36 deletions(-)\n\n-- \n2.1.4\n"},{"id":"262410","messageId":"1432899885-25143-2-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 1/8] t5520: prevent field splitting in content comparisons","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:38Z","receivedAt":"2015-05-29T11:44:38Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Many tests in t5520 used the following to test the contents of files:\n\n\ttest `cat file` = expected\n\nor\n\n\ttest $(cat file) = expected\n\nThese 2 forms, however, will be affected by field splitting and,\ndepending on the value of $IFS, may be split into multiple arguments,\nmaking the test fail in mysterious ways.\n\nReplace the above 2 forms with:\n\n\ttest \"$(cat file)\" = expected\n\nas quoting the command substitution will prevent field splitting.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t5520-pull.sh | 70 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 35 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7efd45b..5e4db67 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -93,9 +93,9 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest `cat file` = file &&\n+\ttest \"$(cat file)\" = file &&\n \tgit pull &&\n-\ttest `cat file` = updated\n+\ttest \"$(cat file)\" = updated\n '\n \n test_expect_success 'the default remote . should not break explicit pull' '\n@@ -104,9 +104,9 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest `cat file` = file &&\n+\ttest \"$(cat file)\" = file &&\n \tgit pull . second &&\n-\ttest `cat file` = modified\n+\ttest \"$(cat file)\" = modified\n '\n \n test_expect_success '--rebase' '\n@@ -119,23 +119,23 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n-\ttest new = $(git show HEAD:file2)\n+\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\"\n '\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n-\ttest new = $(git show HEAD:file2)\n+\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n-\ttest new = $(git show HEAD:file2)\n+\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -143,8 +143,8 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^) != $(git rev-parse copy) &&\n-\ttest new = $(git show HEAD:file2)\n+\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest new = \"$(git show HEAD:file2)\"\n '\n \n # add a feature branch, keep-merge, that is merged into master, so the\n@@ -163,33 +163,33 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^1) = $(git rev-parse before-preserve-rebase) &&\n-\ttest $(git rev-parse HEAD^2) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest $(git rev-parse HEAD^2) = $(git rev-parse keep-merge)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -202,25 +202,25 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest $(git rev-parse HEAD^1) = $(git rev-parse before-preserve-rebase) &&\n-\ttest $(git rev-parse HEAD^2) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success '--rebase=preserve rebases and merges keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest $(git rev-parse HEAD^2) = $(git rev-parse keep-merge)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -232,8 +232,8 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n+\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -250,7 +250,7 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = $(cat file2)\n+\ttest file = \"$(cat file2)\"\n \n '\n \n@@ -261,7 +261,7 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = $(cat file2)\n+\ttest file = \"$(cat file2)\"\n \n '\n \n@@ -282,7 +282,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n-\tCOPY=$(git rev-parse --verify me/copy) &&\n+\tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n \tgit rebase --onto $COPY copy &&\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n@@ -290,10 +290,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >> file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest $COPY = $(git rev-parse --verify me/copy) &&\n+\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest $COPY != $(git rev-parse --verify me/copy)\n+\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n \n '\n \n-- \n2.1.4\n"},{"id":"262411","messageId":"1432899885-25143-3-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 2/8] t5520: test no merge candidates cases","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:39Z","receivedAt":"2015-05-29T11:44:39Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"a8c9bef (pull: improve advice for unconfigured error case, 2009-10-05)\nfully established the current advices given by git-pull for the\ndifferent cases where git-fetch will not have anything marked for merge:\n\n1. We fetched from a specific remote, and a refspec was given, but it\n   ended up not fetching anything. This is usually because the user\n   provided a wildcard refspec which had no matches on the remote end.\n\n2. We fetched from a non-default remote, but didn't specify a branch to\n   merge. We can't use the configured one because it applies to the\n   default remote, and thus the user must specify the branches to merge.\n\n3. We fetched from the branch's or repo's default remote, but:\n\n   a. We are not on a branch, so there will never be a configured branch\n      to merge with.\n\n   b. We are on a branch, but there is no configured branch to merge\n      with.\n\n4. We fetched from the branch's or repo's default remote, but the\n   configured branch to merge didn't get fetched (either it doesn't\n   exist, or wasn't part of the configured fetch refspec)\n\nImplement tests for the above 5 cases to ensure that the correct code\npaths are triggered for each of these cases.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\n t/t5520-pull.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 55 insertions(+)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 5e4db67..4a2c0a1 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -109,6 +109,61 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \ttest \"$(cat file)\" = modified\n '\n \n+test_expect_success 'fail if wildcard spec does not match any refs' '\n+\tgit checkout -b test copy^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n+\ttest_i18ngrep \"no candidates for merging\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n+test_expect_success 'fail if no branches specified with non-default remote' '\n+\tgit remote add test_remote . &&\n+\ttest_when_finished \"git remote remove test_remote\" &&\n+\tgit checkout -b test copy^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_config branch.test.remote origin &&\n+\ttest_must_fail git pull test_remote 2>err &&\n+\ttest_i18ngrep \"specify a branch on the command line\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n+test_expect_success 'fail if not on a branch' '\n+\tgit remote add origin . &&\n+\ttest_when_finished \"git remote remove origin\" &&\n+\tgit checkout HEAD^ &&\n+\ttest_when_finished \"git checkout -f copy\" &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_must_fail git pull 2>err &&\n+\ttest_i18ngrep \"not currently on a branch\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n+test_expect_success 'fail if no configuration for current branch' '\n+\tgit remote add test_remote . &&\n+\ttest_when_finished \"git remote remove test_remote\" &&\n+\tgit checkout -b test copy^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n+\ttest_config branch.test.remote test_remote &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_must_fail git pull 2>err &&\n+\ttest_i18ngrep \"no tracking information\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n+test_expect_success 'fail if upstream branch does not exist' '\n+\tgit checkout -b test copy^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n+\ttest_config branch.test.remote . &&\n+\ttest_config branch.test.merge refs/heads/nonexisting &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_must_fail git pull 2>err &&\n+\ttest_i18ngrep \"no such ref was fetched\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n \techo modified again > file &&\n-- \n2.1.4\n"},{"id":"262413","messageId":"1432899885-25143-4-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 3/8] t5520: test for failure if index has unresolved entries","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:40Z","receivedAt":"2015-05-29T11:44:40Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Commit d38a30d (Be more user-friendly when refusing to do something\nbecause of conflict., 2010-01-12) introduced code paths to git-pull\nwhich will error out with user-friendly advices if the user is in the\nmiddle of a merge or has unmerged files.\n\nImplement tests to ensure that git-pull will not run, and will print\nthese advices, if the user is in the middle of a merge or has unmerged\nfiles in the index.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\nNotes:\n    \n    v5:\n    \n    * use \"test_commit\"\n\n t/t5520-pull.sh | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 4a2c0a1..265c693 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -164,6 +164,25 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest \"$(cat file)\" = file\n '\n \n+test_expect_success 'fail if the index has unresolved entries' '\n+\tgit checkout -b third second^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_commit modified2 file &&\n+\ttest -z \"$(git ls-files -u)\" &&\n+\ttest_must_fail git pull . second &&\n+\ttest -n \"$(git ls-files -u)\" &&\n+\tcp file expected &&\n+\ttest_must_fail git pull . second 2>err &&\n+\ttest_i18ngrep \"Pull is not possible because you have unmerged files\" err &&\n+\ttest_cmp expected file &&\n+\tgit add file &&\n+\ttest -z \"$(git ls-files -u)\" &&\n+\ttest_must_fail git pull . second 2>err &&\n+\ttest_i18ngrep \"You have not concluded your merge\" err &&\n+\ttest_cmp expected file\n+'\n+\n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n \techo modified again > file &&\n-- \n2.1.4\n"},{"id":"262416","messageId":"1432899885-25143-5-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 4/8] t5520: test work tree fast-forward when fetch updates head","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:41Z","receivedAt":"2015-05-29T11:44:41Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since b10ac50 (Fix pulling into the same branch., 2005-08-25), git-pull,\nupon detecting that git-fetch updated the current head, will\nfast-forward the working tree to the updated head commit.\n\nImplement tests to ensure that the fast-forward occurs in such a case,\nas well as to ensure that the user-friendly advice is printed upon\nfailure.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\n t/t5520-pull.sh | 21 +++++++++++++++++++++\n 1 file changed, 21 insertions(+)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 265c693..872d765 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -183,6 +183,27 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_cmp expected file\n '\n \n+test_expect_success 'fast-forwards working tree if branch head is updated' '\n+\tgit checkout -b third second^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n+\ttest \"$(cat file)\" = file &&\n+\tgit pull . second:third 2>err &&\n+\ttest_i18ngrep \"fetch updated the current branch head\" err &&\n+\ttest \"$(cat file)\" = modified &&\n+\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+'\n+\n+test_expect_success 'fast-forward fails with conflicting work tree' '\n+\tgit checkout -b third second^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n+\ttest \"$(cat file)\" = file &&\n+\techo conflict >file &&\n+\ttest_must_fail git pull . second:third 2>err &&\n+\ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n+\ttest \"$(cat file)\" = conflict &&\n+\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+'\n+\n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n \techo modified again > file &&\n-- \n2.1.4\n"},{"id":"262415","messageId":"1432899885-25143-6-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 5/8] t5520: test --rebase with multiple branches","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:42Z","receivedAt":"2015-05-29T11:44:42Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since rebasing on top of multiple upstream branches does not make sense,\nsince 51b2ead (disallow providing multiple upstream branches to rebase,\npull --rebase, 2009-02-18), git-pull explicitly disallowed specifying\nmultiple branches in the rebase case.\n\nImplement tests to ensure that git-pull fails and prints out the\nuser-friendly error message in such a case.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\n t/t5520-pull.sh | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 872d765..90728e0 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -217,6 +217,15 @@ test_expect_success '--rebase' '\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n+\n+test_expect_success '--rebase fails with multiple branches' '\n+\tgit reset --hard before-rebase &&\n+\ttest_must_fail git pull --rebase . copy master 2>err &&\n+\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n+\ttest modified = \"$(git show HEAD:file)\"\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n-- \n2.1.4\n"},{"id":"262414","messageId":"1432899885-25143-7-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 6/8] t5520: test --rebase failure on unborn branch with index","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:43Z","receivedAt":"2015-05-29T11:44:43Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Commit 19a7fcb (allow pull --rebase on branch yet to be born,\n2009-08-11) special cases git-pull on an unborn branch in a different\ncode path such that git-pull --rebase is still valid even though there\nis no HEAD yet.\n\nThis code path still ensures that there is no index in order not to lose\nany staged changes. Implement a test to ensure that this check is\ntriggered.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\nNotes:\n    \n    v5:\n    \n    * Move test_i18ngrep into subshell\n\n t/t5520-pull.sh | 15 +++++++++++++++\n 1 file changed, 15 insertions(+)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 90728e0..a04f55c 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -412,6 +412,21 @@ test_expect_success 'pull --rebase works on branch yet to be born' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n+\ttest_when_finished \"rm -rf empty_repo2\" &&\n+\tgit init empty_repo2 &&\n+\t(\n+\t\tcd empty_repo2 &&\n+\t\techo staged-file >staged-file &&\n+\t\tgit add staged-file &&\n+\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\ttest_must_fail git pull --rebase .. master 2>err &&\n+\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n+\t)\n+'\n+\n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n \t(cd src &&\n-- \n2.1.4\n"},{"id":"262412","messageId":"1432899885-25143-8-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 7/8] t5521: test --dry-run does not make any changes","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:44Z","receivedAt":"2015-05-29T11:44:44Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Test that when --dry-run is provided to git-pull, it does not make any\nchanges, namely:\n\n* --dry-run gets passed to git-fetch, so no FETCH_HEAD will be created\n  and no refs will be fetched.\n\n* The index and work tree will not be modified.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\n t/t5521-pull-options.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh\nindex 453aba5..56e7377 100755\n--- a/t/t5521-pull-options.sh\n+++ b/t/t5521-pull-options.sh\n@@ -117,4 +117,17 @@ test_expect_success 'git pull --all' '\n \t)\n '\n \n+test_expect_success 'git pull --dry-run' '\n+\ttest_when_finished \"rm -rf clonedry\" &&\n+\tgit init clonedry &&\n+\t(\n+\t\tcd clonedry &&\n+\t\tgit pull --dry-run ../parent &&\n+\t\ttest_path_is_missing .git/FETCH_HEAD &&\n+\t\ttest_path_is_missing .git/refs/heads/master &&\n+\t\ttest_path_is_missing .git/index &&\n+\t\ttest_path_is_missing file\n+\t)\n+'\n+\n test_done\n-- \n2.1.4\n"},{"id":"262417","messageId":"1432899885-25143-9-git-send-email-pyokagan@gmail.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v5 8/8] t5520: check reflog action in fast-forward merge","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-29T11:44:45Z","receivedAt":"2015-05-29T11:44:45Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"When testing a fast-forward merge with git-pull, check to see if the\nreflog action is \"pull\" with the arguments passed to git-pull.\n\nWhile we are in the vicinity, remove the empty line as well.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\nNotes:\n    v5:\n    \n    * Loosen up the pattern used for search-and-replace of the object ID in\n      the reflog: it may not always be the case that the abbreviated object\n      ID is at least 5 characters.\n    \n    * Only match the beginning of the reflog entry for the object ID.\n\n t/t5520-pull.sh | 13 ++++++++++---\n 1 file changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a04f55c..af31f04 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -86,7 +86,6 @@ test_expect_success 'pulling into void must not create an octopus' '\n '\n \n test_expect_success 'test . as a remote' '\n-\n \tgit branch copy master &&\n \tgit config branch.copy.remote . &&\n \tgit config branch.copy.merge refs/heads/master &&\n@@ -95,7 +94,11 @@ test_expect_success 'test . as a remote' '\n \tgit checkout copy &&\n \ttest \"$(cat file)\" = file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated\n+\ttest \"$(cat file)\" = updated &&\n+\tgit reflog -1 >reflog.actual &&\n+\tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n+\techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n+\ttest_cmp reflog.expected reflog.fuzzy\n '\n \n test_expect_success 'the default remote . should not break explicit pull' '\n@@ -106,7 +109,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit reset --hard HEAD^ &&\n \ttest \"$(cat file)\" = file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified\n+\ttest \"$(cat file)\" = modified &&\n+\tgit reflog -1 >reflog.actual &&\n+\tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n+\techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n+\ttest_cmp reflog.expected reflog.fuzzy\n '\n \n test_expect_success 'fail if wildcard spec does not match any refs' '\n-- \n2.1.4\n"},{"id":"262444","messageId":"xmqqk2vrcl4l.fsf@gitster.dls.corp.google.com","threadId":"39459","inReplyTo":"1432899885-25143-1-git-send-email-pyokagan@gmail.com","subject":"Re: [PATCH v5 0/8] Improve git-pull test coverage","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-29T18:08:10Z","receivedAt":"2015-05-29T18:08:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Tan <pyokagan@gmail.com> writes:\n\n> This is a re-roll of [1].\n>\n> This patch series improves test coverage of git-pull.sh, and is part of my\n> GSoC project to rewrite git-pull into a builtin. Improving test coverage\n> helps to prevent regressions that could occur due to the rewrite.\n>\n> Thanks Junio, Johannes and Stefan for the reviews last round.\n>\n> [1] http://thread.gmane.org/gmane.comp.version-control.git/269236\n>\n> Paul Tan (8):\n>   t5520: prevent field splitting in content comparisons\n>   t5520: test no merge candidates cases\n>   t5520: test for failure if index has unresolved entries\n>   t5520: test work tree fast-forward when fetch updates head\n>   t5520: test --rebase with multiple branches\n>   t5520: test --rebase failure on unborn branch with index\n>   t5521: test --dry-run does not make any changes\n>   t5520: check reflog action in fast-forward merge\n>\n>  t/t5520-pull.sh         | 198 +++++++++++++++++++++++++++++++++++++++---------\n>  t/t5521-pull-options.sh |  13 ++++\n>  2 files changed, 175 insertions(+), 36 deletions(-)\n\nI saw very little changes relative to the previous round, and all of\nthem looked sensible ones.\n\nThanks.\n"}]}