Skip to content

Commit

Permalink
git-p4: use lfs.storage instead of local .git/lfs
Browse files Browse the repository at this point in the history
Use lfs.storage if it defined in git.config.
If lfs.storage not define - used local .git/lfs.
Original code uses local .git/lfs in sync/clone operations,
but if you have external lfs storage better to use it.

Signed-off-by: r.burenkov <panzercheg@gmail.com>
  • Loading branch information
panzercheg committed Dec 4, 2019
1 parent d9f6f3b commit 73d0dfc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-p4.py
Expand Up @@ -1257,9 +1257,13 @@ def generatePointer(self, contentFile):
pointerFile = re.sub(r'Git LFS pointer for.*\n\n', '', pointerFile)

oid = re.search(r'^oid \w+:(\w+)', pointerFile, re.MULTILINE).group(1)
# if someone use external lfs.storage ( not in local repo git )
lfs_path = os.path.join(os.getcwd(), '.git', 'lfs')
if gitConfig('lfs.storage'):
lfs_path = gitConfig('lfs.storage')
localLargeFile = os.path.join(
os.getcwd(),
'.git', 'lfs', 'objects', oid[:2], oid[2:4],
lfs_path,
'objects', oid[:2], oid[2:4],
oid,
)
# LFS Spec states that pointer files should not have the executable bit set.
Expand Down

0 comments on commit 73d0dfc

Please sign in to comment.