Re: [PATCH v1 2/2] git-p4: fix Git LFS pointer parsing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 19, 2016, 20:30 UTC
- Message-ID
- <xmqqtwixz6i4.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1461096530-82448-3-git-send-email-larsxschneider@gmail.com>
larsxschneider@gmail.com writes:
Show 5 quoted lines
> 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.
Hmph, adjust to operate with both, or drop the support for the old one?
Show 49 quoted lines
>
> [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