Fixed the check to make sure to exclude the HEAD symbolic refs when updating
[gitweb.git] / contrib / fast-import / git-p4
index 36fe69a79540029a83f4e31a5b980523e49b96d1..d03ba0b6ad4c570e33d45538ee9e3ec84d18c4ef 100755 (executable)
@@ -718,6 +718,11 @@ class P4Sync(Command):
                 text += filedata[j]['data']
                 j += 1
 
+
+            if not stat.has_key('depotFile'):
+                sys.stderr.write("p4 print fails with: %s\n" % repr(stat))
+                continue
+
             contents[stat['depotFile']] = text
 
         for f in files:
@@ -943,9 +948,9 @@ class P4Sync(Command):
             if not line.startswith('p4/') or line == "p4/HEAD":
                 continue
             branch = line
-            if self.importIntoRemotes:
-                # strip off p4
-                branch = re.sub ("^p4/", "", line)
+
+            # strip off p4
+            branch = re.sub ("^p4/", "", line)
 
             self.p4BranchesInGit.append(branch)
             self.initialParents[self.refPrefix + branch] = parseRevision(line)
@@ -957,7 +962,7 @@ class P4Sync(Command):
 
         for line in read_pipe_lines("git rev-parse --symbolic --remotes"):
             line = line.strip()
-            if (not line.startswith("origin/")) or line.endswith("HEAD\n"):
+            if (not line.startswith("origin/")) or line.endswith("HEAD"):
                 continue
 
             headName = line[len("origin/"):]