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

Re: [PATCH v5 1/1] contrib/subtree: Add a test for subtree rebase that loses commits

From
David A. Greene <greened@obbligato.org>
Date
Jan 20, 2016, 04:10 UTC
Message-ID
<87wpr4ubzo.fsf@waller.obbligato.org>
In-Reply-To
<xmqqsi1tbh68.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 27 quoted lines
> 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.
Ok, that makes sense.
Show 18 quoted lines
>> +	(
>> +		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

That is a good question. I originally created the test to see if making these two commits differently would cause any problems with git-subtree's split command. Obviously, I didn't get that far. :)

So I think it makes sense for me to at least test and see what happens. I will add another test to this set if it makes a difference.

> 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.
Ah, good catch.  I should add a test for that.

Let me do a re-roll of this since I think you bring up some excellent points. Might be a few days due to work obbligations.

                        -David
Previous: Junio C HamanoNext: Junio C Hamano
Message 21 of 24 in “Test rebase -Xsubtree”
  1. Test rebase -XsubtreeDavid Greene, Jan 5, 2016
  2. Add a test for subtree rebase that loses commitsDavid Greene, Jan 5, 2016
  3. Torsten BögershausenJan 5, 2016
  4. Dennis KaarsemakerJan 5, 2016
  5. Torsten BögershausenJan 5, 2016
  6. Eric SunshineJan 5, 2016
  7. David A. GreeneJan 5, 2016
  8. Test rebase -XsubtreeDavid Greene, Jan 10, 2016
  9. Add a test for subtree rebase that loses commitsDavid Greene, Jan 10, 2016
  10. Eric SunshineJan 15, 2016
  11. David A. GreeneJan 17, 2016
  12. 1/1 Add a test for subtree rebase that loses commitsDavid Greene, Jan 17, 2016
  13. Eric SunshineJan 17, 2016
  14. David A. GreeneJan 17, 2016
  15. 1/1 contrib/subtree: Add a test for subtree rebase that loses commitsDavid Greene, Jan 17, 2016
  16. Eric SunshineJan 18, 2016
  17. David A. GreeneJan 19, 2016
  18. 1/1 contrib/subtree: Add a test for subtree rebase that loses commitsDavid Greene, Jan 19, 2016
  19. Eric SunshineJan 19, 2016
  20. Junio C HamanoJan 19, 2016
  21. David A. GreeneJan 20, 2016
  22. Junio C HamanoApr 12, 2016
  23. David A. GreeneJun 28, 2016
  24. 1/1 contrib/subtree: Add a test for subtree rebase that loses commitsDavid Greene, Jun 28, 2016

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.