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

Re: [RFC] Two conceptually distinct commit commands

From
Horst H. von Brand <vonbrand@inf.utfsm.cl>
Date
Dec 5, 2006, 02:14 UTC
Message-ID
<200612050214.kB52E7mG027926@laptop13.inf.utfsm.cl>
In-Reply-To
<cworth@cworth.org>
Carl Worth <cworth@cworth.org> wrote:
Show 7 quoted lines
> On Mon, 04 Dec 2006 21:52:38 -0300, "Horst H. von Brand" wrote:
> > >     Commits the content of the working tree for the given paths, (or
> > >     all tracked paths). Untracked files can be committed for the first
> > >     time by specifying their names on the command-line or by using
> > >     "git add" to add them just prior to the commit. Any rename or
> > >     removal of a tracked file will be detected and committed
> > >     automatically.
> > Edit somefile with, e.g, emacs: Get backup called somefile~
> > Realize that somefile is nonsense, delete it(s edited version)
> > commit-working-tree-contents: Now you have the undesirable somefile~ saved
> The semantics I intended to describe for commit-working-tree-content
> would not add this file. That's a "new file" so would have to be
> mentioned either explicitly on the command-line or in a git-add
> command before it would be committed.

How do you distinguish a "new file, same contents as old file" from "old file, renamed"? What is the difference between:

  mv somefile newfile
and
  cp somefine newfile
  rm somefile
?
How should
  cp somefile newfile
  vi somefile
be handled? How about
  cp somefile oldfile
  vi somefile
or just
  mv somefile oldfile
? Or
  cp somefile somefile.my-own-bakup
  vi somefile
?

The whole problem is your description based on "file renaming" and such. AFAIU git has a list of file names it is tracking, and for those names it keeps track of what the contents for each are at each commit. That the name somefile had some contents that later show up as newfile (both names tracked) is recorded just as that. You could /interpret/ this as a "rename" if somefile is then gone, but it could well be something else. Besides, you'd have to search for the old somefile contents among /all/ newfiles just to find out it was renamed. Better don't mix facts with interpretation (== guesses on what operations came in between the snapshots git takes). Note that it should never matter what strange ideas a random user gets for naming her temporary backup files, or their git configuration.

-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Previous: Jakub NarebskiNext: Carl Worth
Message 4 of 5 in “Re: [RFC] Two conceptually distinct commit commands”
  1. Horst H. von BrandDec 5, 2006
  2. Carl WorthDec 5, 2006
  3. Jakub NarebskiDec 5, 2006
  4. Horst H. von BrandDec 5, 2006
  5. Carl WorthDec 5, 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.