correct git merge behavior or corner case?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm the author of http://blog.teksol.info/2009/04/15/beware-of-gits-content-tracking.html

In http://article.gmane.org/gmane.comp.version-control.git/116954, Johannes was very critical of me, so here's the full story.

I cloned the repository and branched master to do some integration work. On the integration branch, I created an empty file. At one point, I merged from master and had some conflicts. While resolving the conflicts, I happened to notice a file that didn't exist on master had been modified.

Full transcript follows:

$ git checkout -b merge-tracking-reproduce 5b8520419833635c61bdfb9abbbdc086df512388 # integration branch
$ git merge 5ed60ecabd585972003084e07401f598d00f5a1d # master branch

$ git status
# On branch merge-tracking-reproduce
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
...
#       modified:   vendor/plugins/acts_as_money/LICENSE
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
... a couple of conflicts, they don't matter

$ git diff --cached vendor/plugins/acts_as_money/LICENSE
diff --git a/vendor/plugins/acts_as_money/LICENSE b/vendor/plugins/ acts_as_money/LICENSE
index e69de29..a273c73 100644
--- a/vendor/plugins/acts_as_money/LICENSE
+++ b/vendor/plugins/acts_as_money/LICENSE
@@ -0,0 +1,4 @@
+one:
+  user: active
+  name: name
+  description: description

$ git log 5b8520419833635c61bdfb9abbbdc086df512388 -- vendor/plugins/ acts_as_money/LICENSE # on integration branch
commit c25787637b6ac5d8f0783cf1688c9ce6fb135659
Author: François Beausoleil <francois@xxxxxxxxxxx>
Date:   Thu Apr 9 14:15:03 2009 -0400

    Added Quirky dependencies

$ git log 5ed60ecabd585972003084e07401f598d00f5a1d -- vendor/plugins/ acts_as_money/LICENSE # on master branch
# empty, no file by that name on master

$ git log "-Sdescription: description" 5b8520419833635c61bdfb9abbbdc086df512388 # on integration branch

$ git log "-Sdescription: description" 5ed60ecabd585972003084e07401f598d00f5a1d # on master branch
commit 36d2a29d0c3c3a2a51db5f3be9faea7cea7ff3c1
Author: Michael Lacy <mike@xxxxxxxxxxx>
Date:   Tue Apr 14 10:16:50 2009 -0400

    quirky voting

$ git diff 36d2a29d0c3c3a2a51db5f3be9faea7cea7ff3c1^.. 36d2a29d0c3c3a2a51db5f3be9faea7cea7ff3c1 -- vendor/gems/thoughtbot- shoulda-2.10.1/test/fixtures/products.yml diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/ products.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/
index e69de29..a273c73 100644
--- a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml
+++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml
@@ -0,0 +1,4 @@
+one:
+  user: active
+  name: name
+  description: description

Regarding Anders reproduction recipe, no file was deleted. I'm trying to write a reproduction script, but haven't managed to reproduce it just yet. The steps I *think* happened are thus:

cd $(mktemp -d repo.XXXXXX)
git init
touch README
git add README
git commit --message "First commit"
git checkout -b integration
mkdir -p vendor/a
touch vendor/a/LICENSE
git add vendor/a/LICENSE
git commit --message "Adding LICENSE"
git checkout master
mkdir -p vendor/b
touch vendor/b/COPYING
git add vendor/b/COPYING
git commit --message "Adding COPYING"
echo "adding some content" > vendor/b/COPYING
git commit --all --message "Updated COPYING"
git checkout integration
git merge master
git diff HEAD^..HEAD

But the bug isn't reproduced with these steps. If you want access to the repository, please contact me privately and I'll give you access.

Johannes, you were right: I should have found the right avenue for posting this question and done so. If not immediately, at least the next day. It was late, I had other things to do, I just decided to post a quick note. Call me lazy, yes. Incompetent, that's going a bit too far. I hope my competence can be redeemed in your eyes.

Have a nice day!
--
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]