git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/1] "git lfs" allows users to specify the custom storage location by configuration variable lfs.storage, but when "git p4" interacts with GitLFS pointers, it always used the hardcoded default that is the .git/lfs/ directory, without paying attention to the configuration.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 11, 2019, 17:47 UTC
Message-ID
<xmqq8snipxec.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.1912101317340.31080@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 27 quoted lines
> On Mon, 9 Dec 2019, Junio C Hamano wrote:
>
>> "panzercheg via GitGitGadget" <gitgitgadget@gmail.com> writes:
>>
>> >Subject: Re: [PATCH v2 1/1] "git lfs" allows users to specify the custom storage location by configuration variable lfs.storage, but when "git p4" interacts with GitLFS pointers, it always used the hardcoded default that is the .git/lfs/ directory, without paying attention to the configuration.
>>
>> Oops, what happened here?
>>
>> I wonder/I wish if GGG can be a bit more helpful when seeing a
>> commit that looks "strange".
>
> There is already a ticket about that:
> https://github.com/gitgitgadget/gitgitgadget/issues/120
>
> All it requires is a contributor with a little time :-)
>
>> > From: panzercheg <panzercheg@gmail.com>
>> >
>> > 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>
>>
>> Please make sure that the name/email as the author matches whom you
>> sign-off the patch as.
>
> This, too, should be addressed as part of above-mentioned ticket.

Tooling improvement is fine, but let's not sink too much time on tangents and steal time from *this* patch.

Would the following version (which I munged by hand) be close enough to what the author would have sent out in the ideal world? If so, let's queue it.

-- >8 --
Subject: git-p4: honor lfs.storage configuration variable
From: r.burenkov <panzercheg@gmail.com>

"git lfs" allows users to specify the custom storage location by the configuration variable `lfs.storage`, but when "git p4" interacts with GitLFS pointers, it 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>
---
 git-p4.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index 60c73b6a37..0b3a07cb31 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1257,9 +1257,15 @@ 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 = 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.
-- 
gitgitgadget
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 9 of 10 in “git-p4: use lfs.storage instead of local .git/lfs”
  1. 0/1 git-p4: use lfs.storage instead of local .git/lfsr.burenkov via GitGitGadget, Dec 4, 2019
  2. 1/1 git-p4: use lfs.storage instead of local .git/lfs 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.panzercheg via GitGitGadget, Dec 4, 2019
  3. Junio C HamanoDec 4, 2019
  4. 0/1 git-p4: use lfs.storage instead of local .git/lfsr.burenkov via GitGitGadget, Dec 9, 2019
  5. 1/1 "git lfs" allows users to specify the custom storage location by configuration variable lfs.storage, but when "git p4" interacts with GitLFS pointers, it always used the hardcoded default that is the .git/lfs/ directory, without paying attention to the configuration.panzercheg via GitGitGadget, Dec 9, 2019
  6. Junio C HamanoDec 9, 2019
  7. Eric SunshineDec 9, 2019
  8. Johannes SchindelinDec 10, 2019
  9. Junio C HamanoDec 11, 2019
  10. Johannes SchindelinDec 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.