git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: larsxschneider@gmail.com
To: git@vger.kernel.org
Cc: luke@diamand.org, Lars Schneider <larsxschneider@gmail.com>
Subject: [PATCH v1 2/2] git-p4: fix Git LFS pointer parsing
Date: Tue, 19 Apr 2016 22:08:50 +0200	[thread overview]
Message-ID: <1461096530-82448-3-git-send-email-larsxschneider@gmail.com> (raw)
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

  parent reply	other threads:[~2016-04-19 20:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 20:08 [PATCH v1 0/2] git-p4: fix Git LFS pointer parsing larsxschneider
2016-04-19 20:08 ` [PATCH v1 1/2] travis-ci: update Git-LFS and P4 to the latest version larsxschneider
2016-04-19 20:08 ` larsxschneider [this message]
2016-04-19 20:30   ` [PATCH v1 2/2] git-p4: fix Git LFS pointer parsing Junio C Hamano
2016-04-19 20:54     ` Lars Schneider
2016-04-19 21:04       ` Junio C Hamano
2016-04-20  8:32         ` Sebastian Schuberth
2016-04-20 15:30           ` Junio C Hamano
2016-04-20 15:40             ` Sebastian Schuberth
2016-04-24 11:50 ` [PATCH] t9824: fix broken &&-chain in a subshell SZEDER Gábor
2016-04-24 16:29   ` Lars Schneider
2016-04-24 16:37     ` SZEDER Gábor
2016-04-24 16:50       ` Lars Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461096530-82448-3-git-send-email-larsxschneider@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=luke@diamand.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).