From: Marcin Owsiany <marcin@owsiany.pl>
To: git@vger.kernel.org
Subject: Cumulative "git read-tree -m" rejected with overwriting warning
Date: Wed, 13 Feb 2013 23:02:13 +0000 [thread overview]
Message-ID: <20130213230213.GT20333@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]
Hello,
Consider the following use case:
git init
seq 0 9 > f
git add f
git commit -m start
git checkout -b b1
perl -pi -e 's,0,b1,' f
git commit -a -m b1
git checkout -b b2
perl -pi -e 's,9,b2,' f
git commit -a -m b2
git checkout master
git merge b1 b1
As the changes to "f" don't conflict, the octopus merge deals with them
just fine, and I get a merge in a single commit object.
Now, let's say my b1 and b2 branches are a bit more special, and apart
from the main contents (i.e. the "f" file), each branch contains a
couple of files with branch-specific metadata. The names of those files
are the same in each branch. (People familiar with topgit can probably
guess I'm talking about topgit branches here.)
I'd like to merge all such branches into "master" in one octopus-like
commit, but the metadata files introduce a conflict during simple
octopus merge. However I don't care about that metadata when the
branches are merged into "master", so I'm trying to write a script which
would do such merge while discarding the metadata files.
The problem is, I cannot get it to work, when two branches modify the
same file (like "f" above), even if the changes don't conflict. I get
either:
error: Entry 'f' would be overwritten by merge. Cannot merge.
- when trying to use the two-arg form of "git read-tree -m -i"
or:
f: needs merge
- when trying to use the three-arg form
Attached is the minimal test case that reproduces the problem.
It might just be that git-read-tree cannot do what I need, and I'm just
misinterpreting the meaning of:
"the index file saves and restores with all this information, so you
can merge things incrementally,"
which I took to mean that I can read from multiple trees one by one
before writing the tree.
Could anyone give me some hints?
--
Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC
"Every program in development at MIT expands until it can read mail."
-- Unknown
[-- Attachment #2: testcase.sh --]
[-- Type: application/x-sh, Size: 1488 bytes --]
next reply other threads:[~2013-02-13 23:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 23:02 Marcin Owsiany [this message]
2013-02-13 23:40 ` Cumulative "git read-tree -m" rejected with overwriting warning Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130213230213.GT20333@localhost \
--to=marcin@owsiany.pl \
--cc=git@vger.kernel.org \
/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.
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).