Git development
 help / color / mirror / Atom feed
From: "David ‘Bombe’ Roden" <bombe@pterodactylus.net>
To: git@vger.kernel.org
Subject: Strange behaviour with git-add, .gitignore and a tracked file
Date: Fri, 16 Dec 2011 22:57:57 +0100	[thread overview]
Message-ID: <201112162258.04661.bombe@pterodactylus.net> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 875 bytes --]

Hi.

I stumbled across some strange behaviour today:

---
git init git-test
cd git-test
echo '*' > .gitignore
git add -f .gitignore
git commit -m "Add gitignore."
mkdir dir
echo a > dir/file
git add -f dir/file
git commit -m "Add dir/file."
echo b >> dir/file
git add dir/file
---

The last git-add results in the following error message:

---
The following paths are ignored by one of your .gitignore files:
dir
Use -f if you really want to add them.
fatal: no files added
---

While it is true that the file specification matches a pattern in .gitignore, 
the file is already tracked and should not be ignored.

This behaviour was reproduced with 1.7.7.4 (on OS X), 1.7.5.4, 1.7.1, 
1.7.8-247-g10f4eb6 (latest master as of a couple of hours ago) (all Linux).


Greetings,

	David
-- 
David ‘Bombe’ Roden <bombe@pterodactylus.net>

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2011-12-16 22:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 21:57 David ‘Bombe’ Roden [this message]
2011-12-16 23:42 ` Strange behaviour with git-add, .gitignore and a tracked file 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=201112162258.04661.bombe@pterodactylus.net \
    --to=bombe@pterodactylus.net \
    --cc=git@vger.kernel.org \
    /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