# at the discretion of Junio C Hamano.
#
-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'
SUBDIRECTORY_OK=Yes
NONGIT_OK=Yes
OPTIONS_SPEC=
done
}
+print_noop_and_exit () {
+ echo "No files need merging"
+ exit 0
+}
+
main () {
prompt=$(git config --bool mergetool.prompt)
guessed_merge_tool=false
+ orderfile=
while test $# != 0
do
--prompt)
prompt=true
;;
+ -O*)
+ orderfile="$1"
+ ;;
--)
shift
break
merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)"
merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
- files=
-
- if test $# -eq 0
+ if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR"
then
- cd_to_toplevel
-
- if test -e "$GIT_DIR/MERGE_RR"
+ set -- $(git rerere remaining)
+ if test $# -eq 0
then
- files=$(git rerere remaining)
- else
- files=$(git ls-files -u |
- sed -e 's/^[^ ]* //' | sort -u)
+ print_noop_and_exit
fi
- else
- files=$(git ls-files -u -- "$@" |
- sed -e 's/^[^ ]* //' | sort -u)
fi
+ files=$(git -c core.quotePath=false \
+ diff --name-only --diff-filter=U \
+ ${orderfile:+"$orderfile"} -- "$@")
+
+ cd_to_toplevel
+
if test -z "$files"
then
- echo "No files need merging"
- exit 0
+ print_noop_and_exit
fi
printf "Merging:\n"