From: Sebastian Schuberth <sschuberth@gmail.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
ben.woosley@gmail.com
Subject: Re: [PATCH v3 3/3] git-p4: fix Git LFS pointer parsing
Date: Mon, 25 Apr 2016 09:35:48 +0200 [thread overview]
Message-ID: <CAHGBnuO16Y2b3G5pyuG59b+vojRGe_wySmUcAUka9eT2opABdA@mail.gmail.com> (raw)
In-Reply-To: <8340C6E5-C774-46EE-A1F9-1C4C7DF9CEB9@gmail.com>
On Mon, Apr 25, 2016 at 9:33 AM, Lars Schneider
<larsxschneider@gmail.com> wrote:
>> if you're omitting lines from the output. Also, the regex matches
>> against the whole multi-line string. That is, if the file for some
>> reason was ending in '\n\n' instead of just '\n', the '.*' would match
>> almost all content of the pointer file, not just the remains of the
>> preamble. One way to fix this would be to use
>>
>> re.sub(r'Git LFS pointer for [^\n]+\n\n', '', pointerFile)
>>
>> instead.
>
> In general you are right as "*" is greedy. However, in Python "." matches any
> character except a newline [1]. Therefore I think the regex is correct.
Ah, thanks for pointing that out. Looks ok to me then.
> Nevertheless... thanks for making me read the line again. I forgot to
> assign the pointerFile variable in the version I sent around :-(
>
> This is how it should be:
>
> pointerFile = re.sub(r'Git LFS pointer for.*\n\n', '', pointerFile)
Right. Good you've catched that!
--
Sebastian Schuberth
prev parent reply other threads:[~2016-04-25 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-24 18:58 [PATCH v3 0/3] git-p4: fix Git LFS pointer parsing larsxschneider
2016-04-24 18:58 ` [PATCH v3 1/3] travis-ci: update Git-LFS and P4 to the latest version larsxschneider
2016-04-24 18:58 ` [PATCH v3 2/3] travis-ci: express Linux/OS X dependency versions more clearly larsxschneider
2016-04-25 4:40 ` Eric Sunshine
2016-04-25 7:05 ` Lars Schneider
2016-04-24 18:58 ` [PATCH v3 3/3] git-p4: fix Git LFS pointer parsing larsxschneider
2016-04-24 19:16 ` Sebastian Schuberth
2016-04-25 7:33 ` Lars Schneider
2016-04-25 7:35 ` Sebastian Schuberth [this message]
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=CAHGBnuO16Y2b3G5pyuG59b+vojRGe_wySmUcAUka9eT2opABdA@mail.gmail.com \
--to=sschuberth@gmail.com \
--cc=ben.woosley@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=larsxschneider@gmail.com \
/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).