public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jeff King <peff@peff•net>
To: Michael J Gruber <git@drmicha•warpmail.net>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>
Subject: Re: [PATCHv2] add: ignore only ignored files
Date: Fri, 21 Nov 2014 13:01:05 -0500	[thread overview]
Message-ID: <20141121180105.GB26650@peff.net> (raw)
In-Reply-To: <b4834f562679d7ccad683463edc61db5ea962d8d.1416585536.git.git@drmicha.warpmail.net>

On Fri, Nov 21, 2014 at 05:08:19PM +0100, Michael J Gruber wrote:

> "git add foo bar" adds neither foo nor bar when bar is ignored, but dies
> to let the user recheck their command invocation. This becomes less
> helpful when "git add foo.*" is subject to shell expansion and some of
> the expanded files are ignored.
> 
> "git add --ignore-errors" is supposed to ignore errors when indexing
> some files and adds the others. It does ignore errors from actual
> indexing attempts, but does not ignore the error "file is ignored" as
> outlined above. This is unexpected.
> 
> Change "git add foo bar" to add foo when bar is ignored, but issue
> a warning and return a failure code as before the change.
> 
> That is, in the case of trying to add ignored files we now act the same
> way (with or without "--ignore-errors") in which we act for more
> severe indexing errors when "--ignore-errors" is specified.

Thanks, this looks pretty good to me. I agree with Junio's sense that we
should cook it extra long to give people time to react.

> My sincere thanks go out to Jeff without whom I could not possibly
> have come up with a patch like this :)

:) Sorry if I was being obnoxious before. Sometimes contributors need a
gentle push to keep going, but I should know by now that you are not
such a person.

> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
> index fe274e2..f7ff1f5 100755
> --- a/t/t3700-add.sh
> +++ b/t/t3700-add.sh
> @@ -91,6 +91,13 @@ test_expect_success 'error out when attempting to add ignored ones without -f' '
>  	! (git ls-files | grep "\\.ig")
>  '
>  
> +test_expect_success 'error out when attempting to add ignored ones but add others' '
> +	touch a.if &&
> +	test_must_fail git add a.?? &&
> +	! (git ls-files | grep "\\.ig") &&
> +	(git ls-files | grep a.if)
> +'

I am somewhat allergic to pipes in our test suite, because they can mask
errors (especially with a negated grep, because we do not know if they
correctly produced any output at all). But I guess this is matching the
surrounding code, and it is quite unlikely for `ls-files` to fail in any
meaningful way here. So I think it's fine.

-Peff

  reply	other threads:[~2014-11-21 18:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 14:52 [RFD/PATCH] add: ignore only ignored files Michael J Gruber
2014-11-19 18:51 ` Junio C Hamano
2014-11-19 19:15 ` Jeff King
2014-11-19 21:43   ` Junio C Hamano
2014-11-20  9:42     ` Michael J Gruber
2014-11-20 15:56       ` Jeff King
2014-11-20 17:23         ` Junio C Hamano
2014-11-20 18:20           ` Jeff King
2014-11-21 15:39             ` Michael J Gruber
2014-11-21 16:08               ` [PATCHv2] " Michael J Gruber
2014-11-21 18:01                 ` Jeff King [this message]
2014-11-22 14:59                   ` Torsten Bögershausen
2014-11-22 19:19                     ` Jeff King
2014-11-22 21:20                       ` Torsten Bögershausen
2014-11-23 19:50                         ` Jeff King
2014-11-23 18:10                       ` Junio C Hamano
2014-11-23 19:46                         ` Jeff King
2014-11-24 17:41                           ` Junio C Hamano
2014-11-24 20:22                             ` Torsten Bögershausen
2014-11-25  3:57                             ` Jeff King
2014-11-24 10:29                     ` Michael J Gruber
2014-11-24 10:23                   ` Michael J Gruber

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=20141121180105.GB26650@peff.net \
    --to=peff@peff$(echo .)net \
    --cc=git@drmicha$(echo .)warpmail.net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(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