Git development
 help / color / mirror / Atom feed
* Strange behaviour with git-add, .gitignore and a tracked file
@ 2011-12-16 21:57 David ‘Bombe’ Roden
  2011-12-16 23:42 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: David ‘Bombe’ Roden @ 2011-12-16 21:57 UTC (permalink / raw)
  To: git

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-16 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 21:57 Strange behaviour with git-add, .gitignore and a tracked file David ‘Bombe’ Roden
2011-12-16 23:42 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox