Re: [PATCH 2/2] p4merge: create a virtual base if none available
From: David Aguilar <hidden>
Date: 2016-06-15 22:56:19
On Wed, Mar 6, 2013 at 12:32 PM, Kevin Bracey [off-list ref] wrote:
+make_virtual_base() {
+ # Copied from git-merge-one-file.sh.
+ # This starts with $LOCAL, and uses git apply to
+ # remove lines that are not in $REMOTE.
+ cp -- "$LOCAL" "$BASE"
+ sz0=`wc -c <"$BASE"`
+ @@DIFF@@ -u -L"a/$BASE" -L"b/$BASE" "$BASE" "$REMOTE" | git apply --no-add
+ sz1=`wc -c <"$BASE"`
+
+ # If we do not have enough common material, it is not
+ # worth trying two-file merge using common subsections.
+ expr $sz0 \< $sz1 \* 2 >/dev/null || : >"$BASE"
+}This seems to be indented deeper then the other functions (or gmail is whitespace damaging my view). Please use one hard tab to indent here. We prefer $(command) instead of `command`. These should be adjusted. Also, the "@@DIFF@@" string may not work here. This is a template string that is replaced by the Makefile. I don't think the tools in the mergetools/ directory go through cmd_munge_script so this is not going to work as-is. Can the same thing be accomplished using "git diff --no-index" so that we do not need a dependency on an external "diff" command here? I am not a regular p4merge user myself so I'll defer to others on the cc: list for their thoughts. It does seem like a good idea, though. -- David