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

Re: git commit (or git-commit-script) question

From
Junio C Hamano <junkio@cox.net>
Date
Aug 19, 2005, 19:52 UTC
Message-ID
<7vd5o9yaam.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0508191028190.3412@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> However, one thing to look out for is that if you've marked any files for 
> update (with git-update-cache) those will always be committed regardless 
> of what arguments you give to "git commit".

Another thing to look out for is that the files you told it about with "git add" will be included and does not show up in "git diff", because there currently is no way to record "intent to add" (rather, "Mr GIT, please keep an eye on this file") without actually adding a path to the index file for inclusion in the next commit.

I have a couple of updates to git-commit-script in the proposed updates branch, and one of the changes is that git-update-cache in git-commit-script, used when either the --all flag or explicit paths are given, has a --remove flag there. The reason it does not need --add flag there as well is a direct consequence of this asymmetry.

Although I do not think this asymmetry a major source of confusion, I suspect that we could "fix" it by treating an index entry with all-zero mode and sha1 as "keep-an-eye-on" entry with a new flag "git-update-cache --watch <path>" or something like that. "git-diff-files" would then treat that special entry as a nonexistent path and would compare it with whatever happens to be (or lack of it) in the working tree, and "git diff" would show a diff that creates the file. This needs a tweak or two in the diffcore machinery as well.

Previous: Johnny Stenback
Message 4 of 4 in “git commit (or git-commit-script) question”
  1. Johnny StenbackAug 19, 2005
  2. Linus TorvaldsAug 19, 2005
  3. Johnny StenbackAug 19, 2005
  4. Junio C HamanoAug 19, 2005

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.