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

Re: [PATCH/RFD] builtin-revert.c: release index lock when cherry-picking an empty commit

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 8, 2009, 21:53 UTC
Message-ID
<7v7i2zk7fn.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<B0CBEE84-0F46-4AF2-86B1-C80BADAEF4E5@pobox.com>
Chris Johnsen <chris_johnsen@pobox.com> writes:
Show 5 quoted lines
> My confusion was that I took "usually a mistake" to refer to the case
> where the user meant to commit content changes but forgot to first
> stage any changed content. But your clarification shows that "usually
> a mistake" really means that making any empty commit, intentional or
> not, is (considered to be) a fundamental misuse of SCM machinery.

The empty commits in your example a few messages ago are used as "piss in the snow" marking. If you did not have tags (and commit notes), it may be the only workaround to say "here is an interesting point", but even then such a workaround can only be made while the commit is at the tip, and be made useful only by forcing all the other commits on the branch be on top of that "piss in the snow" commit, so it is a flawed workaround.

Suppose you have this history.
 ---A---B---C
You found that the point C is interesting in some way, so you mark it:
 ---A---B---C---P
But somebody else may have developed on top of C bypassing P
              D---E---F
             /
 ---A---B---C---P

What would you do in such a case? You cannot leave P dangling, as that would mean P will not participate in future rebases (and you do not want to rebase P on top of F because C is the point that is interesting to you, not F). Do you merge F and P only to make P not dangling? What does such a merge mean?

Worse yet, if you stared from the original history with three commits, how would you mark that B is interesting?

          P   D---E---F
         /   /
 ---A---B---C

The facility git and other SCM offer you to leave such mark (possibly after the fact) is to use tags.

So in your particular "piss in the snow" usage, I would agree that such an empty commit is a misuse.

I am not however claiming that all uses of an empty commit are fundamental misuses here, though. Somebody else may have other valid uses.

Previous: Chris JohnsenNext: Jeff King
Message 7 of 21 in “builtin-revert.c: release index lock when cherry-picking an empty commit”
  1. builtin-revert.c: release index lock when cherry-picking an empty commitChris Johnsen, Mar 7, 2009
  2. Johannes SchindelinMar 7, 2009
  3. Chris JohnsenMar 7, 2009
  4. Johannes SchindelinMar 8, 2009
  5. Junio C HamanoMar 8, 2009
  6. Chris JohnsenMar 8, 2009
  7. Junio C HamanoMar 8, 2009
  8. Jeff KingMar 8, 2009
  9. Jeff KingMar 8, 2009
  10. Junio C HamanoMar 8, 2009
  11. Jeff KingMar 10, 2009
  12. Tomas CarneckyMar 10, 2009
  13. Tomas CarneckyMar 10, 2009
  14. Chris JohnsenMar 10, 2009
  15. Jeff KingMar 11, 2009
  16. Mike RalphsonMar 11, 2009
  17. Mike RalphsonMar 11, 2009
  18. Jeff KingMar 22, 2009
  19. Junio C HamanoMar 22, 2009
  20. Jeff KingMar 22, 2009
  21. Brandon CaseyMar 9, 2009

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.