{"thread":{"id":"42175","subject":"[PATCHv1] git-p4: workaround p4 removal of client directory","startedAt":"2016-04-29T07:39:27Z","lastAt":"2016-04-29T20:47:29Z","messageCount":4,"participants":["Luke Diamand"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"284899","messageId":"CAE5ih78yvMe2MLqE6+KOnPUd+D_0-cO5-LY2WsbjfMmTMqBK9w@mail.gmail.com","threadId":"42175","inReplyTo":"1461915626-10250-2-git-send-email-luke@diamand.org","subject":"Re: [PATCHv1] git-p4: workaround p4 removal of client directory","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2016-04-29T07:39:27Z","receivedAt":"2016-04-29T07:39:27Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Adding correct email for Jacob.\n\nOn 29 April 2016 at 08:40, Luke Diamand <luke@diamand.org> wrote:\n> On some platforms, \"p4 sync -f\" will remove the workspace\n> directory after we have just created it; on some it won't.\n> This causes problems later when git finds itself in an\n> orphaned directory.\n>\n> Workaround this by cd'ing back to the directory after\n> the \"p4 sync -f\".\n>\n> Signed-off-by: Luke Diamand <luke@diamand.org>\n> ---\n>  git-p4.py | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 527d44b..2b75a61 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1,4 +1,4 @@\n> -#!/usr/bin/env python\n> +#!/usr/bin/env python2\n>  #\n>  # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.\n>  #\n> @@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):\n>              if new_client_dir:\n>                  # old one was destroyed, and maybe nobody told p4\n>                  p4_sync(\"...\", \"-f\")\n> +\n> +                # sometimes p4 will unlink the directory and recreate it\n> +                chdir(self.clientPath, is_client_path=True)\n>              else:\n>                  p4_sync(\"...\")\n>          self.check()\n> --\n> 2.8.1.218.gd2cea43.dirty\n>\n"},{"id":"284897","messageId":"1461915626-10250-1-git-send-email-luke@diamand.org","threadId":"42175","inReplyTo":null,"subject":"[PATCHv1] git-p4: workaround p4 removal of client directory","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2016-04-29T07:40:25Z","receivedAt":"2016-04-29T07:40:25Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"This is a proposed fix for the problem reported by Jacob on OSX\nwhere \"p4 sync -f\" removes the client directory.\n\nhttp://www.spinics.net/lists/git/msg274356.html\n\nI tried just moving the \"cd\", but lots of the tests then fail as\nthe \"p4 sync\" needs to be in the correct directory.\n\nLuke Diamand (1):\n  git-p4: workaround p4 removal of client directory\n\n git-p4.py | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\n-- \n2.8.1.218.gd2cea43.dirty\n"},{"id":"284896","messageId":"1461915626-10250-2-git-send-email-luke@diamand.org","threadId":"42175","inReplyTo":"1461915626-10250-1-git-send-email-luke@diamand.org","subject":"[PATCHv1] git-p4: workaround p4 removal of client directory","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2016-04-29T07:40:26Z","receivedAt":"2016-04-29T07:40:26Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On some platforms, \"p4 sync -f\" will remove the workspace\ndirectory after we have just created it; on some it won't.\nThis causes problems later when git finds itself in an\norphaned directory.\n\nWorkaround this by cd'ing back to the directory after\nthe \"p4 sync -f\".\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 527d44b..2b75a61 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env python\n+#!/usr/bin/env python2\n #\n # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.\n #\n@@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):\n             if new_client_dir:\n                 # old one was destroyed, and maybe nobody told p4\n                 p4_sync(\"...\", \"-f\")\n+\n+                # sometimes p4 will unlink the directory and recreate it\n+                chdir(self.clientPath, is_client_path=True)\n             else:\n                 p4_sync(\"...\")\n         self.check()\n-- \n2.8.1.218.gd2cea43.dirty\n"},{"id":"284975","messageId":"CAE5ih786AiiZw==QVhTzz5qSziirsKJkb8CtaiRTMh_Ejy51YQ@mail.gmail.com","threadId":"42175","inReplyTo":"0F0D8F8A-47CB-44E3-90A6-13047D5A71F5@gmail.com","subject":"Re: [PATCHv1] git-p4: workaround p4 removal of client directory","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2016-04-29T20:47:29Z","receivedAt":"2016-04-29T20:47:29Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"[+Git, Junio]\n\nOn 29 April 2016 at 15:10, Jacob Smith <jaroslov@gmail.com> wrote:\n> That's the identical patch I'm maintaining internally; it appears to work.\n\nThanks, I think that counts as a \"Tested-by\" then.\n\nLuke\n\n\n>\n> Sent from my iPhone\n>\n>> On Apr 29, 2016, at 8:52 AM, Luke Diamand <luke@diamand.org> wrote:\n>>\n>>> On 29 April 2016 at 13:34, Jacob Smith <jaroslov@gmail.com> wrote:\n>>> Thank you, Luke! I'll raise a radar so (hopefully) it gets integrated into Apple's distribution.\n>>\n>> Can you check if it works for you? I can't reproduce it here.\n>>\n>> Thanks!\n>> Luke\n>>\n>>\n>>\n>>\n>>>\n>>>> On Apr 29, 2016, at 2:39 AM, Luke Diamand <luke@diamand.org> wrote:\n>>>>\n>>>> Adding correct email for Jacob.\n>>>>\n>>>>> On 29 April 2016 at 08:40, Luke Diamand <luke@diamand.org> wrote:\n>>>>> On some platforms, \"p4 sync -f\" will remove the workspace\n>>>>> directory after we have just created it; on some it won't.\n>>>>> This causes problems later when git finds itself in an\n>>>>> orphaned directory.\n>>>>>\n>>>>> Workaround this by cd'ing back to the directory after\n>>>>> the \"p4 sync -f\".\n>>>>>\n>>>>> Signed-off-by: Luke Diamand <luke@diamand.org>\n>>>>> ---\n>>>>> git-p4.py | 5 ++++-\n>>>>> 1 file changed, 4 insertions(+), 1 deletion(-)\n>>>>>\n>>>>> diff --git a/git-p4.py b/git-p4.py\n>>>>> index 527d44b..2b75a61 100755\n>>>>> --- a/git-p4.py\n>>>>> +++ b/git-p4.py\n>>>>> @@ -1,4 +1,4 @@\n>>>>> -#!/usr/bin/env python\n>>>>> +#!/usr/bin/env python2\n>>>>> #\n>>>>> # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.\n>>>>> #\n>>>>> @@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):\n>>>>>            if new_client_dir:\n>>>>>                # old one was destroyed, and maybe nobody told p4\n>>>>>                p4_sync(\"...\", \"-f\")\n>>>>> +\n>>>>> +                # sometimes p4 will unlink the directory and recreate it\n>>>>> +                chdir(self.clientPath, is_client_path=True)\n>>>>>            else:\n>>>>>                p4_sync(\"...\")\n>>>>>        self.check()\n>>>>> --\n>>>>> 2.8.1.218.gd2cea43.dirty\n>>>>>\n"}]}