[PATCH 6/9] git-sh-setup: move create_virtual_base() to mergetools/p4merge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move the create_virtual_base() function out of "git-sh-setup" to its
only user, "mergetools/p4merge". Since 1a92e53ba36 (merge-one-file:
use empty blob for add/add base, 2016-02-23) when
git-merge-one-file.sh stopped using it, it has only been used in
"mergetools/p4merge".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 Documentation/git-sh-setup.txt |  6 ------
 git-sh-setup.sh                | 12 ------------
 mergetools/p4merge             | 12 ++++++++++++
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt
index 1d8c87e9b2f..2febe754206 100644
--- a/Documentation/git-sh-setup.txt
+++ b/Documentation/git-sh-setup.txt
@@ -66,12 +66,6 @@ get_author_ident_from_commit::
 	outputs code for use with eval to set the GIT_AUTHOR_NAME,
 	GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.
 
-create_virtual_base::
-	modifies the first file so only lines in common with the
-	second file remain. If there is insufficient common material,
-	then the first file is left empty. The result is suitable
-	as a virtual base input for a 3-way merge.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 363c0096842..6a21238dc0e 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -238,18 +238,6 @@ 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
diff --git a/mergetools/p4merge b/mergetools/p4merge
index 7a5b291dd28..23f8735efa2 100644
--- a/mergetools/p4merge
+++ b/mergetools/p4merge
@@ -19,6 +19,18 @@ diff_cmd () {
 	fi
 }
 
+# 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"
+}
+
 merge_cmd () {
 	if ! $base_present
 	then
-- 
2.33.0.814.gb82868f05f3




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux