git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Greene <greened@obbligato.org>
Cc: git@vger.kernel.org, sunshine@sunshineco.com,
	davidw@realtimegenomics.com
Subject: Re: [PATCH v5 1/1] contrib/subtree: Add a test for subtree rebase that loses commits
Date: Tue, 19 Jan 2016 09:41:35 -0800	[thread overview]
Message-ID: <xmqqsi1tbh68.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <3eb25268597083cdb10303e3d5790302e719a803.1453172369.git.greened@obbligato.org> (David Greene's message of "Mon, 18 Jan 2016 20:59:38 -0600")

David Greene <greened@obbligato.org> writes:

> From: David A. Greene <greened@obbligato.org>
>
> This test merges an external tree in as a subtree, makes some commits
> on top of it and splits it back out.  In the process the added commits
> are lost or the rebase aborts with an internal error.  The tests are
> marked to expect failure so that we don't forget to fix it.
>
> Signed-off-by: David A. Greene <greened@obbligato.org>
> ---
>
> Notes:
>     Change History:
>     
>     v1 - Initial version
>     v2 - Additional tests and code cleanup
>     v3 - Remove check_equal, mark comments on failure and remove
>          test_debug statements
>     v4 - Send correct v3 test (botched v3)
>     v5 - Fix use of verbose

Thanks, both.  Will queue.

I have a couple of questions and comments, though.

> +test_expect_success 'setup' '
> +	test_commit README &&
> +...
> +	tree=$(git write-tree) &&
> +	head=$(git rev-parse HEAD) &&
> +	rev=$(git rev-parse --verify files-master^0) &&
> +	commit=$(git commit-tree -p $head -p $rev -m "Add subproject master" $tree) &&

I think at this point, your index and working tree states match that
of $commit.  So the next command ...

> +	git reset $commit &&

... made me wonder what its significance was.  I think you are doing
this solely to move the HEAD pointer to point at $commit, but then
it would be much better and more readable to use update-ref, i.e.
making this line to:

	git update-ref HEAD $commit &&

instead, as "write-tree && commit-tree && update-ref" is a familiar
pattern to reimplement "git commit" using the plumbing.  Ending that
three-command sequence with "reset" breaks the pattern.

> +	(
> +		cd files_subtree &&
> +		test_commit master4
> +	) &&
> +	test_commit files_subtree/master5

I understand that you are creating these two commits both in the
top-level repository (the one the history initially created in
"files" repository gets merged into), but you are creating them
slightly differently.  Is that significant?  I am not complaining
about the style of writing tests, but I am wondering if having these
two commits created differently has any effect on the bug you
observed, which may be a good starting point for anybody who wants
to fix it to start digging from.  IOW, would the resulting history
different if you did this instead?

	test_commit files_subtree/master4 &&
	test_commit files_subtree/master5

I also notice that files_subtree/master4 does not appear in any of
the verification in the three tests that use the history being
prepared here, i.e. if master4 is silently dropped while master5 is
kept, such a bug won't be caught by them.

  parent reply	other threads:[~2016-01-19 17:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  4:40 [PATCH] Test rebase -Xsubtree David Greene
2016-01-05  4:40 ` [PATCH] Add a test for subtree rebase that loses commits David Greene
2016-01-05  8:47   ` Torsten Bögershausen
2016-01-05  9:57     ` Dennis Kaarsemaker
2016-01-05 11:18       ` Torsten Bögershausen
2016-01-05 20:34   ` Eric Sunshine
2016-01-05 21:14     ` David A. Greene
2016-01-10 23:08   ` [PATCH v2] Test rebase -Xsubtree David Greene
2016-01-10 23:08     ` [PATCH] Add a test for subtree rebase that loses commits David Greene
2016-01-15  1:19       ` Eric Sunshine
2016-01-17 22:50         ` David A. Greene
2016-01-17 23:13         ` [PATCH v3 contrib/subtree 1/1] " David Greene
2016-01-17 23:32           ` Eric Sunshine
2016-01-17 23:36             ` David A. Greene
2016-01-17 23:43             ` [PATCH v4 1/1] contrib/subtree: " David Greene
2016-01-18 18:10               ` Eric Sunshine
2016-01-19  2:53                 ` David A. Greene
2016-01-19  2:59                 ` [PATCH v5 " David Greene
2016-01-19  4:21                   ` Eric Sunshine
2016-01-19 17:41                   ` Junio C Hamano [this message]
2016-01-20  4:10                     ` David A. Greene
2016-04-12 23:27                       ` Junio C Hamano
2016-06-28 10:55                         ` David A. Greene
2016-06-28 10:54                     ` [PATCH v6 " David Greene

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=xmqqsi1tbh68.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=davidw@realtimegenomics.com \
    --cc=git@vger.kernel.org \
    --cc=greened@obbligato.org \
    --cc=sunshine@sunshineco.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).