git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git add -i" with path gives "Argument list too long"
@ 2010-01-04 18:43 Wincent Colaiuta
  2010-01-05  4:14 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Wincent Colaiuta @ 2010-01-04 18:43 UTC (permalink / raw)
  To: git

Just ran "git add -i <path>" with "<path>" pointing to a subdirectory  
which happens to have a bunch of files in it (about 7k) and it barfed  
thusly:

   Can't exec "git": Argument list too long at /usr/local/libexec/git- 
core/git-add--interactive line 158.
   Died at /usr/local/libexec/git-core/git-add--interactive line 158.

I see that what it's trying to do under the hood is:

   git diff-index --cached --numstat --summary HEAD -- <7,000+ paths...>

Sure, we could divide the paths into smaller groups, run multiple  
invocations of "git diff-index", and concatenate the results. But it  
would be nicer if there was some other way that we could get at the  
same information without having to pass 7,000 paths explicitly on the  
command line; is there any which I am overlooking?

The enormous file list is the result of passing <path> into "git ls- 
files -- <path>". Would it be worth:

- either, modifying "git diff-index" to accept a list of paths over  
stdin so that we could at least pipe the output from "git ls-files"  
into "git diff-index"

- or, preferably, teach "git diff index" to recurse into directories  
rather than expect a list of paths-of-blobs (possibly with a command  
line switch to activate the behaviour if it were deemed a dangerous  
default)

This is one piece of plumbing that I've never dabbled with, so forgive  
me if my questions are a little dumb.

Cheers,
Wincent

^ permalink raw reply	[flat|nested] 10+ messages in thread
* "git add -i" with path gives "Argument list too long"
@ 2010-03-21 20:52 Wincent Colaiuta
  2010-03-22  0:39 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Wincent Colaiuta @ 2010-03-21 20:52 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano

Back in January I reported a wart in "git add -i" and discussion kind of petered out and I forgot about the bug until today when I ran into it again. Now I have a few more cycles to burn I have the time to sort it out.

Just to revise what was discussed back in January:

- my original report: http://lists-archives.org/git/708569-git-add-i-with-path-gives-argument-list-too-long.html

- quick and easy fix posted by Jeff King: http://lists-archives.org/git/708591-git-add-i-with-path-gives-argument-list-too-long.html

- notes on inconsistencies between "git add" and "git add -i" by Jeff king: http://lists-archives.org/git/708698-git-add-i-with-path-gives-argument-list-too-long.html

To summarize and expand a bit upon what Jeff noted in that last post:

  - given _tracked_ file "foo.c" and _untracked_ file "bar.c"
  - "git add '*.c'" ignores the tracked file and stages the untracked file
  - "git add -i '*.c'" ignores the untracked file and operates on the tracked file

So, I gather that we can agree that this behavior isn't right. Either we treat the arguments as pathspecs or we don't, but it doesn't seem right to do one thing for tracked files and another for untracked ones, and it seems especially wrong for the differential treatment to apply in one direction with "git add" and in the other with "git add -i".

So, as a first step I'd like to make some test cases to serve as a specification for what we want the desired behavior to be. I saw in one of the "what's cooking messages" in February that there was some changes cooking in the "cp/add-u-pathspec" topic, so I am not entirely clear on if there is consensus about the desired behaviour.

Before I run ahead and start writing test, do we have consensus?

(Will have to worry about the initial cause of my bug report -- the "argument list too long" error -- later on.)

Cheers,
Wincent

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

end of thread, other threads:[~2010-03-22  1:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 18:43 "git add -i" with path gives "Argument list too long" Wincent Colaiuta
2010-01-05  4:14 ` Jeff King
2010-01-05  5:31   ` Junio C Hamano
2010-01-05 12:34   ` Wincent Colaiuta
2010-01-06 12:19     ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2010-03-21 20:52 Wincent Colaiuta
2010-03-22  0:39 ` Jeff King
2010-03-22  1:23   ` Junio C Hamano
2010-03-22  1:41     ` Jeff King
2010-03-22  1:55       ` 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;
as well as URLs for NNTP newsgroup(s).