git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCHv1] git-p4: workaround p4 removal of client directory
  2016-04-29  7:40 ` Luke Diamand
@ 2016-04-29  7:39   ` Luke Diamand
       [not found]     ` <1A001D64-FAEA-49DA-9C2D-12DA04AA5F29@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2016-04-29  7:39 UTC (permalink / raw)
  To: Git Users; +Cc: Lars Schneider, Stefan Beller, Luke Diamand, Jacob Smith

Adding correct email for Jacob.

On 29 April 2016 at 08:40, Luke Diamand <luke@diamand.org> wrote:
> On some platforms, "p4 sync -f" will remove the workspace
> directory after we have just created it; on some it won't.
> This causes problems later when git finds itself in an
> orphaned directory.
>
> Workaround this by cd'ing back to the directory after
> the "p4 sync -f".
>
> Signed-off-by: Luke Diamand <luke@diamand.org>
> ---
>  git-p4.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 527d44b..2b75a61 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python2
>  #
>  # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
>  #
> @@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):
>              if new_client_dir:
>                  # old one was destroyed, and maybe nobody told p4
>                  p4_sync("...", "-f")
> +
> +                # sometimes p4 will unlink the directory and recreate it
> +                chdir(self.clientPath, is_client_path=True)
>              else:
>                  p4_sync("...")
>          self.check()
> --
> 2.8.1.218.gd2cea43.dirty
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv1] git-p4: workaround p4 removal of client directory
@ 2016-04-29  7:40 Luke Diamand
  2016-04-29  7:40 ` Luke Diamand
  0 siblings, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2016-04-29  7:40 UTC (permalink / raw)
  To: git; +Cc: Jacob Smith, Lars Schneider, Stefan Beller, Luke Diamand

This is a proposed fix for the problem reported by Jacob on OSX
where "p4 sync -f" removes the client directory.

http://www.spinics.net/lists/git/msg274356.html

I tried just moving the "cd", but lots of the tests then fail as
the "p4 sync" needs to be in the correct directory.

Luke Diamand (1):
  git-p4: workaround p4 removal of client directory

 git-p4.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.8.1.218.gd2cea43.dirty

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv1] git-p4: workaround p4 removal of client directory
  2016-04-29  7:40 [PATCHv1] git-p4: workaround p4 removal of client directory Luke Diamand
@ 2016-04-29  7:40 ` Luke Diamand
  2016-04-29  7:39   ` Luke Diamand
  0 siblings, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2016-04-29  7:40 UTC (permalink / raw)
  To: git; +Cc: Jacob Smith, Lars Schneider, Stefan Beller, Luke Diamand

On some platforms, "p4 sync -f" will remove the workspace
directory after we have just created it; on some it won't.
This causes problems later when git finds itself in an
orphaned directory.

Workaround this by cd'ing back to the directory after
the "p4 sync -f".

Signed-off-by: Luke Diamand <luke@diamand.org>
---
 git-p4.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/git-p4.py b/git-p4.py
index 527d44b..2b75a61 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
 #
@@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):
             if new_client_dir:
                 # old one was destroyed, and maybe nobody told p4
                 p4_sync("...", "-f")
+
+                # sometimes p4 will unlink the directory and recreate it
+                chdir(self.clientPath, is_client_path=True)
             else:
                 p4_sync("...")
         self.check()
-- 
2.8.1.218.gd2cea43.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv1] git-p4: workaround p4 removal of client directory
       [not found]         ` <0F0D8F8A-47CB-44E3-90A6-13047D5A71F5@gmail.com>
@ 2016-04-29 20:47           ` Luke Diamand
  0 siblings, 0 replies; 4+ messages in thread
From: Luke Diamand @ 2016-04-29 20:47 UTC (permalink / raw)
  To: Jacob Smith, Git Users, Junio C Hamano

[+Git, Junio]

On 29 April 2016 at 15:10, Jacob Smith <jaroslov@gmail.com> wrote:
> That's the identical patch I'm maintaining internally; it appears to work.

Thanks, I think that counts as a "Tested-by" then.

Luke


>
> Sent from my iPhone
>
>> On Apr 29, 2016, at 8:52 AM, Luke Diamand <luke@diamand.org> wrote:
>>
>>> On 29 April 2016 at 13:34, Jacob Smith <jaroslov@gmail.com> wrote:
>>> Thank you, Luke! I'll raise a radar so (hopefully) it gets integrated into Apple's distribution.
>>
>> Can you check if it works for you? I can't reproduce it here.
>>
>> Thanks!
>> Luke
>>
>>
>>
>>
>>>
>>>> On Apr 29, 2016, at 2:39 AM, Luke Diamand <luke@diamand.org> wrote:
>>>>
>>>> Adding correct email for Jacob.
>>>>
>>>>> On 29 April 2016 at 08:40, Luke Diamand <luke@diamand.org> wrote:
>>>>> On some platforms, "p4 sync -f" will remove the workspace
>>>>> directory after we have just created it; on some it won't.
>>>>> This causes problems later when git finds itself in an
>>>>> orphaned directory.
>>>>>
>>>>> Workaround this by cd'ing back to the directory after
>>>>> the "p4 sync -f".
>>>>>
>>>>> Signed-off-by: Luke Diamand <luke@diamand.org>
>>>>> ---
>>>>> git-p4.py | 5 ++++-
>>>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/git-p4.py b/git-p4.py
>>>>> index 527d44b..2b75a61 100755
>>>>> --- a/git-p4.py
>>>>> +++ b/git-p4.py
>>>>> @@ -1,4 +1,4 @@
>>>>> -#!/usr/bin/env python
>>>>> +#!/usr/bin/env python2
>>>>> #
>>>>> # git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
>>>>> #
>>>>> @@ -1956,6 +1956,9 @@ class P4Submit(Command, P4UserMap):
>>>>>            if new_client_dir:
>>>>>                # old one was destroyed, and maybe nobody told p4
>>>>>                p4_sync("...", "-f")
>>>>> +
>>>>> +                # sometimes p4 will unlink the directory and recreate it
>>>>> +                chdir(self.clientPath, is_client_path=True)
>>>>>            else:
>>>>>                p4_sync("...")
>>>>>        self.check()
>>>>> --
>>>>> 2.8.1.218.gd2cea43.dirty
>>>>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-29 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29  7:40 [PATCHv1] git-p4: workaround p4 removal of client directory Luke Diamand
2016-04-29  7:40 ` Luke Diamand
2016-04-29  7:39   ` Luke Diamand
     [not found]     ` <1A001D64-FAEA-49DA-9C2D-12DA04AA5F29@gmail.com>
     [not found]       ` <CAE5ih7_V_ZNmouUGyi_NLgzjOGt_ZvNfj3K9a_+7LRyn6m8cNw@mail.gmail.com>
     [not found]         ` <0F0D8F8A-47CB-44E3-90A6-13047D5A71F5@gmail.com>
2016-04-29 20:47           ` Luke Diamand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).