From: Junio C Hamano <gitster@pobox•com>
To: Jim Hill <gjthill@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v2] sha1_file: pass empty buffer to index empty file
Date: Sat, 16 May 2015 11:48:14 -0700 [thread overview]
Message-ID: <xmqqa8x4fjf5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150515233153.GA4157@gadabout.domain.actdsltmp> (Jim Hill's message of "Fri, 15 May 2015 16:31:53 -0700")
Jim Hill <gjthill@gmail•com> writes:
> So, so long as we're testing empty-file filters, I figured I'd add real
> empty-file filter tests, I think that covers it.
>
> So is this better instead?
I wouldn't use "---in-repo-header--" as that extra string. Feeding
anything that begins with '-' to 'echo' gives me portability worries
for one thing. A single word "Extra" would suffice.
Be careful and consistent wrt redirection operator and its file; we
do not write SP there but some of yours do and some others don't.
Do not attempt to align && with excess SPs; other tests don't.
Other than that, yeah, I think that is an improvement.
Thanks.
>
> diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
> index 5986bb0..fc2c644 100755
> --- a/t/t0021-conversion.sh
> +++ b/t/t0021-conversion.sh
> @@ -216,15 +216,33 @@ test_expect_success EXPENSIVE 'filter large file' '
> ! test -s err
> '
>
> -test_expect_success "filtering empty file should not produce complaints" '
> - echo "emptyfile filter=cat" >>.gitattributes &&
> - git config filter.cat.clean cat &&
> - git config filter.cat.smudge cat &&
> - git add . &&
> - git commit -m "cat filter for emptyfile" &&
> - > emptyfile &&
> - git add emptyfile 2>err &&
> - ! grep -Fiqs "bad file descriptor" err
> +test_expect_success "filter: clean empty file" '
> + header=---in-repo-header--- &&
> + git config filter.in-repo-header.clean "echo $header && cat" &&
> + git config filter.in-repo-header.smudge "sed 1d" &&
> +
> + echo "empty-in-worktree filter=in-repo-header" >>.gitattributes &&
> + > empty-in-worktree &&
> +
> + echo $header > expected &&
> + git add empty-in-worktree &&
> + git show :empty-in-worktree > actual &&
> + test_cmp expected actual
> +'
> +
> +test_expect_success "filter: smudge empty file" '
> + git config filter.empty-in-repo.smudge "echo smudge added line && cat" &&
> + git config filter.empty-in-repo.clean true &&
> +
> + echo "empty-in-repo filter=empty-in-repo" >>.gitattributes &&
> +
> + echo dead data walking > empty-in-repo &&
> + git add empty-in-repo &&
> +
> + : > expected &&
> + git show :empty-in-repo > actual &&
> + test_cmp expected actual
> '
>
> test_done
> +
next prev parent reply other threads:[~2015-05-16 18:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 17:23 [PATCH] sha1_file: pass empty buffer to index empty file Jim Hill
2015-05-14 18:43 ` Junio C Hamano
2015-05-14 23:17 ` [PATCH v2] " Jim Hill
2015-05-15 18:01 ` Junio C Hamano
2015-05-15 23:31 ` Jim Hill
2015-05-16 18:48 ` Junio C Hamano [this message]
2015-05-16 20:06 ` [PATCH v3] " Jim Hill
2015-05-16 23:22 ` Junio C Hamano
2015-05-17 17:37 ` Junio C Hamano
2015-05-17 19:10 ` Junio C Hamano
2015-05-18 0:41 ` [PATCH v4] " Jim Hill
2015-05-19 6:37 ` [PATCH v3] " Jeff King
2015-05-19 18:11 ` Junio C Hamano
2015-05-19 18:17 ` Junio C Hamano
2015-05-19 18:35 ` Junio C Hamano
2015-05-19 19:48 ` Junio C Hamano
2015-05-19 22:14 ` Jeff King
2015-05-20 17:03 ` Junio C Hamano
2015-05-19 19:40 ` Eric Sunshine
2015-05-19 22:09 ` Jeff King
2015-05-20 17:25 ` Junio C Hamano
2015-05-20 17:38 ` Jeff King
2015-05-14 23:26 ` [PATCH] " Jim Hill
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=xmqqa8x4fjf5.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gjthill@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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