summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3671757)
raw | patch | inline | side by side (parent: 3671757)
author | Simon Hausmann <simon@lst.de> | |
Tue, 7 Aug 2007 10:28:00 +0000 (12:28 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 8 Aug 2007 08:58:05 +0000 (01:58 -0700) |
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Make the mode handling a bit more readable at the same time.
Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make the mode handling a bit more readable at the same time.
Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4 | patch | blob | history |
index 41e86e76cb9e4718c87185fc0b25e630ad091939..3cbb2da221618a67fda6991317352e330c6db8ba 100755 (executable)
if file["action"] == "delete":
self.gitStream.write("D %s\n" % relPath)
else:
- mode = 644
- if file["type"].startswith("x"):
- mode = 755
-
data = file['data']
+ mode = "644"
+ if file["type"].startswith("x"):
+ mode = "755"
+ 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")
- self.gitStream.write("M %d inline %s\n" % (mode, relPath))
+ self.gitStream.write("M %s inline %s\n" % (mode, relPath))
self.gitStream.write("data %s\n" % len(data))
self.gitStream.write(data)
self.gitStream.write("\n")