From: Simon Hausmann <simon@lst.de>
To: git@vger.kernel.org
Cc: "Han-Wen Nienhuys" <hanwen@google.com>,
Brian Swetland <swetland@google.com>
Subject: [PATCH] git-p4: Fix support for symlinks.
Date: Tue, 7 Aug 2007 10:25:47 +0200 [thread overview]
Message-ID: <200708071025.47965.simon@lst.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Signed-off-by: Simon Hausmann <simon@lst.de>
---
contrib/fast-import/git-p4 | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 41e86e7..9c6f911 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -839,11 +839,15 @@ class P4Sync(Command):
if file["action"] == "delete":
self.gitStream.write("D %s\n" % relPath)
else:
+ data = file['data']
+
mode = 644
if file["type"].startswith("x"):
mode = 755
-
- data = file['data']
+ elif file["type"] == "symlink":
+ mode = 120000
+ # p4 print on a symlink contains "target\n", so strip it off
+ data = data[:-1]
if self.isWindows and file["type"].endswith("text"):
data = data.replace("\r\n", "\n")
--
1.5.3.rc3.91.g5c75
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2007-08-07 8:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 8:25 Simon Hausmann [this message]
2007-08-07 8:40 ` [PATCH] git-p4: Fix support for symlinks Junio C Hamano
2007-08-07 9:10 ` Brian Swetland
2007-08-08 1:36 ` Scott Lamb
-- strict thread matches above, loose matches on Subject: below --
2007-08-07 10:28 Simon Hausmann
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=200708071025.47965.simon@lst.de \
--to=simon@lst.de \
--cc=git@vger.kernel.org \
--cc=hanwen@google.com \
--cc=swetland@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).