From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Hilco Wijbenga <hilco.wijbenga@gmail.com>,
Git Users <git@vger.kernel.org>
Subject: Re: Force Confirmation for Dropping Changed Lines
Date: Wed, 25 Jan 2017 18:32:24 -0800 [thread overview]
Message-ID: <xmqqd1fa7dqf.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CA+P7+xocc==-8ad-OVTahMDABA0-spDPEw05JTHopfO7Ovj2RQ@mail.gmail.com> (Jacob Keller's message of "Wed, 25 Jan 2017 16:40:38 -0800")
Jacob Keller <jacob.keller@gmail.com> writes:
> Setting the merge driver to "unset" will do what you want, but it
> would leave the current branch as the tentative answer and doesn't
> actually make it easy to resolve properly. That would only require
> putting "pom.xml merge=unset" in the .gitattributes file.
Where did you get that "unset" from? If that is this paragraph in
Documentation/gitattributes.txt:
Unset::
Take the version from the current branch as the
tentative merge result, and declare that the merge has
conflicts. This is suitable for binary files that do
not have a well-defined merge semantics.
you'd need to read the beginning of the file to learn how to declare
that an attribute is Unset for the path. merge=unset is setting it
to a string value, i.e. you are doing
String::
3-way merge is performed using the specified custom
merge driver. The built-in 3-way merge driver can be
explicitly specified by asking for "text" driver; the
built-in "take the current branch" driver can be
requested with "binary".
instead, specifying a custom merge driver "unset", which would
require something like
[merge "unset"]
name = feel-free merge driver
driver = filfre %O %A %B %L %P
recursive = binary
in your configuration file.
> That might be what you want, but it doesn't actually try to update the
> file during the merge so you'd have to hand-fix it yourself.
I think you should be able to do something like
$ cat >$HOME/bin/fail-3way <<\EOF
#!/bin/sh
git merge-file "$@"
exit 1
EOF
$ chmod +x $HOME/bin/fail-3way
$ cat >>$HOME/.gitconfig <<\EOF
[merge "fail"]
name = always fail 3-way merge
driver = $HOME/bin/fail-3way %A %O %B
recursive = text
EOF
$ echo pom.xml merge=fail >>.gitattributes
to define a custom merge driver whose name is "fail", that runs the
fail-3way program, which runs the bog standard 3-way merge we use
(so that it will do the best-effort textual merge) but always return
with a non-zero status to signal that the result is conflicting and
needs manual resolution.
next prev parent reply other threads:[~2017-01-26 2:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 22:16 Force Confirmation for Dropping Changed Lines Hilco Wijbenga
2017-01-25 22:24 ` Jacob Keller
2017-01-25 22:51 ` Hilco Wijbenga
2017-01-25 22:54 ` Jacob Keller
2017-01-25 23:46 ` Junio C Hamano
2017-01-25 23:57 ` Hilco Wijbenga
2017-01-26 0:40 ` Jacob Keller
2017-01-26 2:32 ` Junio C Hamano [this message]
2017-01-26 5:05 ` Jacob Keller
2017-01-26 19:19 ` Hilco Wijbenga
2017-01-26 20:51 ` 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=xmqqd1fa7dqf.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hilco.wijbenga@gmail.com \
--cc=jacob.keller@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox