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

Re: git-add fails after file type change

From
Steven Grimm <koreth@midwinter.com>
Date
Dec 17, 2006, 00:19 UTC
Message-ID
<45848CF8.4000704@midwinter.com>
In-Reply-To
<45843C5A.8020501@gmail.com>
A Large Angry SCM wrote:
> Did you try "git-update-index --replace dir"?

Turns out that doesn't work. It gives me the same error I get without the --replace option:

error: dir: cannot add to the index - missing --add option? fatal: Unable to process file dir

However, "git rm" followed by "git add" does seem to work. So for now it looks like that'll be the best bet when I run into this problem (should be possible to automate it, even.) The better error message from Junio's patch will at least make the failure less mysterious.

IMO it'd still be nice if the porcelain could provide a "make the index look like the working directory" operation that worked even in the face of changes like this, adding and/or removing files as needed. But it's possible that my crazy git-as-backup-device setup is the only place where this is even an issue; typical git users can use "git mv" and never run into the problem.

-Steve
Previous: Steven GrimmNext: Junio C Hamano
Message 7 of 11 in “git-add fails after file type change”
  1. Steven GrimmDec 16, 2006
  2. Jakub NarebskiDec 16, 2006
  3. Steven GrimmDec 16, 2006
  4. A Large Angry SCMDec 16, 2006
  5. Junio C HamanoDec 16, 2006
  6. Steven GrimmDec 16, 2006
  7. Steven GrimmDec 17, 2006
  8. Junio C HamanoDec 17, 2006
  9. Junio C HamanoDec 17, 2006
  10. git-add: remove conflicting entry when adding.Junio C Hamano, Dec 17, 2006
  11. Junio C HamanoDec 16, 2006

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.