summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-sh-setup.sh')
-rw-r--r--git-sh-setup.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 795edd2..2f78359 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -84,14 +84,14 @@ if test -n "$OPTIONS_SPEC"; then
else
dashless=$(basename "$0" | sed -e 's/-/ /')
usage() {
- die "Usage: $dashless $USAGE"
+ die "usage: $dashless $USAGE"
}
if [ -z "$LONG_USAGE" ]
then
- LONG_USAGE="Usage: $dashless $USAGE"
+ LONG_USAGE="usage: $dashless $USAGE"
else
- LONG_USAGE="Usage: $dashless $USAGE
+ LONG_USAGE="usage: $dashless $USAGE
$LONG_USAGE"
fi
@@ -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