From: Ciaran <ciaranj@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, David Aguilar <davvid@gmail.com>
Subject: Re: [RFC PATCH] Pass empty file to p4merge where no base is suitable.
Date: Sun, 1 May 2011 21:47:22 +0100 [thread overview]
Message-ID: <BANLkTimf1q8JM46J-X1BCwQ+GaeWAgv75Q@mail.gmail.com> (raw)
In-Reply-To: <7vwriq3p0t.fsf@alter.siamese.dyndns.org>
Modify the p4merge client command to pass a reference to an empty file
instead of the local file when no base revision available.
In the situation where a merge tries to add a file from one branch
into a branch that already contains that file (by name), p4merge
currently seems to have successfully automatically resolved the
'conflict' when it is opened (correctly if the files differed by
just whitespace for example) but leaves the save button disabled. This
means the user of the p4merge client cannot commit the resolved
changes back to disk and merely exits, leaving the original
(merge-conflicted) file in-tact on the disk.
Provide an empty base file to p4merge so that it leaves the save
button enabled. This will allow saving of the auto-resolution to
disk.
Please note that the empty file is temporarily stored in the location
specified as GIT_DIR/.no_base
Signed-off-by: Ciaran Jessup <ciaranj@gmail.com>
---
Continuation of the thread begun in:
http://marc.info/?l=git&m=130190735601527&w=2
> The calling script "git-mergetool.sh" seems to take pains to construct
> these filenames to have the same .ext, presumably so that the tool can
> take advantage of it to determine the type of contents and do something
> intelligent about it (e.g. syntax highlighting).
>
> Does the use of .no_base interfere with that effort?
It doesn't appear to (remember this patch just affects the p4merge
tool, and no others.)
>
> I suspect that you may be able to simply use "$BASE" for that, no? It
> will be cleaned up when cleanup_temp_files() is run anyway (warning: I do
> not use mergetool, and I am writing this only from my cursory looking of
> the script, so take this with a large grain of salt).
I don't think so, the BASE file isn't created at-all in this scenario afaict.
>
> Also, the command to use when you want to get an empty file is not "touch".
> It is not likely that you would have an existing file there, but the whole
> point of the updated codepath is to have an empty file, and not a file
> with recent timestamp, it would be far more sensible to say
>
> : >"$BASE"
>
> i.e. redirect into the path, with a no-op command.
Ok, my apologies perl isn't a language I'm overly familiar with :)
I've adapted the previous patch to take this on board. Thank you :)
--
git-mergetool--lib.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index fb3f52b..7b2008f 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -262,7 +262,9 @@ run_merge_tool () {
if $base_present; then
"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
else
- "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
+ : > "$GIT_DIR/.no_base"
+ "$merge_tool_path" "$GIT_DIR/.no_base" "$LOCAL" "$REMOTE" "$MERGED"
+ rm "$GIT_DIR/.no_base"
fi
check_unchanged
else
--
1.7.4.1
next prev parent reply other threads:[~2011-05-01 20:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 19:46 [RFC PATCH] Pass empty file to p4merge where no base is suitable Ciaran
2011-04-19 21:33 ` Junio C Hamano
2011-04-19 22:01 ` Junio C Hamano
2011-05-01 20:47 ` Ciaran [this message]
2011-05-01 21:54 ` Junio C Hamano
2011-05-01 22:08 ` Ciaran
2011-05-01 22:16 ` Ciaran
2011-05-01 23:55 ` Junio C Hamano
2011-05-02 0:01 ` Ciaran
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=BANLkTimf1q8JM46J-X1BCwQ+GaeWAgv75Q@mail.gmail.com \
--to=ciaranj@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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;
as well as URLs for NNTP newsgroup(s).