Skip to content

Commit ea94b16

Browse files
panzercheggitster
authored andcommitted
git-p4: honor lfs.storage configuration variable
"git lfs" allows users to specify the custom storage location with the configuration variable `lfs.storage`, but when interacting with GitLFS pointers, "git p4" always uses the hardcoded default that is the `.git/lfs/` directory, without paying attention to the configuration. Use the value configured in `lfs.storage`, if exists, as all the "git" operations do, for consistency. Signed-off-by: r.burenkov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53a06cf commit ea94b16

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

git-p4.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,9 +1257,15 @@ def generatePointer(self, contentFile):
12571257
pointerFile = re.sub(r'Git LFS pointer for.*\n\n', '', pointerFile)
12581258

12591259
oid = re.search(r'^oid \w+:(\w+)', pointerFile, re.MULTILINE).group(1)
1260+
# if someone use external lfs.storage ( not in local repo git )
1261+
lfs_path = gitConfig('lfs.storage')
1262+
if not lfs_path:
1263+
lfs_path = 'lfs'
1264+
if not os.path.isabs(lfs_path):
1265+
lfs_path = os.path.join(os.getcwd(), '.git', lfs_path)
12601266
localLargeFile = os.path.join(
1261-
os.getcwd(),
1262-
'.git', 'lfs', 'objects', oid[:2], oid[2:4],
1267+
lfs_path,
1268+
'objects', oid[:2], oid[2:4],
12631269
oid,
12641270
)
12651271
# LFS Spec states that pointer files should not have the executable bit set.

0 commit comments

Comments
 (0)