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

[RFD] git update-index --remove frotz --add frotz expected behaviour?

From
JPJakob Pfender <jpfender@elegosoft.com>
Date
Mar 24, 2011, 17:07 UTC
Message-ID
<4D8B7A6D.5050801@elegosoft.com>

I'm a bit stumped by update-index' behaviour when calling --remove and --add on the same file in that order:

$ touch frotz $ git update-index --add frotz $ rm frotz $ git status -s AD frotz $ git update-index --remove frotz --add frotz $ echo $? 0 $ git status -s $

Notice that update-index doesn't complain that I'm trying to add a file that doesn't exist, and it's returning with 0.

Is this expected behaviour? Shouldn't I get some sort of error message telling me that I'm trying to add a file I've just removed? Compare:

$ touch xyzzy $ git update-index --add xyzzy $ rm xyzzy $ git update-index --remove xyzzy $ git update-index --add xyzzy error: xyzzy: does not exist and --remove not passed fatal: Unable to process path xyzzy

Can anyone explain this to me?
Next: Junio C Hamano
Message 1 of 2 in “[RFD] git update-index --remove frotz --add frotz expected behaviour?”
  1. Jakob PfenderMar 24, 2011
  2. Junio C HamanoMar 24, 2011

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.