git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Stefan Beller <sbeller@google.com>, git <git@vger.kernel.org>,
	Sergey Organov <sorganov@gmail.com>,
	igor.d.djordjevic@gmail.com,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: The case for two trees in a commit ("How to make rebase less modal")
Date: Wed, 28 Feb 2018 17:42:56 -0800	[thread overview]
Message-ID: <20180301014256.GD87122@google.com> (raw)
In-Reply-To: <a2c44a68-9fc6-5998-6d84-aba73ea65a61@ramsayjones.plus.com>

On 03/01, Ramsay Jones wrote:
>
>
> On 28/02/18 23:30, Stefan Beller wrote:
> > $ 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.
>
> Hmm, it's a while since I looked at that code, but I don't think
> you have a commit with two trees - the second 'tree <sha1>' line
> is just part of the commit message, isn't it?
>
> ATB,
> Ramsay Jones
>

Actually it doesn't look like it.  The commit msg doesn't start till
after an empty newline so that commit has an empty commit msg.  Here's
one which you can see the msg when passed to show:

git hash-object --stdin -w -t commit <<EOF
tree 76d269b57d3c4283922216f84a2850e99f561ccc
parent fa0624f79f9d5765d09598b003124b3cf0b9acdb
author Brandon Williams <bmwill@google.com> 1519859216 -0800
committer Brandon Williams <bmwill@google.com> 1519859216 -0800
tree 76d269b57d3c4283922216f84a2850e99f561ccc

This is a test commit with multiple trees
EOF

Of course the extra tree is ignored, but fsck doesn't complain and show
happily shows what it knows about.

--
Brandon Williams

  reply	other threads:[~2018-03-01  1:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180301014256.GD87122@google.com \
    --to=bmwill@google.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=igor.d.djordjevic@gmail.com \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sbeller@google.com \
    --cc=sorganov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).