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

Re: "git add -i" with path gives "Argument list too long"

From
Wincent Colaiuta <win@wincent.com>
Date
Jan 5, 2010, 12:34 UTC
Message-ID
<AAABEE5B-0419-4344-86E2-7EB550CCFC01@wincent.com>
In-Reply-To
<20100105041438.GB12574@coredump.intra.peff.net>
El 05/01/2010, a las 05:14, Jeff King escribió:
Show 7 quoted lines
>> - 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)
>
> Doesn't it already do this? If I say "git diff index subdir" it
> will limit the diff only to things inside subdir/.
[snip patch]

I tried out the patch and it obviously does avoid the "Argument list too long" problem. At least for my usage patterns the superficial differences in behavior that you note would not be a problem (I usually want to limit things to a subdir, and seldom if ever pass in things like '*.c').

> but note that the pathspecs given to ls-files and the path limiters
> given to diff are not quite the same. So "git add -i '*.c'" will
> currently find "subdir/foo.c", but would not with the above patch. Is
> that what you meant when you said "recurse into directories"?

In my relative ignorance of the finer details here, I meant that I would want "diff-index" to give us the exact same set of blobs as we get from "ls-files", so as to fix the error without modifying the user visible behavior.

As I said, I personally wouldn't be impacted by the change in behavior that your patch produces, but maybe others might.

Cheers, Wincent

Previous: Junio C HamanoNext: Jeff King
Message 4 of 5 in “"git add -i" with path gives "Argument list too long"”
  1. Wincent ColaiutaJan 4, 2010
  2. Jeff KingJan 5, 2010
  3. Junio C HamanoJan 5, 2010
  4. Wincent ColaiutaJan 5, 2010
  5. Jeff KingJan 6, 2010

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.