git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* The case for two trees in a commit ("How to make rebase less modal")
@ 2018-02-28 23:30 Stefan Beller
  2018-03-01  1:15 ` Ramsay Jones
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Stefan Beller @ 2018-02-28 23:30 UTC (permalink / raw)
  To: git; +Cc: Sergey Organov, igor.d.djordjevic, Johannes Schindelin

$ git hash-object --stdin -w -t commit <<EOF
tree c70b4a33a0089f15eb3b38092832388d75293e86
parent 105d5b91138ced892765a84e771a061ede8d63b8
author Stefan Beller <sbeller@google.com> 1519859216 -0800
committer Stefan Beller <sbeller@google.com> 1519859216 -0800
tree 5495266479afc9a4bd9560e9feac465ed43fa63a
test commit
EOF
19abfc3bf1c5d782045acf23abdf7eed81e16669
$ git fsck |grep 19abfc3bf1c5d782045acf23abdf7eed81e16669
$

So it is technically possible to create a commit with two tree entries
and fsck is not complaining.

But why would I want to do that?

There are multiple abstraction levels in Git, I think of them as follows:
* data structures / object model
* plumbing
* porcelain commands to manipulate the repo "at small scale", e.g.
create a commit/tag
* porcelain to modify the repo "at larger scale", such as rebase,
cherrypicking, reverting
  involving more than 1 commit.

These large scale operations involving multiple commits however
are all modal in its nature. Before doing anything else, you have to
finish or abort the rebase or you need expert knowledge how to
go otherwise.

During the rebase there might be a hard to resolve conflict, which
you may not want to resolve right now, but defer to later.  Deferring a
conflict is currently impossible, because precisely one tree is recorded.

If we had multiple trees possible in a commit, then all these large scale
operations would stop being modal and you could just record the unresolved
merge conflict instead; to come back later and fix it up later.

I'd be advocating for having multiple trees in a commit
possible locally; it might be a bad idea to publish such trees.

Opinions or other use cases?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-01 19:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 23:30 The case for two trees in a commit ("How to make rebase less modal") Stefan Beller
2018-03-01  1:15 ` Ramsay Jones
2018-03-01  1:42   ` Brandon Williams
2018-03-01  4:26 ` Jeff King
2018-03-01  7:25 ` Jacob Keller
2018-03-01 18:50   ` Junio C Hamano
2018-03-01 18:44 ` Junio C Hamano
2018-03-01 19:05 ` Jonathan Nieder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).