Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-03-27 00:15:24 +0400
committerJunio C Hamano <gitster@pobox.com>2013-03-27 00:15:24 +0400
commit183f88018a849ae755b1efb7b63c58e38368e60f (patch)
treebda282f98cefd5cec0c9e780a5c069a3d0edaf42 /git-sh-setup.sh
parent7f95f2dce01e03532206d0998bca4cbdd8a660c7 (diff)
parent4fa5c0591a7b5c71c8ccf71d8401c3337b7867ad (diff)
Merge branch 'kb/p4merge'
Adjust the order mergetools feeds the files to the p4merge backend to match the p4 convention. * kb/p4merge: merge-one-file: force content conflict for "both sides added" case git-merge-one-file: send "ERROR:" messages to stderr git-merge-one-file: style cleanup merge-one-file: remove stale comment mergetools/p4merge: create a base if none available mergetools/p4merge: swap LOCAL and REMOTE
Diffstat (limited to 'git-sh-setup.sh')
-rw-r--r--git-sh-setup.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 9cfbe7f143..2f7835941e 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -249,6 +249,18 @@ clear_local_git_env() {
unset $(git rev-parse --local-env-vars)
}
+# Generate a virtual base file for a two-file merge. Uses git apply to
+# remove lines from $1 that are not in $2, leaving only common lines.
+create_virtual_base() {
+ sz0=$(wc -c <"$1")
+ @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ sz1=$(wc -c <"$1")
+
+ # 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 || : >"$1"
+}
+
# Platform specific tweaks to work around some commands
case $(uname -s) in