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

Re: Bug: "git checkout -b" should be allowed in empty repo

From
Ddemerphq <demerphq@gmail.com>
Date
Jan 31, 2012, 10:11 UTC
Message-ID
<CANgJU+UxB-qAJOaqKKnMkTx7fW4cyqHrGy7myhCzizBFGtnMZg@mail.gmail.com>
In-Reply-To
<4F27BBED.9080902@viscovery.net>
On 31 January 2012 11:01, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 11 quoted lines
> Am 1/31/2012 9:57, schrieb Michael Haggerty:
>> No, the idea is to avoid special casing by making 0{40} into a real (but
>> empty) revision.
>
> But then why not just have git init perform the equivalent of
>
>  c=$(echo "Start" | git commit-tree $empty_tree_sha1) &&
>  git update-ref refs/heads/master $c
>
> People who dislike an empty initial commit can always use "git commit
> --amend" for the first "real" commit.

Because it would then violate a system invariant that all commits are descendants of the root commit.

You can model a git commit graph as a pathway through multidimensional space of all possible commit trees. From that perspective it makes sense that every pathway starts at the origin point of the multidimensional space, which is conceptually the same as the proposed root commit.

Anyway, I am not saying it should change, just that from some point of views it makes a lot of sense.

Yves
-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Previous: Johannes SixtNext: Jakub Narebski
Message 32 of 34 in “Bug: "git checkout -b" should be allowed in empty repo”
  1. Michael HaggertyJan 29, 2012
  2. Junio C HamanoJan 29, 2012
  3. Junio C HamanoJan 29, 2012
  4. Michael HaggertyJan 30, 2012
  5. Junio C HamanoJan 30, 2012
  6. Junio C HamanoJan 30, 2012
  7. Jeff KingJan 30, 2012
  8. Junio C HamanoFeb 6, 2012
  9. Junio C HamanoFeb 6, 2012
  10. Jeff KingFeb 6, 2012
  11. Andrew ArdillFeb 6, 2012
  12. Jeff KingFeb 6, 2012
  13. Michael HaggertyFeb 6, 2012
  14. Jeff KingFeb 6, 2012
  15. Junio C HamanoFeb 6, 2012
  16. Jeff KingFeb 6, 2012
  17. Michael HaggertyFeb 7, 2012
  18. demerphqFeb 6, 2012
  19. Junio C HamanoFeb 6, 2012
  20. Jeff KingFeb 6, 2012
  21. Junio C HamanoFeb 6, 2012
  22. Junio C HamanoFeb 6, 2012
  23. Jeff KingFeb 6, 2012
  24. Michael HaggertyFeb 6, 2012
  25. Junio C HamanoFeb 6, 2012
  26. Jeff KingJan 30, 2012
  27. branch --edit-description: protect against mistyped branch nameJunio C Hamano, Feb 6, 2012
  28. Junio C HamanoFeb 6, 2012
  29. Jeff KingFeb 6, 2012
  30. Michael HaggertyJan 31, 2012
  31. Johannes SixtJan 31, 2012
  32. demerphqJan 31, 2012
  33. Jakub NarebskiJan 31, 2012
  34. Michael HaggertyJan 31, 2012

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.