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

[PATCH v1 2/2] git-p4: fix Git LFS pointer parsing

From
larsxschneider@gmail.com <larsxschneider@gmail.com>
Date
Apr 19, 2016, 20:08 UTC
Message-ID
<1461096530-82448-3-git-send-email-larsxschneider@gmail.com>
In-Reply-To
<1461096530-82448-1-git-send-email-larsxschneider@gmail.com>
From: Lars Schneider <larsxschneider@gmail.com>

Git LFS 1.2.0 removed a line from the output of the 'git lfs pointer' command [1] which broke the parsing of this output. Adjust the parser to the new output and add minimum Git LFS version to the docs.

[1] https://github.com/github/git-lfs/pull/1105
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
 Documentation/git-p4.txt | 3 ++-
 git-p4.py                | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index 88ba42b..b862cb9 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -522,7 +522,8 @@ git-p4.largeFileSystem::
 	that large file systems do not support the 'git p4 submit' command.
 	Only Git LFS is implemented right now (see https://git-lfs.github.com/
 	for more information). Download and install the Git LFS command line
-	extension to use this option and configure it like this:
+	extension (minimum version 1.2.0) to use this option and configure it
+	like this:
 +
 -------------
 git config       git-p4.largeFileSystem GitLFS
diff --git a/git-p4.py b/git-p4.py
index 527d44b..d2be574 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1064,8 +1064,8 @@ class GitLFS(LargeFileSystem):
         if pointerProcess.wait():
             os.remove(contentFile)
             die('git-lfs pointer command failed. Did you install the extension?')
-        pointerContents = [i+'\n' for i in pointerFile.split('\n')[2:][:-1]]
-        oid = pointerContents[1].split(' ')[1].split(':')[1][:-1]
+        oidEntry = [i for i in pointerFile.split('\n') if i.startswith('oid')]
+        oid = oidEntry[0].split(' ')[1].split(':')[1]
         localLargeFile = os.path.join(
             os.getcwd(),
             '.git', 'lfs', 'objects', oid[:2], oid[2:4],
@@ -1073,7 +1073,7 @@ class GitLFS(LargeFileSystem):
         )
         # LFS Spec states that pointer files should not have the executable bit set.
         gitMode = '100644'
-        return (gitMode, pointerContents, localLargeFile)
+        return (gitMode, pointerFile, localLargeFile)

     def pushFile(self, localLargeFile):
         uploadProcess = subprocess.Popen(
--
2.5.1
Previous: larsxschneider@gmail.comNext: Junio C Hamano
Message 3 of 13 in “git-p4: fix Git LFS pointer parsing”
  1. 0/2 git-p4: fix Git LFS pointer parsinglarsxschneider@gmail.com, Apr 19, 2016
  2. 1/2 travis-ci: update Git-LFS and P4 to the latest versionlarsxschneider@gmail.com, Apr 19, 2016
  3. 2/2 git-p4: fix Git LFS pointer parsinglarsxschneider@gmail.com, Apr 19, 2016
  4. Junio C HamanoApr 19, 2016
  5. Lars SchneiderApr 19, 2016
  6. Junio C HamanoApr 19, 2016
  7. Sebastian SchuberthApr 20, 2016
  8. Junio C HamanoApr 20, 2016
  9. Sebastian SchuberthApr 20, 2016
  10. t9824: fix broken &&-chain in a subshellSZEDER Gábor, Apr 24, 2016
  11. Lars SchneiderApr 24, 2016
  12. SZEDER GáborApr 24, 2016
  13. Lars SchneiderApr 24, 2016

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.