git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] git-add: add ignored files when asked explicitly.

From
Andreas Ericsson <ae@op5.se>
Date
Jan 4, 2007, 13:58 UTC
Message-ID
<459D0821.10204@op5.se>
In-Reply-To
<7vslf3khsc.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 15 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
>> On Mon, 25 Dec 2006, Junio C Hamano wrote:
>>
>>>     $ git add foo.o
>>>     $ git add '*.o'
>> Most people do
>>
>> 	$ git add *.o
>>
>> instead, where bash expands the expression. Maybe this new behaviour 
>> should be hidden between a "-f" option?
> 
> When would anybody do "git add *.o"?
> 

Make that "git add *.c" then, in a directory normally containing a lot of generated C-files.

Show 11 quoted lines
> 
> An alternative is to use the mechanism I added here to _detect_
> the attempt to add an ignored file with explicitly spelled out
> pathspec, and issue an info message that says something like:
> 
> 	Path 'xyzzy/filfre.o' is not being ignored by one of
> 	your .gitignore files.  If you really want to add it,
> 	please add this entry to .gitignore file:
> 
>         !/xyzzy/filfre.o
> 

Sounds very sensible to me, although I assume you meant "path xyzzy/filfre.o is being ignored" (ie, "is not being ignored" (sic) was a typo).

Show 11 quoted lines
> One advantage of this is that it would help guiding the user in
> the right direction, giving a reusable piece of knowledge,
> without changing the behaviour of the command (what is refused
> is refused).  But I can already see people's complaints: if the
> tool knows how to fix that situation why forces the user to do
> so?
> 
> Although the reason why the alternative does not do so is "The
> user earlier said *.o files are uninteresting but came back with
> a conflicting request to add xyzzy/filfre.o, which could be a
> mistake.  We ask for a confirmation", which is very sensible,

Very sensible indeed. If you tell a cabdriver "go-left-go-right" (very fast) he'll (hopefully) stop and ask you where you really wanted to go.

Show 8 quoted lines
> another alternative would be to add the path anyway and issue an
> warning, like this:
> 
> 	$ ls xyzzy
>         filfre.c	filfre.o
> 	$ git add xyzzy/filfre.?
> 	added ignored path xyzzy/filfre.o
> 
I like the "you did something weird. Education served" option better.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Johannes Schindelin
Message 11 of 11 in “git-add: add ignored files when asked explicitly.”
  1. 5/5 git-add: add ignored files when asked explicitly.Junio C Hamano, Dec 25, 2006
  2. Johannes SchindelinDec 25, 2006
  3. Junio C HamanoDec 25, 2006
  4. git-add: warn when adding an ignored file with an explicit request.Junio C Hamano, Dec 25, 2006
  5. Jakub NarebskiDec 25, 2006
  6. Johannes SchindelinDec 26, 2006
  7. Nicolas PitreDec 25, 2006
  8. Johannes SchindelinDec 26, 2006
  9. Junio C HamanoDec 26, 2006
  10. Johannes SchindelinDec 26, 2006
  11. Andreas EricssonJan 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.