git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Evan Powers <evan.powers@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Simon Hausmann <simon@lst.de>,
	Luke Diamand <luke@diamand.org>
Subject: [PATCH] git-p4: fix bug in symlink handling
Date: Tue, 16 Feb 2010 00:44:08 -0800	[thread overview]
Message-ID: <6682cfcf1002160044i7aacd1b0t7bb351380b1bd27c@mail.gmail.com> (raw)

Fix inadvertent breakage from b932705 in the code that strips the
trailing '\n' from p4 print on a symlink. (In practice, contents is of
the form ['target\n', ''].)

Signed-off-by: Evan Powers <evan.powers@gmail.com>
---
This patch Works For Me, but I didn't take the time to understand the
entire code path so it might be equally valid to replace contents.pop()
with contents.pop(0) and call it a day.

 contrib/fast-import/git-p4 |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e7c4814..cd96c6f 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -967,9 +967,8 @@ class P4Sync(Command):
         elif file["type"] == "symlink":
             mode = "120000"
             # p4 print on a symlink contains "target\n", so strip it off
-            last = contents.pop()
-            last = last[:-1]
-            contents.append(last)
+            data = ''.join(contents)
+            contents = [data[:-1]]

         if self.isWindows and file["type"].endswith("text"):
             mangled = []
-- 
1.6.6

             reply	other threads:[~2010-02-16  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16  8:44 Evan Powers [this message]
2010-02-20 14:05 ` [PATCH] git-p4: fix bug in symlink handling Pete Wyckoff
2010-02-20 19:22   ` Junio C Hamano

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=6682cfcf1002160044i7aacd1b0t7bb351380b1bd27c@mail.gmail.com \
    --to=evan.powers@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luke@diamand.org \
    --cc=simon@lst.de \
    /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).