git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Gitignore matching "git add" wildcard prevents operation
@ 2010-01-14 18:18 Marko Poutiainen
  2010-01-14 19:52 ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: Marko Poutiainen @ 2010-01-14 18:18 UTC (permalink / raw)
  To: git

It seems that that there is a bug related to how Git handles the add
command with wildcards if the wildcard also matches a file that is ignored.

E.g (I activate the *.[ao] rule when editing .git/info/exclude):

mep@Blackbird:~$ cd /tmp
mep@Blackbird:/tmp$ mkdir git
mep@Blackbird:/tmp$ cd git
mep@Blackbird:/tmp/git$ git init
Initialized empty Git repository in /tmp/git/.git/
mep@Blackbird:/tmp/git$ nano -w .git/info/exclude
mep@Blackbird:/tmp/git$ touch a.o a.c a.h
mep@Blackbird:/tmp/git$ git add a.*
The following paths are ignored by one of your .gitignore files:
a.o
Use -f if you really want to add them.
fatal: no files added
mep@Blackbird:/tmp/git$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       a.c
#       a.h
#       a.o
nothing added to commit but untracked files present (use "git add" to track)

Furthermore:

mep@Blackbird:/tmp/git$ git add .
mep@Blackbird:/tmp/git$ git commit -m "foo"
[master (root-commit) 43da825] foo
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a.c
 create mode 100644 a.h
mep@Blackbird:/tmp/git$ nano a.c
mep@Blackbird:/tmp/git$ nano a.h
mep@Blackbird:/tmp/git$ git add a.*
The following paths are ignored by one of your .gitignore files:
a.o
Use -f if you really want to add them.
fatal: no files added
mep@Blackbird:/tmp/git$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
directory)
#
#       modified:   a.c
#       modified:   a.h
#
no changes added to commit (use "git add" and/or "git commit -a")

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

end of thread, other threads:[~2010-01-15 18:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 18:18 Gitignore matching "git add" wildcard prevents operation Marko Poutiainen
2010-01-14 19:52 ` Jeff King
2010-01-14 20:21   ` Junio C Hamano
2010-01-14 20:39     ` Jeff King
2010-01-15 15:34       ` Nicolas Sebrecht
2010-01-15 15:48         ` Jeff King
2010-01-15 16:11           ` Nicolas Sebrecht
2010-01-15 16:30             ` Jeff King
2010-01-15 18:06               ` Nicolas Sebrecht
2010-01-15 18:17             ` Junio C Hamano
2010-01-14 21:07   ` Marko Poutiainen
2010-01-15 15:39     ` Nicolas Sebrecht

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).