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 <panzercheg@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
r.burenkov 2019-12-11 09:47:23 -08:00 коммит произвёл Junio C Hamano
Родитель 53a06cf39b
Коммит ea94b16fb8
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1257,9 +1257,15 @@ class GitLFS(LargeFileSystem):
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 = gitConfig('lfs.storage')
if not lfs_path:
lfs_path = 'lfs'
if not os.path.isabs(lfs_path):
lfs_path = os.path.join(os.getcwd(), '.git', lfs_path)
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.