All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marko Poutiainen <regs@sofistes.net>
To: git@vger.kernel.org
Subject: Gitignore matching "git add" wildcard prevents operation
Date: Thu, 14 Jan 2010 20:18:40 +0200	[thread overview]
Message-ID: <4B4F6000.4070005@sofistes.net> (raw)

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

             reply	other threads:[~2010-01-14 18:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 18:18 Marko Poutiainen [this message]
2010-01-14 19:52 ` Gitignore matching "git add" wildcard prevents operation 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

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=4B4F6000.4070005@sofistes.net \
    --to=regs@sofistes.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.