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

Re: Question on empty commit

From
LTLuben Tuikov <ltuikov@yahoo.com>
Date
Jan 16, 2006, 22:57 UTC
Message-ID
<20060116225749.90052.qmail@web31812.mail.mud.yahoo.com>
In-Reply-To
<20060116215856.6618.qmail@web31805.mail.mud.yahoo.com>
--- Luben Tuikov <ltuikov@yahoo.com> wrote:
Show 40 quoted lines
> --- Junio C Hamano <junkio@cox.net> wrote:
> 
> > Luben Tuikov <ltuikov@yahoo.com> writes:
> > 
> > > Now the last merge introduced an empty commit, since
> > > tree A and tree B had been in sync (only local and
> > > remote trunk had been out of sync).  While it was expected
> > > that no commit would be introduced since they were in sync.
> > >
> > > Was the empty commit correct behavior?
> > 
> > I do not quite follow you, but immediately before the "empty
> > commit" (I presume you mean the last "git merge" that merges
> > treeA head in treeB), you say "the treeA and treeB had been in
> > sync".
> 
> Meaning that merging Tree A into Tree B would introduce 0 changes
> to Tree B.
> 
> > What do you exactly mean?  The tree object in the head
> > commits in treeA branch and treeB branch were identical?
> 
> They cannot be, since Tree B contains Project B, which is not
> present in Tree A, but it depends on Project A in Tree A.
> 
> > If that is the case, the commit being empty is the correct
> > behaviour, because there is no difference in the set of files
> > introduced by that commit.  And the commit being made is also
> > the correct behaviour, because those two branches have different
> > development history, and the commit is what binds them together.
> 
> So a new commit object, with 0 files changed was the correct behavior
> after all?
> 
> I'd expect that there would be no commit object whatsoever since
> those trees had been synced before.  I.e. the only thing which changed
> was the trunk and that trunk was synced to Tree A and Tree B separately.
> 
> Thanks,
>     Luben

Ok, so what I'm seeing is that git history records what the _user did_ as opposed to _what happened to the code_.

Is it possible to have an env var to control this "feature". I.e. if the result is 0 lines 0 files changed, then do not update the index and/or the git database.

Thanks Junio,
    Luben
Previous: Luben TuikovNext: Junio C Hamano
Message 4 of 6 in “Question on empty commit”
  1. Luben TuikovJan 14, 2006
  2. Junio C HamanoJan 15, 2006
  3. Luben TuikovJan 16, 2006
  4. Luben TuikovJan 16, 2006
  5. Junio C HamanoJan 16, 2006
  6. Junio C HamanoJan 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.