From: Junio C Hamano <gitster@pobox.com>
To: Yaroslav Halchenko <yoh@onerussian.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: -X theirs does not resolve symlink conflict Was: BUG: merge -s theirs is not in effect
Date: Tue, 26 Sep 2017 11:39:57 +0900 [thread overview]
Message-ID: <xmqqa81ichdu.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqefqucigh.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Tue, 26 Sep 2017 11:16:46 +0900")
Junio C Hamano <gitster@pobox.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> I do not recall people talking about symbolic links but the case of
>> binary files has been on the wishlist for a long time, and I do not
>> know of anybody who is working on (or is planning to work on) it.
>
> Ah, I misremembered.
>
> We've addressed the "binary files" case back in 2012 with a944af1d
> ("merge: teach -Xours/-Xtheirs to binary ll-merge driver",
> 2012-09-08). I do not know offhand if it is just as easy to plumb
> the MERGE_FAVOR_{OURS,THEIRS} bits thru the symbolic link codepath,
> like that patch did to the binary file codepath.
Perhaps the attached (totally untested) patch might be a good
starting point. I do not know if you are interested in hacking on
Git, and I do not feel offended if you are not, but perhaps somebody
else might get interested in seeing if this #leftoverbits is a good
direction to go in, and finishing it with docs and tests if it is
;-)
merge-recursive.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 1d3f8f0d22..3605275ca3 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1026,10 +1026,19 @@ static int merge_file_1(struct merge_options *o,
&b->oid,
!o->call_depth);
} else if (S_ISLNK(a->mode)) {
- oidcpy(&result->oid, &a->oid);
-
- if (!oid_eq(&a->oid, &b->oid))
- result->clean = 0;
+ switch (o->recursive_variant) {
+ case MERGE_RECURSIVE_NORMAL:
+ oidcpy(&result->oid, &a->oid);
+ if (!oid_eq(&a->oid, &b->oid))
+ result->clean = 0;
+ break;
+ case MERGE_RECURSIVE_OURS:
+ oidcpy(&result->oid, &a->oid);
+ break;
+ case MERGE_RECURSIVE_THEIRS:
+ oidcpy(&result->oid, &b->oid);
+ break;
+ }
} else
die("BUG: unsupported object type in the tree");
}
next prev parent reply other threads:[~2017-09-26 2:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 0:02 BUG: merge -s theirs is not in effect (does the same as -s ours) Yaroslav Halchenko
2017-09-25 1:08 ` Junio C Hamano
2017-09-25 3:17 ` Yaroslav Halchenko
2017-09-25 5:33 ` Re* " Junio C Hamano
2017-09-25 14:30 ` -X theirs does not resolve symlink conflict Was: BUG: merge -s theirs is not in effect Yaroslav Halchenko
2017-09-26 1:56 ` Junio C Hamano
2017-09-26 2:16 ` Junio C Hamano
2017-09-26 2:39 ` Junio C Hamano [this message]
2017-09-26 13:37 ` Yaroslav Halchenko
2017-10-16 5:38 ` [PATCH] merge: teach -Xours/-Xtheirs to symbolic link merge Junio C Hamano
2017-12-29 2:49 ` Elijah Newren
2017-12-29 4:41 ` Yaroslav Halchenko
2018-01-25 4:35 ` external diff driver is not used for diff --stat? Yaroslav Halchenko
2017-09-25 14:40 ` -s theirs use-case(s) Was: BUG: merge -s theirs is not in effect Yaroslav Halchenko
2017-09-26 3:45 ` Junio C Hamano
2017-09-26 13:32 ` Yaroslav Halchenko
2017-09-27 0:09 ` Junio C Hamano
2017-09-27 5:19 ` Yaroslav Halchenko
2017-09-27 20:21 ` Yaroslav Halchenko
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=xmqqa81ichdu.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=yoh@onerussian.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.