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

Re: Separating "add path to index" from "update content in index"

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 23, 2006, 02:56 UTC
Message-ID
<Pine.LNX.4.64.0612222141470.20138@iabervon.org>
In-Reply-To
<7vfyb87bxg.fsf@assigned-by-dhcp.cox.net>
On Thu, 21 Dec 2006, Junio C Hamano wrote:
Show 6 quoted lines
> Sure, what you want is "git add --no-add newfile", and I can
> understand that mode of operation if you are always going to
> commit with "git commit -a".  Maybe we can have a config
> variable that makes "commit -a" and "add --no-add" the default
> for these two commands, and we do not have to change anything
> else.

I think there's value to a command to add an empty space with a given name to the staging area. If you commit without -a, I don't see any reason to think that you couldn't want the sequence "add-empty-space <new-file>", "modify <old-file>", "update-index <old-file>", "commit", "update-index <new-file>", "commit". It can be useful to make sure the file isn't going to be forgotten, but also not get it into the next commit.

> One minor detail I wonder about is what mode bits would you give
> to that placeholder entry.

I looked into this at one point. It should probably use 000000 for the mode, because it shouldn't read the working directory at all (you might actually want to add the space before creating a file at all, for instance, and then make a symlink when you provide anything, surprising any reasonable guess at a mode). Also, this is going to show up in the diff listing, and all-zero SHA1 with a mode is used there for "read the working directory".

	-Daniel
*This .sig left intentionally blank*
Previous: Carl Worth
Message 22 of 22 in “GIT - error: no such remote ref refs/heads/TestBranch”
  1. Sean KelleyDec 19, 2006
  2. Junio C HamanoDec 19, 2006
  3. Carl WorthDec 20, 2006
  4. Junio C HamanoDec 20, 2006
  5. Carl WorthDec 20, 2006
  6. Junio C HamanoDec 20, 2006
  7. Carl WorthDec 21, 2006
  8. Peter BaumannDec 21, 2006
  9. Junio C HamanoDec 22, 2006
  10. Separating "add path to index" from "update content in index"Carl Worth, Dec 22, 2006
  11. SeanDec 22, 2006
  12. Nicolas PitreDec 22, 2006
  13. Carl WorthDec 22, 2006
  14. Nicolas PitreDec 23, 2006
  15. Daniel BarkalowDec 24, 2006
  16. Junio C HamanoDec 22, 2006
  17. Shawn PearceDec 22, 2006
  18. Jakub NarebskiDec 22, 2006
  19. Carl WorthDec 22, 2006
  20. Nicolas PitreDec 22, 2006
  21. Carl WorthDec 22, 2006
  22. Daniel BarkalowDec 23, 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.