git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Regression in `git add' in 1.7's 48ffef966c with a wildcard in  .gitignore
Date: Mon, 8 Mar 2010 17:08:23 +0000	[thread overview]
Message-ID: <51dd1af81003080908i3bc94f27lc99e146bb57993ba@mail.gmail.com> (raw)

I've discovered a regression in git-add the 1.7 release which I can't
see reported anywhere. It was introduced in
48ffef966c762578eb818c0c54a7e11dd054f5db by Junio C Hamano at Fri Jan
8 23:05:41 2010.

The problem is that when you have a .gitignore file with * in it
git-add will only complain that you're trying to add ignored files if
they're in the top level of your repository, for files in
subdirectories it now just silently fails:

    $ mkdir test && cd test && git init
    $ echo "*" > .gitignore
    $ mkdir directory && touch foo directory/foo

So far so good, now if I try to add 'foo' I get an error from both 1.6 and 1.7:

    $ git add foo
    The following paths are ignored by one of your .gitignore files:
    foo

But 1.7 just silently fails to add directory/foo to the index:

    $ git add directory/foo
    $ echo $?
    0

1.6 however does the right thing:

    $ git add directory/foo
    The following paths are ignored by one of your .gitignore files:
    directory/foo
    $ echo $?
    128

A test script / bisect script I used is available at
git://github.com/avar/git-add-fail.git I couldn't figure out how to
turn it into a Git test.

             reply	other threads:[~2010-03-08 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08 17:08 Ævar Arnfjörð Bjarmason [this message]
2010-03-08 20:06 ` Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore Michael J Gruber
2010-03-08 20:21   ` Ævar Arnfjörð Bjarmason
2010-03-08 20:20 ` Junio C Hamano

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=51dd1af81003080908i3bc94f27lc99e146bb57993ba@mail.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).