[PATCH] git-p4: Fix support for symlinks.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Simon Hausmann
Date: Tuesday, August 7, 2007 - 1:25 am

Detect symlinks as file type, set the git file mode accordingly and strip o=
ff the trailing newline in the p4 print output.

Signed-off-by: Simon Hausmann <simon@lst.de>
=2D--
 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
=2D-- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -839,11 +839,15 @@ class P4Sync(Command):
             if file["action"] =3D=3D "delete":
                 self.gitStream.write("D %s\n" % relPath)
             else:
+                data =3D file['data']
+
                 mode =3D 644
                 if file["type"].startswith("x"):
                     mode =3D 755
=2D
=2D                data =3D file['data']
+                elif file["type"] =3D=3D "symlink":
+                    mode =3D 120000
+                    # p4 print on a symlink contains "target\n", so strip =
it off
+                    data =3D data[:-1]
=20
                 if self.isWindows and file["type"].endswith("text"):
                     data =3D data.replace("\r\n", "\n")
=2D-=20
1.5.3.rc3.91.g5c75
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git-p4: Fix support for symlinks., Simon Hausmann, (Tue Aug 7, 1:25 am)
Re: [PATCH] git-p4: Fix support for symlinks., Junio C Hamano, (Tue Aug 7, 1:40 am)
Re: [PATCH] git-p4: Fix support for symlinks., Brian Swetland, (Tue Aug 7, 2:10 am)
Re: [PATCH] git-p4: Fix support for symlinks., Scott Lamb, (Tue Aug 7, 6:36 pm)