git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: git can't handle certain kinds of renames in merges
@ 2009-03-10 14:45 Caleb Cushing
  2009-03-10 16:02 ` Pieter de Bie
  0 siblings, 1 reply; 3+ messages in thread
From: Caleb Cushing @ 2009-03-10 14:45 UTC (permalink / raw)
  To: git

git actually sucks at some merges 101 :P. I'm going to have to play
with my test repository further because eventually I should be able to
get git-write-tree failures making any kind of 'merge' impossible.

git://github.com/xenoterracide/git-test-case.git

clone that. checkout branch 1. then git merge master to see my end failure.

steps to create

add a file in a branch with a line (or more).
create a new branch based on this branch and check it out.
in the new branch mv the file into a directory with the same name as
the file was. add -u and add the file so git sees the rename.
checkout the original branch add some lines. checkout the new branch
merge. the merge will go fine.
remove a line from the new branches file.
checkout master. add another line to that file.
checkout new branch and attempt to merge.

you should now see the point that may test case is at.
-- 
Caleb Cushing

http://xenoterracide.blogspot.com

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

* Re: BUG: git can't handle certain kinds of renames in merges
  2009-03-10 14:45 BUG: git can't handle certain kinds of renames in merges Caleb Cushing
@ 2009-03-10 16:02 ` Pieter de Bie
  2009-03-10 19:51   ` Caleb Cushing
  0 siblings, 1 reply; 3+ messages in thread
From: Pieter de Bie @ 2009-03-10 16:02 UTC (permalink / raw)
  To: Caleb Cushing; +Cc: git


On Mar 10, 2009, at 2:45 PM, Caleb Cushing wrote:

> git://github.com/xenoterracide/git-test-case.git
>
> clone that. checkout branch 1. then git merge master to see my end  
> failure.
>
> steps to create
>
> add a file in a branch with a line (or more).
> create a new branch based on this branch and check it out.
> in the new branch mv the file into a directory with the same name as
> the file was. add -u and add the file so git sees the rename.
> checkout the original branch add some lines. checkout the new branch
> merge. the merge will go fine.
> remove a line from the new branches file.
> checkout master. add another line to that file.
> checkout new branch and attempt to merge.
>
> you should now see the point that may test case is at.

Yes, this is because automatic renaming detection fails
with this kind of toy examples. Git can't infer the file
was renamed because almost nothing is similar enough. Take
a look at the attached script and run it with 'sh test.sh'
and 'sh test.sh real_test', and look at the difference.

- Pieter

#!/usr/bin/bish
if test x$1 = x
then
	EXTRA_LINES=""
else
	EXTRA_LINES="line2\nline3\nline4\nline5"
fi
FILE1="a\n$EXTRA_LINES"
FILE2="a\n$EXTRA_LINES\nb"
FILE3="$EXTRA_LINES\nb"
FILE4="a\n$EXTRA_LINES\nb\nc"

echo -e $FILE2
rm -rf test_dir
mkdir test_dir
cd test_dir
git init

echo -e $FILE1 > file
git add file
git commit -am "Initial"

git checkout -b branch
git mv file a
mkdir file
git mv a file/file
git commit -m "Move"

git checkout master
echo -e $FILE2 > file
git commit -am "Add a line"

git checkout branch
git merge master

echo -e $FILE3 > file/file
git commit -am "Remove line"

git checkout master
echo -e $FILE4 > file
git commit -am "Add another line"

git checkout branch
git merge master

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

* Re: BUG: git can't handle certain kinds of renames in merges
  2009-03-10 16:02 ` Pieter de Bie
@ 2009-03-10 19:51   ` Caleb Cushing
  0 siblings, 0 replies; 3+ messages in thread
From: Caleb Cushing @ 2009-03-10 19:51 UTC (permalink / raw)
  To: Pieter de Bie; +Cc: git

On Tue, Mar 10, 2009 at 12:02 PM, Pieter de Bie <pieter@frim.nl> wrote:
> ind of toy examples. Git can't infer the file
> was renamed because almost nothing is similar enough. Take
> a look at the attached script and run it with 'sh test.sh'
> and 'sh test.sh real_test', and look at the difference.

I've got a much bigger example(hundreds of lines, and dozens change at
a time)  which resolves in the same problem or worse with
git-tree-write errors. I'm trying to figure out now how to work around
this issue.

-- 
Caleb Cushing

http://xenoterracide.blogspot.com

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

end of thread, other threads:[~2009-03-10 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-10 14:45 BUG: git can't handle certain kinds of renames in merges Caleb Cushing
2009-03-10 16:02 ` Pieter de Bie
2009-03-10 19:51   ` Caleb Cushing

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 NNTP newsgroup(s).