{"thread":{"id":"54260","subject":"[PATCH 0/2] git-p4: unshelve uses HEAD^n, not HEAD~n","startedAt":"2020-09-19T08:54:15Z","lastAt":"2020-09-20T05:35:07Z","messageCount":5,"participants":["Luke Diamand","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"405930","messageId":"20200919085441.7621-1-luke@diamand.org","threadId":"54260","inReplyTo":null,"subject":"[PATCH 0/2] git-p4: unshelve uses HEAD^n, not HEAD~n","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2020-09-19T08:54:39Z","receivedAt":"2020-09-19T08:54:15Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Jackson(Xuhui) Liu found that git-p4 unshelve fails, and suggested a\nfix.\n\nI have updated the tests to spot the error, and added his suggested fix,\nwhich also works for me.\n\nLuke Diamand (2):\n  git-p4 unshelve: adding a commit breaks git-p4 unshelve\n  git-p4: use HEAD~$n to find parent commit for unshelve\n\n git-p4.py           | 2 +-\n t/t9832-unshelve.sh | 5 ++++-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\n-- \n2.28.0\n\n"},{"id":"405931","messageId":"20200919085441.7621-2-luke@diamand.org","threadId":"54260","inReplyTo":"20200919085441.7621-1-luke@diamand.org","subject":"[PATCH 1/2] git-p4 unshelve: adding a commit breaks git-p4 unshelve","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2020-09-19T08:54:40Z","receivedAt":"2020-09-19T08:54:15Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"git-p4 unshelve uses HEAD^$n to find the parent commit, which\nfails if there is an additional commit.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n t/t9832-unshelve.sh | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh\nindex e9276c48f4..feda4499dd 100755\n--- a/t/t9832-unshelve.sh\n+++ b/t/t9832-unshelve.sh\n@@ -29,8 +29,11 @@ test_expect_success 'init depot' '\n \t)\n '\n \n+# Create an initial clone, with a commit unrelated to the P4 change\n+# on HEAD\n test_expect_success 'initial clone' '\n-\tgit p4 clone --dest=\"$git\" //depot/@all\n+\tgit p4 clone --dest=\"$git\" //depot/@all &&\n+    test_commit -C \"$git\" \"unrelated\"\n '\n \n test_expect_success 'create shelved changelist' '\n@@ -77,7 +80,7 @@ EOF\n \t)\n '\n \n-test_expect_success 'update shelved changelist and re-unshelve' '\n+test_expect_failure 'update shelved changelist and re-unshelve' '\n \ttest_when_finished cleanup_git &&\n \t(\n \t\tcd \"$cli\" &&\n-- \n2.28.0\n\n"},{"id":"405932","messageId":"20200919085441.7621-3-luke@diamand.org","threadId":"54260","inReplyTo":"20200919085441.7621-2-luke@diamand.org","subject":"[PATCH 2/2] git-p4: use HEAD~$n to find parent commit for unshelve","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2020-09-19T08:54:41Z","receivedAt":"2020-09-19T08:54:15Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Found-by: Liu Xuhui (Jackson) <Xuhui.Liu@amd.com>\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py           | 2 +-\n t/t9832-unshelve.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex ca79dc0900..4433ca53de 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -4237,7 +4237,7 @@ def findLastP4Revision(self, starting_point):\n         \"\"\"\n \n         for parent in (range(65535)):\n-            log = extractLogMessageFromGitCommit(\"{0}^{1}\".format(starting_point, parent))\n+            log = extractLogMessageFromGitCommit(\"{0}~{1}\".format(starting_point, parent))\n             settings = extractSettingsGitLog(log)\n             if 'change' in settings:\n                 return settings\ndiff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh\nindex feda4499dd..7194fb2855 100755\n--- a/t/t9832-unshelve.sh\n+++ b/t/t9832-unshelve.sh\n@@ -80,7 +80,7 @@ EOF\n \t)\n '\n \n-test_expect_failure 'update shelved changelist and re-unshelve' '\n+test_expect_success 'update shelved changelist and re-unshelve' '\n \ttest_when_finished cleanup_git &&\n \t(\n \t\tcd \"$cli\" &&\n-- \n2.28.0\n\n"},{"id":"405966","messageId":"CAPig+cSx35oTR_Er-DyxqV0HZw+tDHPf1GdARfw=-2bhTz02gw@mail.gmail.com","threadId":"54260","inReplyTo":"20200919085441.7621-2-luke@diamand.org","subject":"Re: [PATCH 1/2] git-p4 unshelve: adding a commit breaks git-p4 unshelve","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-09-20T05:31:25Z","receivedAt":"2020-09-20T05:31:39Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Sep 19, 2020 at 4:54 AM Luke Diamand <luke@diamand.org> wrote:\n> git-p4 unshelve: adding a commit breaks git-p4 unshelve\n>\n> git-p4 unshelve uses HEAD^$n to find the parent commit, which\n> fails if there is an additional commit.\n\nIt was a bit difficult understanding the purpose of this patch based\nupon the commit message alone. It might be clearer if written like\nthis:\n\n    git-p4: demonstrate `unshelve` bug\n\n    `git p4 unshelve` uses HEAD^$n to find the parent commit, which\n    fails if there is an additional commit. Augment the tests to\n    demonstrate this problem.\n\n> Signed-off-by: Luke Diamand <luke@diamand.org>\n> ---\n> diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh\n> @@ -29,8 +29,11 @@ test_expect_success 'init depot' '\n> +# Create an initial clone, with a commit unrelated to the P4 change\n> +# on HEAD\n>  test_expect_success 'initial clone' '\n> -       git p4 clone --dest=\"$git\" //depot/@all\n> +       git p4 clone --dest=\"$git\" //depot/@all &&\n> +    test_commit -C \"$git\" \"unrelated\"\n>  '\n\nStrange indentation of the new line. Use TAB rather than spaces.\n"},{"id":"405967","messageId":"CAPig+cQ2ccTC+d85A7HCHWeUp1aPgj-LBvbcO_Bv-nVkvTm=RQ@mail.gmail.com","threadId":"54260","inReplyTo":"20200919085441.7621-3-luke@diamand.org","subject":"Re: [PATCH 2/2] git-p4: use HEAD~$n to find parent commit for unshelve","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-09-20T05:34:51Z","receivedAt":"2020-09-20T05:35:07Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Sep 19, 2020 at 4:54 AM Luke Diamand <luke@diamand.org> wrote:\n> git-p4: use HEAD~$n to find parent commit for unshelve\n\nThis commit message repeats what the patch itself says but doesn't\nexplain why this change is being made or what problem is being solved.\nSome explanation to help readers understand the problem would be\nwelcome.\n\n> Found-by: Liu Xuhui (Jackson) <Xuhui.Liu@amd.com>\n\nI believe this would generally be stated as Reported-by:.\n\n> Signed-off-by: Luke Diamand <luke@diamand.org>\n"}]}