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

Re: [PATCH] Make git add -n and git -u -n output consistent

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2008, 04:40 UTC
Message-ID
<7vabihtyxw.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1211493582-13400-1-git-send-email-hendeby@isy.liu.se>
Gustaf Hendeby <hendeby@isy.liu.se> writes:
Show 8 quoted lines
> Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
> ---
>
> This would be one way to go to get a more coherent behavior or the -n
> switch to git add.  It would also unify the implementation somewhat.
> I'd suggest amending this to your patch, or would the output be likely
> to be used by scrips?  In that case I'd vote for changing the output
> of git add -n -u,

The commit log message should describe what kind of consistency you are talking about to people who are not familiar with the topic.

Output format from "git add -n $path" lists path to blobs that are going to be added on a single line, separated with SP. On the other hand, the suggested "git add -u -n" shows one path per line, like "add '<file>'\n". Of course, these two are inconsistent.

Plain "git add -n" can afford to only say names of paths, as all it does is to add (update). However, "git add -u" needs to be able to express "remove" somehow. So if we need to have them formatted the same way, we need to unify with the "git add -n -u" format. Incidentally, this is consistent with how 'update-index' says it.

I do not think we need to worry about people who wrote script around output from "git add -n". Output from Porcelain commands is a fair game for improvements.

Previous: Gustaf HendebyNext: Gustaf Hendeby
Message 12 of 13 in “[BUG] git add -u ignores --dry-run flag”
  1. Gustaf HendebyMay 15, 2008
  2. Make git add -u honor --dry-runMiklos Vajna, May 15, 2008
  3. Gustaf HendebyMay 15, 2008
  4. Re* [PATCH] Make git add -u honor --dry-runJunio C Hamano, May 15, 2008
  5. Miklos VajnaMay 16, 2008
  6. Gustaf HendebyMay 19, 2008
  7. Junio C HamanoMay 22, 2008
  8. Gustaf HendebyMay 22, 2008
  9. Junio C HamanoMay 22, 2008
  10. Gustaf HendebyMay 22, 2008
  11. Make git add -n and git -u -n output consistentGustaf Hendeby, May 22, 2008
  12. Junio C HamanoMay 23, 2008
  13. Gustaf HendebyMay 23, 2008

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.