aboutsummaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-12-16 15:27:49 -0800
committerJunio C Hamano <gitster@pobox.com>2016-12-16 15:27:49 -0800
commit796bd3bb2ac98e6aa4cb9afccc18c3056f795196 (patch)
treefd9d50c806c723df590f2253a834ea88a6fc7b54 /git-p4.py
parent031b5a9ad3e666554c321b34c4d6b63d04bdd9b3 (diff)
parentd5eb3cf5e7e4274e12e0f249b3a026c029f3b02c (diff)
downloadgit-796bd3bb2ac98e6aa4cb9afccc18c3056f795196.tar.gz
git-796bd3bb2ac98e6aa4cb9afccc18c3056f795196.tar.xz
Merge branch 'ls/p4-empty-file-on-lfs'
"git p4" LFS support was broken when LFS stores an empty blob. * ls/p4-empty-file-on-lfs: git-p4: fix empty file processing for large file system backend GitLFS
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/git-p4.py b/git-p4.py
index bc0fcdf90..1d4bfe64e 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1009,18 +1009,20 @@ class LargeFileSystem(object):
steps."""
if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath):
contentTempFile = self.generateTempFile(contents)
- (git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile)
-
- # Move temp file to final location in large file system
- largeFileDir = os.path.dirname(localLargeFile)
- if not os.path.isdir(largeFileDir):
- os.makedirs(largeFileDir)
- shutil.move(contentTempFile, localLargeFile)
- self.addLargeFile(relPath)
- if gitConfigBool('git-p4.largeFilePush'):
- self.pushFile(localLargeFile)
- if verbose:
- sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile))
+ (pointer_git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile)
+ if pointer_git_mode:
+ git_mode = pointer_git_mode
+ if localLargeFile:
+ # Move temp file to final location in large file system
+ largeFileDir = os.path.dirname(localLargeFile)
+ if not os.path.isdir(largeFileDir):
+ os.makedirs(largeFileDir)
+ shutil.move(contentTempFile, localLargeFile)
+ self.addLargeFile(relPath)
+ if gitConfigBool('git-p4.largeFilePush'):
+ self.pushFile(localLargeFile)
+ if verbose:
+ sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile))
return (git_mode, contents)
class MockLFS(LargeFileSystem):
@@ -1060,6 +1062,9 @@ class GitLFS(LargeFileSystem):
the actual content. Return also the new location of the actual
content.
"""
+ if os.path.getsize(contentFile) == 0:
+ return (None, '', None)
+
pointerProcess = subprocess.Popen(
['git', 'lfs', 'pointer', '--file=' + contentFile],
stdout=subprocess.PIPE