git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
Cc: Jacob Smith <jaroslav@gmail.com>,
	Lars Schneider <larsxschneider@gmail.com>,
	Stefan Beller <sbeller@google.com>,
	Luke Diamand <luke@diamand.org>
Subject: [PATCHv1] git-p4: workaround p4 removal of client directory
Date: Fri, 29 Apr 2016 08:40:26 +0100	[thread overview]
Message-ID: <1461915626-10250-2-git-send-email-luke@diamand.org> (raw)
In-Reply-To: <1461915626-10250-1-git-send-email-luke@diamand.org>

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

  reply	other threads:[~2016-04-29  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  7:40 [PATCHv1] git-p4: workaround p4 removal of client directory Luke Diamand
2016-04-29  7:40 ` Luke Diamand [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461915626-10250-2-git-send-email-luke@diamand.org \
    --to=luke@diamand.org \
    --cc=git@vger.kernel.org \
    --cc=jaroslav@gmail.com \
    --cc=larsxschneider@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).