summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-10 13:40:29 -0700
committerJunio C Hamano <gitster@pobox.com>2016-05-10 13:40:29 -0700
commit7a959426b61e673032861f7a89ce9c5254bd5830 (patch)
treec9196073c02b64935b55b7ba71e3d27aff4f5f43 /git-p4.py
parent934908ae5bcd7b9944d925f73e05c60b2687c8b7 (diff)
parent82f2567e3d01a6eeb4c6a0b9139232034de6e60f (diff)
downloadgit-7a959426b61e673032861f7a89ce9c5254bd5830.tar.gz
Merge branch 'ls/p4-lfs'
Recent update to Git LFS broke "git p4" by changing the output from its "lfs pointer" subcommand. * ls/p4-lfs: git-p4: fix Git LFS pointer parsing travis-ci: express Linux/OS X dependency versions more clearly travis-ci: update Git-LFS and P4 to the latest version
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/git-p4.py b/git-p4.py
index 8f869d74a1..b6593cf9a1 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1064,8 +1064,15 @@ class GitLFS(LargeFileSystem):
if pointerProcess.wait():
os.remove(contentFile)
die('git-lfs pointer command failed. Did you install the extension?')
- pointerContents = [i+'\n' for i in pointerFile.split('\n')[2:][:-1]]
- oid = pointerContents[1].split(' ')[1].split(':')[1][:-1]
+
+ # Git LFS removed the preamble in the output of the 'pointer' command
+ # starting from version 1.2.0. Check for the preamble here to support
+ # earlier versions.
+ # c.f. https://github.com/github/git-lfs/commit/da2935d9a739592bc775c98d8ef4df9c72ea3b43
+ if pointerFile.startswith('Git LFS pointer for'):
+ pointerFile = re.sub(r'Git LFS pointer for.*\n\n', '', pointerFile)
+
+ oid = re.search(r'^oid \w+:(\w+)', pointerFile, re.MULTILINE).group(1)
localLargeFile = os.path.join(
os.getcwd(),
'.git', 'lfs', 'objects', oid[:2], oid[2:4],
@@ -1073,7 +1080,7 @@ class GitLFS(LargeFileSystem):
)
# LFS Spec states that pointer files should not have the executable bit set.
gitMode = '100644'
- return (gitMode, pointerContents, localLargeFile)
+ return (gitMode, pointerFile, localLargeFile)
def pushFile(self, localLargeFile):
uploadProcess = subprocess.Popen(