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

Re: Bug? Files are losing history after subtree merge

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Oct 2, 2013, 19:42 UTC
Message-ID
<vpqsiwjlarx.fsf@anie.imag.fr>
In-Reply-To
<1380741617-14593-1-git-send-email-ralf.thielow@gmail.com>
Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 9 quoted lines
> Hi,
>
> recently I did a merge where a complete repo shall be
> merged into a specific directory of another repo. I
> tried both the "subtree" merge strategy and the option
> "-Xsubtree=<dir>" of "recursive". I noticed that in both
> cases somehow the history of single files were lost
> during these merges (with history I mean 'git log <file>'
> and 'git log --follow <file>').

This is a known bug of "git log --follow": it does not follow accross subtree merge. But your history is still there (try gitk on your project for example).

Technically, a subtree merge is a merge commit in which files are renamed compared to the second parent. --follow does not manage this case.

Show 16 quoted lines
> diff --git a/t/t6029-merge-subtree.sh b/t/t6029-merge-subtree.sh
> index 73fc240..e9a97d7 100755
> --- a/t/t6029-merge-subtree.sh
> +++ b/t/t6029-merge-subtree.sh
> @@ -61,6 +61,14 @@ test_expect_success 'initial merge' '
>  	test_cmp expected actual
>  '
>  
> +test_expect_failure 'file keeps history after subtree merge' '
> +	cd ../git-gui &&
> +	git log --follow git-gui.sh >../git/expected &&
> +	cd ../git &&
> +	git log --follow git-gui/git-gui.sh >actual &&
> +	test_cmp expected actual
> +'
> +

That would actually be good to add a failing test to "document" the failure.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Ralf ThielowNext: Ralf Thielow
Message 2 of 5 in “Bug? Files are losing history after subtree merge”
  1. Ralf ThielowOct 2, 2013
  2. Matthieu MoyOct 2, 2013
  3. Ralf ThielowOct 2, 2013
  4. Matthieu MoyOct 2, 2013
  5. Ralf ThielowOct 2, 2013

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.