git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* bug with git add and .gitignore
@ 2017-05-10 13:44 Orgad Shaneh
  2017-05-16 19:10 ` Samuel Lijin
  0 siblings, 1 reply; 2+ messages in thread
From: Orgad Shaneh @ 2017-05-10 13:44 UTC (permalink / raw)
  To: git

Hi,

When a not-ignored file inside an ignore directory is added along with
other files, a false alarm is shown:

git init
echo /d/ > .gitignore
mkdir d
touch d/file foo
git add -f d/file foo
git add d/file
# fine
git add d/file foo
# The following paths are ignored by one of your .gitignore files:
# d
# Use -f if you really want to add them.

I did not try to add a new file in d. It's the same file that is
already indexed.

- Orgad

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

* Re: bug with git add and .gitignore
  2017-05-10 13:44 bug with git add and .gitignore Orgad Shaneh
@ 2017-05-16 19:10 ` Samuel Lijin
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Lijin @ 2017-05-16 19:10 UTC (permalink / raw)
  To: Orgad Shaneh; +Cc: git

On Wed, May 10, 2017 at 9:44 AM, Orgad Shaneh <orgads@gmail.com> wrote:
> Hi,
>
> When a not-ignored file inside an ignore directory is added along with
> other files, a false alarm is shown:
>
> git init
> echo /d/ > .gitignore
> mkdir d
> touch d/file foo
> git add -f d/file foo
> git add d/file
> # fine
> git add d/file foo
> # The following paths are ignored by one of your .gitignore files:
> # d
> # Use -f if you really want to add them.

For anyone who wants to take a shot at this, the reason this happens
is because when "add d/file foo" is invoked, when add.c:cmd_add()
calls fill_directory(), d/ gets added to dir->ignored, so add_files()
complains. I'm not sure if that's *supposed* to happen, and the issue
is somewhere else, or the call to read_directory_recursive() from
fill_directory() doesn't properly respect the pathspec.

> I did not try to add a new file in d. It's the same file that is
> already indexed.
>
> - Orgad

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

end of thread, other threads:[~2017-05-16 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 13:44 bug with git add and .gitignore Orgad Shaneh
2017-05-16 19:10 ` Samuel Lijin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).