From: "Carlos Martín Nieto" <cmn@elego.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH] dir: allow a BOM at the beginning of exclude files
Date: Thu, 16 Apr 2015 20:27:43 +0200 [thread overview]
Message-ID: <1429208863.3097.19.camel@elego.de> (raw)
In-Reply-To: <xmqqoamohu2m.fsf@gitster.dls.corp.google.com>
On Thu, 2015-04-16 at 10:16 -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > On Thu, Apr 16, 2015 at 08:39:55AM -0700, Junio C Hamano wrote:
> >
> >> > test_expect_success 'status untracked directory with --ignored' '
> >> > echo "ignored" >.gitignore &&
> >> > + sed -e "s/^/\xef\xbb\xbf/" .gitignore >.gitignore.new &&
> >> > + mv .gitignore.new .gitignore &&
> >>
> >> Is this "write literal in \xHEX on the replacement side of sed
> >> substitution" potable? In any case, replacing the above three with
> >> something like:
> >>
> >> printf "<bom>ignored\n" >.gitignore
> >>
> >> may be more sensible, no?
> >
> > I'm not sure about sed, but I agree it is suspect. And note that printf
> > with hex codes is not portable, either You have to use octal:
> >
> > printf '\357\273\277ignored\n' >.gitignore
> >
> > Also, as a nit, I'd much rather see this in its own test rather than
> > crammed into another test_expect_success. It's much easier to diagnose
> > failures if the test description mentions the goal, and it is not tied
> > up with testing other parts that might fail.
>
> Yeah, I totally agree.
>
> Carlos, something like this squashed in, perhaps?
>
> t/t7061-wtstatus-ignore.sh | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
> index 0a06fbf..cdc0747 100755
> --- a/t/t7061-wtstatus-ignore.sh
> +++ b/t/t7061-wtstatus-ignore.sh
> @@ -13,8 +13,6 @@ EOF
>
> test_expect_success 'status untracked directory with --ignored' '
> echo "ignored" >.gitignore &&
> - sed -e "s/^/\xef\xbb\xbf/" .gitignore >.gitignore.new &&
> - mv .gitignore.new .gitignore &&
> mkdir untracked &&
> : >untracked/ignored &&
> : >untracked/uncommitted &&
> @@ -22,6 +20,15 @@ test_expect_success 'status untracked directory with --ignored' '
> test_cmp expected actual
> '
>
> +test_expect_success 'same with gitignore starting with BOM' '
> + printf "\357\273\277ignored\n" >.gitignore &&
> + mkdir -p untracked &&
> + : >untracked/ignored &&
> + : >untracked/uncommitted &&
> + git status --porcelain --ignored >actual &&
> + test_cmp expected actual
> +'
> +
> cat >expected <<\EOF
> ?? .gitignore
> ?? actual
>
Yeah, that makes sense. I had something similar in my patch at one point
before going with modifying the current one.
cmn
next prev parent reply other threads:[~2015-04-16 18:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-16 14:05 [PATCH] dir: allow a BOM at the beginning of exclude files Carlos Martín Nieto
2015-04-16 15:03 ` Johannes Schindelin
2015-04-16 15:09 ` Carlos Martín Nieto
2015-04-16 15:10 ` Carlos Martín Nieto
2015-04-16 15:39 ` Junio C Hamano
2015-04-16 15:55 ` Jeff King
2015-04-16 17:16 ` Junio C Hamano
2015-04-16 17:52 ` [PATCH 0/3] UTF8 BOM follow-up Junio C Hamano
2015-04-16 17:52 ` [PATCH 1/3] utf8-bom: introduce skip_utf8_bom() helper Junio C Hamano
2015-04-16 18:14 ` Jeff King
2015-04-16 18:23 ` Junio C Hamano
2015-04-16 17:52 ` [PATCH 2/3] config: use utf8_bom[] from utf.[ch] in git_parse_source() Junio C Hamano
2015-04-16 17:52 ` [PATCH 3/3] attr: skip UTF8 BOM at the beginning of the input file Junio C Hamano
2015-04-16 18:27 ` Carlos Martín Nieto [this message]
2015-04-16 18:39 ` [PATCH v2 0/4] UTF8 BOM follow-up Junio C Hamano
2015-04-16 18:39 ` [PATCH v2 1/4] add_excludes_from_file: clarify the bom skipping logic Junio C Hamano
2015-04-16 18:39 ` [PATCH v2 2/4] utf8-bom: introduce skip_utf8_bom() helper Junio C Hamano
2015-04-16 18:39 ` [PATCH v2 3/4] config: use utf8_bom[] from utf.[ch] in git_parse_source() Junio C Hamano
2015-04-16 18:39 ` [PATCH v2 4/4] attr: skip UTF8 BOM at the beginning of the input file Junio C Hamano
2015-04-16 19:26 ` [PATCH v2 0/4] UTF8 BOM follow-up Jeff King
2015-04-17 22:44 ` Karsten Blees
2015-04-20 21:50 ` Junio C Hamano
2015-04-16 16:08 ` [PATCH] dir: allow a BOM at the beginning of exclude files Johannes Schindelin
2015-04-16 16:10 ` Torsten Bögershausen
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=1429208863.3097.19.camel@elego.de \
--to=cmn@elego.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).