Added Cyg-Win
This commit is contained in:
parent
82cbc206eb
commit
413c315806
10586 changed files with 3806249 additions and 0 deletions
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-add.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-add.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-am.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-am.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-annotate.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-annotate.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-apply.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-apply.exe
Normal file
Binary file not shown.
1136
Agent-Windows/OGP64/usr/libexec/git-core/git-archimport
Normal file
1136
Agent-Windows/OGP64/usr/libexec/git-core/git-archimport
Normal file
File diff suppressed because it is too large
Load diff
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-archive.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-archive.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-backfill.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-backfill.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bisect.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bisect.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-blame.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-blame.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-branch.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-branch.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bugreport.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bugreport.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bundle.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-bundle.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cat-file.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cat-file.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-attr.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-attr.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-ignore.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-ignore.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-mailmap.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-check-mailmap.exe
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-checkout-index.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-checkout-index.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-checkout.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-checkout.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cherry-pick.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cherry-pick.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cherry.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-cherry.exe
Normal file
Binary file not shown.
3974
Agent-Windows/OGP64/usr/libexec/git-core/git-citool
Normal file
3974
Agent-Windows/OGP64/usr/libexec/git-core/git-citool
Normal file
File diff suppressed because it is too large
Load diff
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-clean.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-clean.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-clone.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-clone.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-column.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-column.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit-graph.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit-graph.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit-tree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit-tree.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-commit.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-config.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-config.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-count-objects.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-count-objects.exe
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-credential.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-credential.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-daemon.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-daemon.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-describe.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-describe.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diagnose.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diagnose.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-files.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-files.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-index.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-index.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-pairs.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-pairs.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-tree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff-tree.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-diff.exe
Normal file
Binary file not shown.
125
Agent-Windows/OGP64/usr/libexec/git-core/git-difftool--helper
Normal file
125
Agent-Windows/OGP64/usr/libexec/git-core/git-difftool--helper
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#!/bin/sh
|
||||
# git-difftool--helper is a GIT_EXTERNAL_DIFF-compatible diff tool launcher.
|
||||
# This script is typically launched by using the 'git difftool'
|
||||
# convenience command.
|
||||
#
|
||||
# Copyright (c) 2009, 2010 David Aguilar
|
||||
|
||||
TOOL_MODE=diff
|
||||
. git-mergetool--lib
|
||||
|
||||
# difftool.prompt controls the default prompt/no-prompt behavior
|
||||
# and is overridden with $GIT_DIFFTOOL*_PROMPT.
|
||||
should_prompt () {
|
||||
prompt_merge=$(git config --bool mergetool.prompt || echo true)
|
||||
prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
|
||||
if test "$prompt" = true
|
||||
then
|
||||
test -z "$GIT_DIFFTOOL_NO_PROMPT"
|
||||
else
|
||||
test -n "$GIT_DIFFTOOL_PROMPT"
|
||||
fi
|
||||
}
|
||||
|
||||
# Indicates that --extcmd=... was specified
|
||||
use_ext_cmd () {
|
||||
test -n "$GIT_DIFFTOOL_EXTCMD"
|
||||
}
|
||||
|
||||
launch_merge_tool () {
|
||||
# Merged is the filename as it appears in the work tree
|
||||
# Local is the contents of a/filename
|
||||
# Remote is the contents of b/filename
|
||||
# Custom merge tool commands might use $BASE so we provide it
|
||||
MERGED="$1"
|
||||
LOCAL="$2"
|
||||
REMOTE="$3"
|
||||
BASE="$1"
|
||||
|
||||
# $LOCAL and $REMOTE are temporary files so prompt
|
||||
# the user with the real $MERGED name before launching $merge_tool.
|
||||
if should_prompt
|
||||
then
|
||||
printf "\nViewing (%s/%s): '%s'\n" "$GIT_DIFF_PATH_COUNTER" \
|
||||
"$GIT_DIFF_PATH_TOTAL" "$MERGED"
|
||||
if use_ext_cmd
|
||||
then
|
||||
printf "Launch '%s' [Y/n]? " \
|
||||
"$GIT_DIFFTOOL_EXTCMD"
|
||||
else
|
||||
printf "Launch '%s' [Y/n]? " "$merge_tool"
|
||||
fi
|
||||
read ans || return
|
||||
if test "$ans" = n
|
||||
then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if use_ext_cmd
|
||||
then
|
||||
export BASE
|
||||
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
|
||||
else
|
||||
initialize_merge_tool "$merge_tool" || exit 1
|
||||
run_merge_tool "$merge_tool"
|
||||
fi
|
||||
}
|
||||
|
||||
if ! use_ext_cmd
|
||||
then
|
||||
if test -n "$GIT_DIFF_TOOL"
|
||||
then
|
||||
merge_tool="$GIT_DIFF_TOOL"
|
||||
else
|
||||
merge_tool="$(get_merge_tool)"
|
||||
subshell_exit_status=$?
|
||||
if test $subshell_exit_status -gt 1
|
||||
then
|
||||
exit $subshell_exit_status
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$GIT_DIFFTOOL_DIRDIFF"
|
||||
then
|
||||
LOCAL="$1"
|
||||
REMOTE="$2"
|
||||
initialize_merge_tool "$merge_tool" || exit 1
|
||||
run_merge_tool "$merge_tool" false
|
||||
|
||||
status=$?
|
||||
if test $status -ge 126
|
||||
then
|
||||
# Command not found (127), not executable (126) or
|
||||
# exited via a signal (>= 128).
|
||||
exit $status
|
||||
fi
|
||||
|
||||
if test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
|
||||
then
|
||||
exit $status
|
||||
fi
|
||||
else
|
||||
# Launch the merge tool on each path provided by 'git diff'
|
||||
while test $# -gt 6
|
||||
do
|
||||
launch_merge_tool "$1" "$2" "$5"
|
||||
status=$?
|
||||
if test $status -ge 126
|
||||
then
|
||||
# Command not found (127), not executable (126) or
|
||||
# exited via a signal (>= 128).
|
||||
exit $status
|
||||
fi
|
||||
|
||||
if test "$status" != 0 &&
|
||||
test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
|
||||
then
|
||||
exit $status
|
||||
fi
|
||||
shift 7
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-difftool.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-difftool.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fast-export.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fast-export.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fast-import.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fast-import.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fetch-pack.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fetch-pack.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fetch.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fetch.exe
Normal file
Binary file not shown.
665
Agent-Windows/OGP64/usr/libexec/git-core/git-filter-branch
Normal file
665
Agent-Windows/OGP64/usr/libexec/git-core/git-filter-branch
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Rewrite revision history
|
||||
# Copyright (c) Petr Baudis, 2006
|
||||
# Minimal changes to "port" it to core-git (c) Johannes Schindelin, 2007
|
||||
#
|
||||
# Lets you rewrite the revision history of the current branch, creating
|
||||
# a new branch. You can specify a number of filters to modify the commits,
|
||||
# files and trees.
|
||||
|
||||
# The following functions will also be available in the commit filter:
|
||||
|
||||
functions=$(cat << \EOF
|
||||
EMPTY_TREE=$(git hash-object -t tree /dev/null)
|
||||
|
||||
warn () {
|
||||
echo "$*" >&2
|
||||
}
|
||||
|
||||
map()
|
||||
{
|
||||
# if it was not rewritten, take the original
|
||||
if test -r "$workdir/../map/$1"
|
||||
then
|
||||
cat "$workdir/../map/$1"
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# if you run 'skip_commit "$@"' in a commit filter, it will print
|
||||
# the (mapped) parents, effectively skipping the commit.
|
||||
|
||||
skip_commit()
|
||||
{
|
||||
shift;
|
||||
while [ -n "$1" ];
|
||||
do
|
||||
shift;
|
||||
map "$1";
|
||||
shift;
|
||||
done;
|
||||
}
|
||||
|
||||
# if you run 'git_commit_non_empty_tree "$@"' in a commit filter,
|
||||
# it will skip commits that leave the tree untouched, commit the other.
|
||||
git_commit_non_empty_tree()
|
||||
{
|
||||
if test $# = 3 && test "$1" = $(git rev-parse "$3^{tree}"); then
|
||||
map "$3"
|
||||
elif test $# = 1 && test "$1" = $EMPTY_TREE; then
|
||||
:
|
||||
else
|
||||
git commit-tree "$@"
|
||||
fi
|
||||
}
|
||||
# override die(): this version puts in an extra line break, so that
|
||||
# the progress is still visible
|
||||
|
||||
die()
|
||||
{
|
||||
echo >&2
|
||||
echo "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
eval "$functions"
|
||||
|
||||
finish_ident() {
|
||||
# Ensure non-empty id name.
|
||||
echo "case \"\$GIT_$1_NAME\" in \"\") GIT_$1_NAME=\"\${GIT_$1_EMAIL%%@*}\" && export GIT_$1_NAME;; esac"
|
||||
# And make sure everything is exported.
|
||||
echo "export GIT_$1_NAME"
|
||||
echo "export GIT_$1_EMAIL"
|
||||
echo "export GIT_$1_DATE"
|
||||
}
|
||||
|
||||
set_ident () {
|
||||
parse_ident_from_commit author AUTHOR committer COMMITTER
|
||||
finish_ident AUTHOR
|
||||
finish_ident COMMITTER
|
||||
}
|
||||
|
||||
if test -z "$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS"
|
||||
then
|
||||
cat <<EOF
|
||||
WARNING: git-filter-branch has a glut of gotchas generating mangled history
|
||||
rewrites. Hit Ctrl-C before proceeding to abort, then use an
|
||||
alternative filtering tool such as 'git filter-repo'
|
||||
(https://github.com/newren/git-filter-repo/) instead. See the
|
||||
filter-branch manual page for more details; to squelch this warning,
|
||||
set FILTER_BRANCH_SQUELCH_WARNING=1.
|
||||
EOF
|
||||
sleep 10
|
||||
printf "Proceeding with filter-branch...\n\n"
|
||||
fi
|
||||
|
||||
USAGE="[--setup <command>] [--subdirectory-filter <directory>] [--env-filter <command>]
|
||||
[--tree-filter <command>] [--index-filter <command>]
|
||||
[--parent-filter <command>] [--msg-filter <command>]
|
||||
[--commit-filter <command>] [--tag-name-filter <command>]
|
||||
[--original <namespace>]
|
||||
[-d <directory>] [-f | --force] [--state-branch <branch>]
|
||||
[--] [<rev-list options>...]"
|
||||
|
||||
OPTIONS_SPEC=
|
||||
. git-sh-setup
|
||||
|
||||
if [ "$(is_bare_repository)" = false ]; then
|
||||
require_clean_work_tree 'rewrite branches'
|
||||
fi
|
||||
|
||||
tempdir=.git-rewrite
|
||||
filter_setup=
|
||||
filter_env=
|
||||
filter_tree=
|
||||
filter_index=
|
||||
filter_parent=
|
||||
filter_msg=cat
|
||||
filter_commit=
|
||||
filter_tag_name=
|
||||
filter_subdir=
|
||||
state_branch=
|
||||
orig_namespace=refs/original/
|
||||
force=
|
||||
prune_empty=
|
||||
remap_to_ancestor=
|
||||
while :
|
||||
do
|
||||
case "$1" in
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
--force|-f)
|
||||
shift
|
||||
force=t
|
||||
continue
|
||||
;;
|
||||
--remap-to-ancestor)
|
||||
# deprecated ($remap_to_ancestor is set now automatically)
|
||||
shift
|
||||
remap_to_ancestor=t
|
||||
continue
|
||||
;;
|
||||
--prune-empty)
|
||||
shift
|
||||
prune_empty=t
|
||||
continue
|
||||
;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
break;
|
||||
esac
|
||||
|
||||
# all switches take one argument
|
||||
ARG="$1"
|
||||
case "$#" in 1) usage ;; esac
|
||||
shift
|
||||
OPTARG="$1"
|
||||
shift
|
||||
|
||||
case "$ARG" in
|
||||
-d)
|
||||
tempdir="$OPTARG"
|
||||
;;
|
||||
--setup)
|
||||
filter_setup="$OPTARG"
|
||||
;;
|
||||
--subdirectory-filter)
|
||||
filter_subdir="$OPTARG"
|
||||
remap_to_ancestor=t
|
||||
;;
|
||||
--env-filter)
|
||||
filter_env="$OPTARG"
|
||||
;;
|
||||
--tree-filter)
|
||||
filter_tree="$OPTARG"
|
||||
;;
|
||||
--index-filter)
|
||||
filter_index="$OPTARG"
|
||||
;;
|
||||
--parent-filter)
|
||||
filter_parent="$OPTARG"
|
||||
;;
|
||||
--msg-filter)
|
||||
filter_msg="$OPTARG"
|
||||
;;
|
||||
--commit-filter)
|
||||
filter_commit="$functions; $OPTARG"
|
||||
;;
|
||||
--tag-name-filter)
|
||||
filter_tag_name="$OPTARG"
|
||||
;;
|
||||
--original)
|
||||
orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/
|
||||
;;
|
||||
--state-branch)
|
||||
state_branch="$OPTARG"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$prune_empty,$filter_commit" in
|
||||
,)
|
||||
filter_commit='git commit-tree "$@"';;
|
||||
t,)
|
||||
filter_commit="$functions;"' git_commit_non_empty_tree "$@"';;
|
||||
,*)
|
||||
;;
|
||||
*)
|
||||
die "Cannot set --prune-empty and --commit-filter at the same time"
|
||||
esac
|
||||
|
||||
case "$force" in
|
||||
t)
|
||||
rm -rf "$tempdir"
|
||||
;;
|
||||
'')
|
||||
test -d "$tempdir" &&
|
||||
die "$tempdir already exists, please remove it"
|
||||
esac
|
||||
orig_dir=$(pwd)
|
||||
mkdir -p "$tempdir/t" &&
|
||||
tempdir="$(cd "$tempdir"; pwd)" &&
|
||||
cd "$tempdir/t" &&
|
||||
workdir="$(pwd)" ||
|
||||
die ""
|
||||
|
||||
# Remove tempdir on exit
|
||||
trap 'cd "$orig_dir"; rm -rf "$tempdir"' 0
|
||||
|
||||
ORIG_GIT_DIR="$GIT_DIR"
|
||||
ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
|
||||
ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE"
|
||||
ORIG_GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME"
|
||||
ORIG_GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL"
|
||||
ORIG_GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE"
|
||||
ORIG_GIT_COMMITTER_NAME="$GIT_COMMITTER_NAME"
|
||||
ORIG_GIT_COMMITTER_EMAIL="$GIT_COMMITTER_EMAIL"
|
||||
ORIG_GIT_COMMITTER_DATE="$GIT_COMMITTER_DATE"
|
||||
|
||||
GIT_WORK_TREE=.
|
||||
export GIT_DIR GIT_WORK_TREE
|
||||
|
||||
# Make sure refs/original is empty
|
||||
git for-each-ref > "$tempdir"/backup-refs || exit
|
||||
while read sha1 type name
|
||||
do
|
||||
case "$force,$name" in
|
||||
,$orig_namespace*)
|
||||
die "Cannot create a new backup.
|
||||
A previous backup already exists in $orig_namespace
|
||||
Force overwriting the backup with -f"
|
||||
;;
|
||||
t,$orig_namespace*)
|
||||
git update-ref -d "$name" $sha1
|
||||
;;
|
||||
esac
|
||||
done < "$tempdir"/backup-refs
|
||||
|
||||
# The refs should be updated if their heads were rewritten
|
||||
git rev-parse --no-flags --revs-only --symbolic-full-name \
|
||||
--default HEAD "$@" > "$tempdir"/raw-refs || exit
|
||||
while read ref
|
||||
do
|
||||
case "$ref" in ^?*) continue ;; esac
|
||||
|
||||
if git rev-parse --verify "$ref"^0 >/dev/null 2>&1
|
||||
then
|
||||
echo "$ref"
|
||||
else
|
||||
warn "WARNING: not rewriting '$ref' (not a committish)"
|
||||
fi
|
||||
done >"$tempdir"/heads <"$tempdir"/raw-refs
|
||||
|
||||
test -s "$tempdir"/heads ||
|
||||
die "You must specify a ref to rewrite."
|
||||
|
||||
GIT_INDEX_FILE="$(pwd)/../index"
|
||||
export GIT_INDEX_FILE
|
||||
|
||||
# map old->new commit ids for rewriting parents
|
||||
mkdir ../map || die "Could not create map/ directory"
|
||||
|
||||
if test -n "$state_branch"
|
||||
then
|
||||
state_commit=$(git rev-parse --no-flags --revs-only "$state_branch")
|
||||
if test -n "$state_commit"
|
||||
then
|
||||
echo "Populating map from $state_branch ($state_commit)" 1>&2
|
||||
|
||||
git show "$state_commit:filter.map" >"$tempdir"/filter-map ||
|
||||
die "Unable to load state from $state_branch:filter.map"
|
||||
while read line
|
||||
do
|
||||
case "$line" in
|
||||
*:*)
|
||||
echo "${line%:*}" >../map/"${line#*:}";;
|
||||
*)
|
||||
die "Unable to load state from $state_branch:filter.map";;
|
||||
esac
|
||||
done <"$tempdir"/filter-map
|
||||
else
|
||||
echo "Branch $state_branch does not exist. Will create" 1>&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# we need "--" only if there are no path arguments in $@
|
||||
nonrevs=$(git rev-parse --no-revs "$@") || exit
|
||||
if test -z "$nonrevs"
|
||||
then
|
||||
dashdash=--
|
||||
else
|
||||
dashdash=
|
||||
remap_to_ancestor=t
|
||||
fi
|
||||
|
||||
git rev-parse --revs-only "$@" >../parse
|
||||
|
||||
case "$filter_subdir" in
|
||||
"")
|
||||
eval set -- "$(git rev-parse --sq --no-revs "$@")"
|
||||
;;
|
||||
*)
|
||||
eval set -- "$(git rev-parse --sq --no-revs "$@" $dashdash \
|
||||
"$filter_subdir")"
|
||||
;;
|
||||
esac
|
||||
|
||||
git rev-list --reverse --topo-order --default HEAD \
|
||||
--parents --simplify-merges --stdin "$@" <../parse >../revs ||
|
||||
die "Could not get the commits"
|
||||
commits=$(wc -l <../revs | tr -d " ")
|
||||
|
||||
test $commits -eq 0 && die_with_status 2 "Found nothing to rewrite"
|
||||
|
||||
# Rewrite the commits
|
||||
report_progress ()
|
||||
{
|
||||
if test -n "$progress" &&
|
||||
test $git_filter_branch__commit_count -gt $next_sample_at
|
||||
then
|
||||
count=$git_filter_branch__commit_count
|
||||
|
||||
now=$(date +%s)
|
||||
elapsed=$(($now - $start_timestamp))
|
||||
remaining=$(( ($commits - $count) * $elapsed / $count ))
|
||||
if test $elapsed -gt 0
|
||||
then
|
||||
next_sample_at=$(( ($elapsed + 1) * $count / $elapsed ))
|
||||
else
|
||||
next_sample_at=$(($next_sample_at + 1))
|
||||
fi
|
||||
progress=" ($elapsed seconds passed, remaining $remaining predicted)"
|
||||
fi
|
||||
printf "\rRewrite $commit ($count/$commits)$progress "
|
||||
}
|
||||
|
||||
git_filter_branch__commit_count=0
|
||||
|
||||
progress= start_timestamp=
|
||||
if date '+%s' 2>/dev/null | grep -q '^[0-9][0-9]*$'
|
||||
then
|
||||
next_sample_at=0
|
||||
progress="dummy to ensure this is not empty"
|
||||
start_timestamp=$(date '+%s')
|
||||
fi
|
||||
|
||||
if test -n "$filter_index" ||
|
||||
test -n "$filter_tree" ||
|
||||
test -n "$filter_subdir"
|
||||
then
|
||||
need_index=t
|
||||
else
|
||||
need_index=
|
||||
fi
|
||||
|
||||
eval "$filter_setup" < /dev/null ||
|
||||
die "filter setup failed: $filter_setup"
|
||||
|
||||
while read commit parents; do
|
||||
git_filter_branch__commit_count=$(($git_filter_branch__commit_count+1))
|
||||
|
||||
report_progress
|
||||
test -f "$workdir"/../map/$commit && continue
|
||||
|
||||
case "$filter_subdir" in
|
||||
"")
|
||||
if test -n "$need_index"
|
||||
then
|
||||
GIT_ALLOW_NULL_SHA1=1 git read-tree -i -m $commit
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# The commit may not have the subdirectory at all
|
||||
err=$(GIT_ALLOW_NULL_SHA1=1 \
|
||||
git read-tree -i -m $commit:"$filter_subdir" 2>&1) || {
|
||||
if ! git rev-parse -q --verify $commit:"$filter_subdir"
|
||||
then
|
||||
rm -f "$GIT_INDEX_FILE"
|
||||
else
|
||||
echo >&2 "$err"
|
||||
false
|
||||
fi
|
||||
}
|
||||
esac || die "Could not initialize the index"
|
||||
|
||||
GIT_COMMIT=$commit
|
||||
export GIT_COMMIT
|
||||
git cat-file commit "$commit" >../commit ||
|
||||
die "Cannot read commit $commit"
|
||||
|
||||
eval "$(set_ident <../commit)" ||
|
||||
die "setting author/committer failed for commit $commit"
|
||||
eval "$filter_env" < /dev/null ||
|
||||
die "env filter failed: $filter_env"
|
||||
|
||||
if [ "$filter_tree" ]; then
|
||||
git checkout-index -f -u -a ||
|
||||
die "Could not checkout the index"
|
||||
# files that $commit removed are now still in the working tree;
|
||||
# remove them, else they would be added again
|
||||
git clean -d -q -f -x
|
||||
eval "$filter_tree" < /dev/null ||
|
||||
die "tree filter failed: $filter_tree"
|
||||
|
||||
(
|
||||
git diff-index -r --name-only --ignore-submodules $commit -- &&
|
||||
git ls-files --others
|
||||
) > "$tempdir"/tree-state || exit
|
||||
git update-index --add --replace --remove --stdin \
|
||||
< "$tempdir"/tree-state || exit
|
||||
fi
|
||||
|
||||
eval "$filter_index" < /dev/null ||
|
||||
die "index filter failed: $filter_index"
|
||||
|
||||
parentstr=
|
||||
for parent in $parents; do
|
||||
for reparent in $(map "$parent"); do
|
||||
case "$parentstr " in
|
||||
*" -p $reparent "*)
|
||||
;;
|
||||
*)
|
||||
parentstr="$parentstr -p $reparent"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
if [ "$filter_parent" ]; then
|
||||
parentstr="$(echo "$parentstr" | eval "$filter_parent")" ||
|
||||
die "parent filter failed: $filter_parent"
|
||||
fi
|
||||
|
||||
{
|
||||
while IFS='' read -r header_line && test -n "$header_line"
|
||||
do
|
||||
# skip header lines...
|
||||
:;
|
||||
done
|
||||
# and output the actual commit message
|
||||
cat
|
||||
} <../commit |
|
||||
eval "$filter_msg" > ../message ||
|
||||
die "msg filter failed: $filter_msg"
|
||||
|
||||
if test -n "$need_index"
|
||||
then
|
||||
tree=$(git write-tree)
|
||||
else
|
||||
tree=$(git rev-parse "$commit^{tree}")
|
||||
fi
|
||||
workdir=$workdir /bin/sh -c "$filter_commit" "git commit-tree" \
|
||||
"$tree" $parentstr < ../message > ../map/$commit ||
|
||||
die "could not write rewritten commit"
|
||||
done <../revs
|
||||
|
||||
# If we are filtering for paths, as in the case of a subdirectory
|
||||
# filter, it is possible that a specified head is not in the set of
|
||||
# rewritten commits, because it was pruned by the revision walker.
|
||||
# Ancestor remapping fixes this by mapping these heads to the unique
|
||||
# nearest ancestor that survived the pruning.
|
||||
|
||||
if test "$remap_to_ancestor" = t
|
||||
then
|
||||
while read ref
|
||||
do
|
||||
sha1=$(git rev-parse "$ref"^0)
|
||||
test -f "$workdir"/../map/$sha1 && continue
|
||||
ancestor=$(git rev-list --simplify-merges -1 "$ref" "$@")
|
||||
test "$ancestor" && echo $(map $ancestor) >"$workdir"/../map/$sha1
|
||||
done < "$tempdir"/heads
|
||||
fi
|
||||
|
||||
# Finally update the refs
|
||||
|
||||
echo
|
||||
while read ref
|
||||
do
|
||||
# avoid rewriting a ref twice
|
||||
test -f "$orig_namespace$ref" && continue
|
||||
|
||||
sha1=$(git rev-parse "$ref"^0)
|
||||
rewritten=$(map $sha1)
|
||||
|
||||
test $sha1 = "$rewritten" &&
|
||||
warn "WARNING: Ref '$ref' is unchanged" &&
|
||||
continue
|
||||
|
||||
case "$rewritten" in
|
||||
'')
|
||||
echo "Ref '$ref' was deleted"
|
||||
git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
|
||||
die "Could not delete $ref"
|
||||
;;
|
||||
*)
|
||||
echo "Ref '$ref' was rewritten"
|
||||
if ! git update-ref -m "filter-branch: rewrite" \
|
||||
"$ref" $rewritten $sha1 2>/dev/null; then
|
||||
if test $(git cat-file -t "$ref") = tag; then
|
||||
if test -z "$filter_tag_name"; then
|
||||
warn "WARNING: You said to rewrite tagged commits, but not the corresponding tag."
|
||||
warn "WARNING: Perhaps use '--tag-name-filter cat' to rewrite the tag."
|
||||
fi
|
||||
else
|
||||
die "Could not rewrite $ref"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1 ||
|
||||
exit
|
||||
done < "$tempdir"/heads
|
||||
|
||||
# TODO: This should possibly go, with the semantics that all positive given
|
||||
# refs are updated, and their original heads stored in refs/original/
|
||||
# Filter tags
|
||||
|
||||
if [ "$filter_tag_name" ]; then
|
||||
git for-each-ref --format='%(objectname) %(objecttype) %(refname)' refs/tags |
|
||||
while read sha1 type ref; do
|
||||
ref="${ref#refs/tags/}"
|
||||
# XXX: Rewrite tagged trees as well?
|
||||
if [ "$type" != "commit" -a "$type" != "tag" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
if [ "$type" = "tag" ]; then
|
||||
# Dereference to a commit
|
||||
sha1t="$sha1"
|
||||
sha1="$(git rev-parse -q "$sha1"^{commit})" || continue
|
||||
fi
|
||||
|
||||
[ -f "../map/$sha1" ] || continue
|
||||
new_sha1="$(cat "../map/$sha1")"
|
||||
GIT_COMMIT="$sha1"
|
||||
export GIT_COMMIT
|
||||
new_ref="$(echo "$ref" | eval "$filter_tag_name")" ||
|
||||
die "tag name filter failed: $filter_tag_name"
|
||||
|
||||
echo "$ref -> $new_ref ($sha1 -> $new_sha1)"
|
||||
|
||||
if [ "$type" = "tag" ]; then
|
||||
new_sha1=$( ( printf 'object %s\ntype commit\ntag %s\n' \
|
||||
"$new_sha1" "$new_ref"
|
||||
git cat-file tag "$ref" |
|
||||
sed -n \
|
||||
-e '1,/^$/{
|
||||
/^object /d
|
||||
/^type /d
|
||||
/^tag /d
|
||||
}' \
|
||||
-e '/^-----BEGIN PGP SIGNATURE-----/q' \
|
||||
-e 'p' ) |
|
||||
git hash-object -t tag -w --stdin) ||
|
||||
die "Could not create new tag object for $ref"
|
||||
if git cat-file tag "$ref" | \
|
||||
grep '^-----BEGIN PGP SIGNATURE-----' >/dev/null 2>&1
|
||||
then
|
||||
warn "gpg signature stripped from tag object $sha1t"
|
||||
fi
|
||||
fi
|
||||
|
||||
git update-ref "refs/tags/$new_ref" "$new_sha1" ||
|
||||
die "Could not write tag $new_ref"
|
||||
done
|
||||
fi
|
||||
|
||||
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
|
||||
unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
|
||||
unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
|
||||
test -z "$ORIG_GIT_DIR" || {
|
||||
GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
|
||||
}
|
||||
test -z "$ORIG_GIT_WORK_TREE" || {
|
||||
GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
|
||||
export GIT_WORK_TREE
|
||||
}
|
||||
test -z "$ORIG_GIT_INDEX_FILE" || {
|
||||
GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
|
||||
export GIT_INDEX_FILE
|
||||
}
|
||||
test -z "$ORIG_GIT_AUTHOR_NAME" || {
|
||||
GIT_AUTHOR_NAME="$ORIG_GIT_AUTHOR_NAME" &&
|
||||
export GIT_AUTHOR_NAME
|
||||
}
|
||||
test -z "$ORIG_GIT_AUTHOR_EMAIL" || {
|
||||
GIT_AUTHOR_EMAIL="$ORIG_GIT_AUTHOR_EMAIL" &&
|
||||
export GIT_AUTHOR_EMAIL
|
||||
}
|
||||
test -z "$ORIG_GIT_AUTHOR_DATE" || {
|
||||
GIT_AUTHOR_DATE="$ORIG_GIT_AUTHOR_DATE" &&
|
||||
export GIT_AUTHOR_DATE
|
||||
}
|
||||
test -z "$ORIG_GIT_COMMITTER_NAME" || {
|
||||
GIT_COMMITTER_NAME="$ORIG_GIT_COMMITTER_NAME" &&
|
||||
export GIT_COMMITTER_NAME
|
||||
}
|
||||
test -z "$ORIG_GIT_COMMITTER_EMAIL" || {
|
||||
GIT_COMMITTER_EMAIL="$ORIG_GIT_COMMITTER_EMAIL" &&
|
||||
export GIT_COMMITTER_EMAIL
|
||||
}
|
||||
test -z "$ORIG_GIT_COMMITTER_DATE" || {
|
||||
GIT_COMMITTER_DATE="$ORIG_GIT_COMMITTER_DATE" &&
|
||||
export GIT_COMMITTER_DATE
|
||||
}
|
||||
|
||||
if test -n "$state_branch"
|
||||
then
|
||||
echo "Saving rewrite state to $state_branch" 1>&2
|
||||
state_blob=$(
|
||||
for file in ../map/*
|
||||
do
|
||||
from_commit=$(basename "$file")
|
||||
to_commit=$(cat "$file")
|
||||
echo "$from_commit:$to_commit"
|
||||
done | git hash-object -w --stdin || die "Unable to save state"
|
||||
)
|
||||
state_tree=$(printf '100644 blob %s\tfilter.map\n' "$state_blob" | git mktree)
|
||||
if test -n "$state_commit"
|
||||
then
|
||||
state_commit=$(echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
|
||||
else
|
||||
state_commit=$(echo "Sync" | git commit-tree "$state_tree" )
|
||||
fi
|
||||
git update-ref "$state_branch" "$state_commit"
|
||||
fi
|
||||
|
||||
cd "$orig_dir"
|
||||
rm -rf "$tempdir"
|
||||
|
||||
trap - 0
|
||||
|
||||
if [ "$(is_bare_repository)" = false ]; then
|
||||
git read-tree -u -m HEAD || exit
|
||||
fi
|
||||
|
||||
exit 0
|
||||
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fmt-merge-msg.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fmt-merge-msg.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-for-each-ref.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-for-each-ref.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-for-each-repo.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-for-each-repo.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-format-patch.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-format-patch.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fsck-objects.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fsck-objects.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fsck.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-fsck.exe
Normal file
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-gc.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-gc.exe
Normal file
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-grep.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-grep.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-hash-object.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-hash-object.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-help.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-help.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-hook.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-hook.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-backend.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-backend.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-fetch.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-fetch.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-push.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-http-push.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-imap-send.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-imap-send.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-index-pack.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-index-pack.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-init-db.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-init-db.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-init.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-init.exe
Normal file
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-log.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-log.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-files.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-files.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-remote.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-remote.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-tree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-ls-tree.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mailinfo.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mailinfo.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mailsplit.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mailsplit.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-maintenance.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-maintenance.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-base.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-base.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-file.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-file.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-index.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-index.exe
Normal file
Binary file not shown.
112
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-octopus
Normal file
112
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-octopus
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
# Resolve two or more trees.
|
||||
#
|
||||
|
||||
. git-sh-setup
|
||||
|
||||
LF='
|
||||
'
|
||||
|
||||
# The first parameters up to -- are merge bases; the rest are heads.
|
||||
bases= head= remotes= sep_seen=
|
||||
for arg
|
||||
do
|
||||
case ",$sep_seen,$head,$arg," in
|
||||
*,--,)
|
||||
sep_seen=yes
|
||||
;;
|
||||
,yes,,*)
|
||||
head=$arg
|
||||
;;
|
||||
,yes,*)
|
||||
remotes="$remotes$arg "
|
||||
;;
|
||||
*)
|
||||
bases="$bases$arg "
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Reject if this is not an octopus -- resolve should be used instead.
|
||||
case "$remotes" in
|
||||
?*' '?*)
|
||||
;;
|
||||
*)
|
||||
exit 2 ;;
|
||||
esac
|
||||
|
||||
# MRC is the current "merge reference commit"
|
||||
# MRT is the current "merge result tree"
|
||||
|
||||
if ! git diff-index --quiet --cached HEAD --
|
||||
then
|
||||
gettextln "Error: Your local changes to the following files would be overwritten by merge"
|
||||
git diff-index --cached --name-only HEAD -- | sed -e 's/^/ /'
|
||||
exit 2
|
||||
fi
|
||||
MRC=$(git rev-parse --verify -q $head)
|
||||
MRT=$(git write-tree)
|
||||
NON_FF_MERGE=0
|
||||
OCTOPUS_FAILURE=0
|
||||
for SHA1 in $remotes
|
||||
do
|
||||
case "$OCTOPUS_FAILURE" in
|
||||
1)
|
||||
# We allow only last one to have a hand-resolvable
|
||||
# conflicts. Last round failed and we still had
|
||||
# a head to merge.
|
||||
gettextln "Automated merge did not work."
|
||||
gettextln "Should not be doing an octopus."
|
||||
exit 2
|
||||
esac
|
||||
|
||||
eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
|
||||
if test "$SHA1" = "$pretty_name"
|
||||
then
|
||||
SHA1_UP="$(echo "$SHA1" | tr a-z A-Z)"
|
||||
eval pretty_name=\${GITHEAD_$SHA1_UP:-$pretty_name}
|
||||
fi
|
||||
common=$(git merge-base --all $SHA1 $MRC) ||
|
||||
die "$(eval_gettext "Unable to find common commit with \$pretty_name")"
|
||||
|
||||
case "$LF$common$LF" in
|
||||
*"$LF$SHA1$LF"*)
|
||||
eval_gettextln "Already up to date with \$pretty_name"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$common,$NON_FF_MERGE" = "$MRC,0"
|
||||
then
|
||||
# The first head being merged was a fast-forward.
|
||||
# Advance MRC to the head being merged, and use that
|
||||
# tree as the intermediate result of the merge.
|
||||
# We still need to count this as part of the parent set.
|
||||
|
||||
eval_gettextln "Fast-forwarding to: \$pretty_name"
|
||||
git read-tree -u -m $head $SHA1 || exit
|
||||
MRC=$SHA1 MRT=$(git write-tree)
|
||||
continue
|
||||
fi
|
||||
|
||||
NON_FF_MERGE=1
|
||||
|
||||
eval_gettextln "Trying simple merge with \$pretty_name"
|
||||
git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
|
||||
next=$(git write-tree 2>/dev/null)
|
||||
if test $? -ne 0
|
||||
then
|
||||
gettextln "Simple merge did not work, trying automatic merge."
|
||||
git merge-index -o git-merge-one-file -a ||
|
||||
OCTOPUS_FAILURE=1
|
||||
next=$(git write-tree 2>/dev/null)
|
||||
fi
|
||||
|
||||
MRC="$MRC $SHA1"
|
||||
MRT=$next
|
||||
done
|
||||
|
||||
exit "$OCTOPUS_FAILURE"
|
||||
167
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-one-file
Normal file
167
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-one-file
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) Linus Torvalds, 2005
|
||||
#
|
||||
# This is the git per-file merge script, called with
|
||||
#
|
||||
# $1 - original file SHA1 (or empty)
|
||||
# $2 - file in branch1 SHA1 (or empty)
|
||||
# $3 - file in branch2 SHA1 (or empty)
|
||||
# $4 - pathname in repository
|
||||
# $5 - original file mode (or empty)
|
||||
# $6 - file in branch1 mode (or empty)
|
||||
# $7 - file in branch2 mode (or empty)
|
||||
#
|
||||
# Handle some trivial cases.. The _really_ trivial cases have
|
||||
# been handled already by git read-tree, but that one doesn't
|
||||
# do any merges that might change the tree layout.
|
||||
|
||||
USAGE='<orig blob> <our blob> <their blob> <path>'
|
||||
USAGE="$USAGE <orig mode> <our mode> <their mode>"
|
||||
LONG_USAGE="usage: git merge-one-file $USAGE
|
||||
|
||||
Blob ids and modes should be empty for missing files."
|
||||
|
||||
SUBDIRECTORY_OK=Yes
|
||||
. git-sh-setup
|
||||
cd_to_toplevel
|
||||
require_work_tree
|
||||
|
||||
if test $# != 7
|
||||
then
|
||||
echo "$LONG_USAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "${1:-.}${2:-.}${3:-.}" in
|
||||
#
|
||||
# Deleted in both or deleted in one and unchanged in the other
|
||||
#
|
||||
"$1.." | "$1.$1" | "$1$1.")
|
||||
if { test -z "$6" && test "$5" != "$7"; } ||
|
||||
{ test -z "$7" && test "$5" != "$6"; }
|
||||
then
|
||||
echo "ERROR: File $4 deleted on one branch but had its" >&2
|
||||
echo "ERROR: permissions changed on the other." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$2"
|
||||
then
|
||||
echo "Removing $4"
|
||||
else
|
||||
# read-tree checked that index matches HEAD already,
|
||||
# so we know we do not have this path tracked.
|
||||
# there may be an unrelated working tree file here,
|
||||
# which we should just leave unmolested. Make sure
|
||||
# we do not have it in the index, though.
|
||||
exec git update-index --remove -- "$4"
|
||||
fi
|
||||
if test -f "$4"
|
||||
then
|
||||
rm -f -- "$4" &&
|
||||
rmdir -p "$(expr "z$4" : 'z\(.*\)/')" 2>/dev/null || :
|
||||
fi &&
|
||||
exec git update-index --remove -- "$4"
|
||||
;;
|
||||
|
||||
#
|
||||
# Added in one.
|
||||
#
|
||||
".$2.")
|
||||
# the other side did not add and we added so there is nothing
|
||||
# to be done, except making the path merged.
|
||||
exec git update-index --add --cacheinfo "$6" "$2" "$4"
|
||||
;;
|
||||
"..$3")
|
||||
echo "Adding $4"
|
||||
if test -f "$4"
|
||||
then
|
||||
echo "ERROR: untracked $4 is overwritten by the merge." >&2
|
||||
exit 1
|
||||
fi
|
||||
git update-index --add --cacheinfo "$7" "$3" "$4" &&
|
||||
exec git checkout-index -u -f -- "$4"
|
||||
;;
|
||||
|
||||
#
|
||||
# Added in both, identically (check for same permissions).
|
||||
#
|
||||
".$3$2")
|
||||
if test "$6" != "$7"
|
||||
then
|
||||
echo "ERROR: File $4 added identically in both branches," >&2
|
||||
echo "ERROR: but permissions conflict $6->$7." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Adding $4"
|
||||
git update-index --add --cacheinfo "$6" "$2" "$4" &&
|
||||
exec git checkout-index -u -f -- "$4"
|
||||
;;
|
||||
|
||||
#
|
||||
# Modified in both, but differently.
|
||||
#
|
||||
"$1$2$3" | ".$2$3")
|
||||
|
||||
case ",$6,$7," in
|
||||
*,120000,*)
|
||||
echo "ERROR: $4: Not merging symbolic link changes." >&2
|
||||
exit 1
|
||||
;;
|
||||
*,160000,*)
|
||||
echo "ERROR: $4: Not merging conflicting submodule changes." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
src1=$(git unpack-file $2)
|
||||
src2=$(git unpack-file $3)
|
||||
case "$1" in
|
||||
'')
|
||||
echo "Added $4 in both, but differently."
|
||||
orig=$(git unpack-file $(git hash-object /dev/null))
|
||||
;;
|
||||
*)
|
||||
echo "Auto-merging $4"
|
||||
orig=$(git unpack-file $1)
|
||||
;;
|
||||
esac
|
||||
|
||||
git merge-file "$src1" "$orig" "$src2"
|
||||
ret=$?
|
||||
msg=
|
||||
if test $ret != 0 || test -z "$1"
|
||||
then
|
||||
msg='content conflict'
|
||||
ret=1
|
||||
fi
|
||||
|
||||
# Create the working tree file, using "our tree" version from the
|
||||
# index, and then store the result of the merge.
|
||||
git checkout-index -f --stage=2 -- "$4" && cat "$src1" >"$4" || exit 1
|
||||
rm -f -- "$orig" "$src1" "$src2"
|
||||
|
||||
if test "$6" != "$7"
|
||||
then
|
||||
if test -n "$msg"
|
||||
then
|
||||
msg="$msg, "
|
||||
fi
|
||||
msg="${msg}permissions conflict: $5->$6,$7"
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if test $ret != 0
|
||||
then
|
||||
echo "ERROR: $msg in $4" >&2
|
||||
exit 1
|
||||
fi
|
||||
exec git update-index -- "$4"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "ERROR: $4: Not handling case $1 -> $2 -> $3" >&2
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-ours.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-ours.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-recursive.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-recursive.exe
Normal file
Binary file not shown.
64
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-resolve
Normal file
64
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-resolve
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
# Resolve two trees, using enhanced multi-base read-tree.
|
||||
|
||||
. git-sh-setup
|
||||
|
||||
# Abort if index does not match HEAD
|
||||
if ! git diff-index --quiet --cached HEAD --
|
||||
then
|
||||
gettextln "Error: Your local changes to the following files would be overwritten by merge"
|
||||
git diff-index --cached --name-only HEAD -- | sed -e 's/^/ /'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# The first parameters up to -- are merge bases; the rest are heads.
|
||||
bases= head= remotes= sep_seen=
|
||||
for arg
|
||||
do
|
||||
case ",$sep_seen,$head,$arg," in
|
||||
*,--,)
|
||||
sep_seen=yes
|
||||
;;
|
||||
,yes,,*)
|
||||
head=$arg
|
||||
;;
|
||||
,yes,*)
|
||||
remotes="$remotes$arg "
|
||||
;;
|
||||
*)
|
||||
bases="$bases$arg "
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Give up if we are given two or more remotes -- not handling octopus.
|
||||
case "$remotes" in
|
||||
?*' '?*)
|
||||
exit 2 ;;
|
||||
esac
|
||||
|
||||
# Give up if this is a baseless merge.
|
||||
if test '' = "$bases"
|
||||
then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
git update-index -q --refresh
|
||||
git read-tree -u -m --aggressive $bases $head $remotes || exit 2
|
||||
echo "Trying simple merge."
|
||||
if result_tree=$(git write-tree 2>/dev/null)
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo "Simple merge failed, trying Automatic merge."
|
||||
if git merge-index -o git-merge-one-file -a
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-subtree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-subtree.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-tree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge-tree.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-merge.exe
Normal file
Binary file not shown.
579
Agent-Windows/OGP64/usr/libexec/git-core/git-mergetool
Normal file
579
Agent-Windows/OGP64/usr/libexec/git-core/git-mergetool
Normal file
|
|
@ -0,0 +1,579 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This program resolves merge conflicts in git
|
||||
#
|
||||
# Copyright (c) 2006 Theodore Y. Ts'o
|
||||
# Copyright (c) 2009-2016 David Aguilar
|
||||
#
|
||||
# This file is licensed under the GPL v2, or a later version
|
||||
# at the discretion of Junio C Hamano.
|
||||
#
|
||||
|
||||
USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'
|
||||
SUBDIRECTORY_OK=Yes
|
||||
NONGIT_OK=Yes
|
||||
OPTIONS_SPEC=
|
||||
TOOL_MODE=merge
|
||||
. git-sh-setup
|
||||
. git-mergetool--lib
|
||||
|
||||
# Returns true if the mode reflects a symlink
|
||||
is_symlink () {
|
||||
test "$1" = 120000
|
||||
}
|
||||
|
||||
is_submodule () {
|
||||
test "$1" = 160000
|
||||
}
|
||||
|
||||
local_present () {
|
||||
test -n "$local_mode"
|
||||
}
|
||||
|
||||
remote_present () {
|
||||
test -n "$remote_mode"
|
||||
}
|
||||
|
||||
base_present () {
|
||||
test -n "$base_mode"
|
||||
}
|
||||
|
||||
mergetool_tmpdir_init () {
|
||||
if test "$(git config --bool mergetool.writeToTemp)" != true
|
||||
then
|
||||
MERGETOOL_TMPDIR=.
|
||||
return 0
|
||||
fi
|
||||
if MERGETOOL_TMPDIR=$(mktemp -d -t "git-mergetool-XXXXXX" 2>/dev/null)
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
die "error: mktemp is needed when 'mergetool.writeToTemp' is true"
|
||||
}
|
||||
|
||||
cleanup_temp_files () {
|
||||
if test "$1" = --save-backup
|
||||
then
|
||||
rm -rf -- "$MERGED.orig"
|
||||
test -e "$BACKUP" && mv -- "$BACKUP" "$MERGED.orig"
|
||||
rm -f -- "$LOCAL" "$REMOTE" "$BASE"
|
||||
else
|
||||
rm -f -- "$LOCAL" "$REMOTE" "$BASE" "$BACKUP"
|
||||
fi
|
||||
if test "$MERGETOOL_TMPDIR" != "."
|
||||
then
|
||||
rmdir "$MERGETOOL_TMPDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
describe_file () {
|
||||
mode="$1"
|
||||
branch="$2"
|
||||
file="$3"
|
||||
|
||||
printf " {%s}: " "$branch"
|
||||
if test -z "$mode"
|
||||
then
|
||||
echo "deleted"
|
||||
elif is_symlink "$mode"
|
||||
then
|
||||
echo "a symbolic link -> '$(cat "$file")'"
|
||||
elif is_submodule "$mode"
|
||||
then
|
||||
echo "submodule commit $file"
|
||||
elif base_present
|
||||
then
|
||||
echo "modified file"
|
||||
else
|
||||
echo "created file"
|
||||
fi
|
||||
}
|
||||
|
||||
resolve_symlink_merge () {
|
||||
while true
|
||||
do
|
||||
printf "Use (l)ocal or (r)emote, or (a)bort? "
|
||||
read ans || return 1
|
||||
case "$ans" in
|
||||
[lL]*)
|
||||
git checkout-index -f --stage=2 -- "$MERGED"
|
||||
git add -- "$MERGED"
|
||||
cleanup_temp_files --save-backup
|
||||
return 0
|
||||
;;
|
||||
[rR]*)
|
||||
git checkout-index -f --stage=3 -- "$MERGED"
|
||||
git add -- "$MERGED"
|
||||
cleanup_temp_files --save-backup
|
||||
return 0
|
||||
;;
|
||||
[aA]*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
resolve_deleted_merge () {
|
||||
while true
|
||||
do
|
||||
if base_present
|
||||
then
|
||||
printf "Use (m)odified or (d)eleted file, or (a)bort? "
|
||||
else
|
||||
printf "Use (c)reated or (d)eleted file, or (a)bort? "
|
||||
fi
|
||||
read ans || return 1
|
||||
case "$ans" in
|
||||
[mMcC]*)
|
||||
git add -- "$MERGED"
|
||||
if test "$merge_keep_backup" = "true"
|
||||
then
|
||||
cleanup_temp_files --save-backup
|
||||
else
|
||||
cleanup_temp_files
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
[dD]*)
|
||||
git rm -- "$MERGED" > /dev/null
|
||||
cleanup_temp_files
|
||||
return 0
|
||||
;;
|
||||
[aA]*)
|
||||
if test "$merge_keep_temporaries" = "false"
|
||||
then
|
||||
cleanup_temp_files
|
||||
fi
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
resolve_submodule_merge () {
|
||||
while true
|
||||
do
|
||||
printf "Use (l)ocal or (r)emote, or (a)bort? "
|
||||
read ans || return 1
|
||||
case "$ans" in
|
||||
[lL]*)
|
||||
if ! local_present
|
||||
then
|
||||
if test -n "$(git ls-tree HEAD -- "$MERGED")"
|
||||
then
|
||||
# Local isn't present, but it's a subdirectory
|
||||
git ls-tree --full-name -r HEAD -- "$MERGED" |
|
||||
git update-index --index-info || exit $?
|
||||
else
|
||||
test -e "$MERGED" && mv -- "$MERGED" "$BACKUP"
|
||||
git update-index --force-remove "$MERGED"
|
||||
cleanup_temp_files --save-backup
|
||||
fi
|
||||
elif is_submodule "$local_mode"
|
||||
then
|
||||
stage_submodule "$MERGED" "$local_sha1"
|
||||
else
|
||||
git checkout-index -f --stage=2 -- "$MERGED"
|
||||
git add -- "$MERGED"
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
[rR]*)
|
||||
if ! remote_present
|
||||
then
|
||||
if test -n "$(git ls-tree MERGE_HEAD -- "$MERGED")"
|
||||
then
|
||||
# Remote isn't present, but it's a subdirectory
|
||||
git ls-tree --full-name -r MERGE_HEAD -- "$MERGED" |
|
||||
git update-index --index-info || exit $?
|
||||
else
|
||||
test -e "$MERGED" && mv -- "$MERGED" "$BACKUP"
|
||||
git update-index --force-remove "$MERGED"
|
||||
fi
|
||||
elif is_submodule "$remote_mode"
|
||||
then
|
||||
! is_submodule "$local_mode" &&
|
||||
test -e "$MERGED" &&
|
||||
mv -- "$MERGED" "$BACKUP"
|
||||
stage_submodule "$MERGED" "$remote_sha1"
|
||||
else
|
||||
test -e "$MERGED" && mv -- "$MERGED" "$BACKUP"
|
||||
git checkout-index -f --stage=3 -- "$MERGED"
|
||||
git add -- "$MERGED"
|
||||
fi
|
||||
cleanup_temp_files --save-backup
|
||||
return 0
|
||||
;;
|
||||
[aA]*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
stage_submodule () {
|
||||
path="$1"
|
||||
submodule_sha1="$2"
|
||||
mkdir -p "$path" ||
|
||||
die "fatal: unable to create directory for module at $path"
|
||||
# Find $path relative to work tree
|
||||
work_tree_root=$(cd_to_toplevel && pwd)
|
||||
work_rel_path=$(cd "$path" &&
|
||||
GIT_WORK_TREE="${work_tree_root}" git rev-parse --show-prefix
|
||||
)
|
||||
test -n "$work_rel_path" ||
|
||||
die "fatal: unable to get path of module $path relative to work tree"
|
||||
git update-index --add --replace --cacheinfo 160000 "$submodule_sha1" "${work_rel_path%/}" || die
|
||||
}
|
||||
|
||||
checkout_staged_file () {
|
||||
tmpfile="$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" &&
|
||||
tmpfile=${tmpfile%%' '*}
|
||||
|
||||
if test $? -eq 0 && test -n "$tmpfile"
|
||||
then
|
||||
mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
|
||||
else
|
||||
>"$3"
|
||||
fi
|
||||
}
|
||||
|
||||
hide_resolved () {
|
||||
git merge-file --ours -q -p "$LOCAL" "$BASE" "$REMOTE" >"$LCONFL"
|
||||
git merge-file --theirs -q -p "$LOCAL" "$BASE" "$REMOTE" >"$RCONFL"
|
||||
mv -- "$LCONFL" "$LOCAL"
|
||||
mv -- "$RCONFL" "$REMOTE"
|
||||
}
|
||||
|
||||
merge_file () {
|
||||
MERGED="$1"
|
||||
|
||||
f=$(git ls-files -u -- "$MERGED")
|
||||
if test -z "$f"
|
||||
then
|
||||
if test ! -f "$MERGED"
|
||||
then
|
||||
echo "$MERGED: file not found"
|
||||
else
|
||||
echo "$MERGED: file does not need merging"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
# extract file extension from the last path component
|
||||
case "${MERGED##*/}" in
|
||||
*.*)
|
||||
ext=.${MERGED##*.}
|
||||
BASE=${MERGED%"$ext"}
|
||||
;;
|
||||
*)
|
||||
BASE=$MERGED
|
||||
ext=
|
||||
esac
|
||||
|
||||
initialize_merge_tool "$merge_tool" || return
|
||||
|
||||
mergetool_tmpdir_init
|
||||
|
||||
if test "$MERGETOOL_TMPDIR" != "."
|
||||
then
|
||||
# If we're using a temporary directory then write to the
|
||||
# top-level of that directory.
|
||||
BASE=${BASE##*/}
|
||||
fi
|
||||
|
||||
BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext"
|
||||
LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext"
|
||||
LCONFL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_LCONFL_$$$ext"
|
||||
REMOTE="$MERGETOOL_TMPDIR/${BASE}_REMOTE_$$$ext"
|
||||
RCONFL="$MERGETOOL_TMPDIR/${BASE}_REMOTE_RCONFL_$$$ext"
|
||||
BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
|
||||
|
||||
base_mode= local_mode= remote_mode=
|
||||
|
||||
# here, $IFS is just a LF
|
||||
for line in $f
|
||||
do
|
||||
mode=${line%% *} # 1st word
|
||||
sha1=${line#"$mode "}
|
||||
sha1=${sha1%% *} # 2nd word
|
||||
case "${line#$mode $sha1 }" in # remainder
|
||||
'1 '*)
|
||||
base_mode=$mode
|
||||
;;
|
||||
'2 '*)
|
||||
local_mode=$mode local_sha1=$sha1
|
||||
;;
|
||||
'3 '*)
|
||||
remote_mode=$mode remote_sha1=$sha1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if is_submodule "$local_mode" || is_submodule "$remote_mode"
|
||||
then
|
||||
echo "Submodule merge conflict for '$MERGED':"
|
||||
describe_file "$local_mode" "local" "$local_sha1"
|
||||
describe_file "$remote_mode" "remote" "$remote_sha1"
|
||||
resolve_submodule_merge
|
||||
return
|
||||
fi
|
||||
|
||||
if test -f "$MERGED"
|
||||
then
|
||||
mv -- "$MERGED" "$BACKUP"
|
||||
cp -- "$BACKUP" "$MERGED"
|
||||
fi
|
||||
# Create a parent directory to handle delete/delete conflicts
|
||||
# where the base's directory no longer exists.
|
||||
mkdir -p "$(dirname "$MERGED")"
|
||||
|
||||
checkout_staged_file 1 "$MERGED" "$BASE"
|
||||
checkout_staged_file 2 "$MERGED" "$LOCAL"
|
||||
checkout_staged_file 3 "$MERGED" "$REMOTE"
|
||||
|
||||
# hideResolved preferences hierarchy.
|
||||
global_config="mergetool.hideResolved"
|
||||
tool_config="mergetool.${merge_tool}.hideResolved"
|
||||
|
||||
if enabled=$(git config --type=bool "$tool_config")
|
||||
then
|
||||
# The user has a specific preference for a specific tool and no
|
||||
# other preferences should override that.
|
||||
: ;
|
||||
elif enabled=$(git config --type=bool "$global_config")
|
||||
then
|
||||
# The user has a general preference for all tools.
|
||||
#
|
||||
# 'true' means the user likes the feature so we should use it
|
||||
# where possible but tool authors can still override.
|
||||
#
|
||||
# 'false' means the user doesn't like the feature so we should
|
||||
# not use it anywhere.
|
||||
if test "$enabled" = true && hide_resolved_enabled
|
||||
then
|
||||
enabled=true
|
||||
else
|
||||
enabled=false
|
||||
fi
|
||||
else
|
||||
# The user does not have a preference. Default to disabled.
|
||||
enabled=false
|
||||
fi
|
||||
|
||||
if test "$enabled" = true
|
||||
then
|
||||
hide_resolved
|
||||
fi
|
||||
|
||||
if test -z "$local_mode" || test -z "$remote_mode"
|
||||
then
|
||||
echo "Deleted merge conflict for '$MERGED':"
|
||||
describe_file "$local_mode" "local" "$LOCAL"
|
||||
describe_file "$remote_mode" "remote" "$REMOTE"
|
||||
resolve_deleted_merge
|
||||
status=$?
|
||||
rmdir -p "$(dirname "$MERGED")" 2>/dev/null
|
||||
return $status
|
||||
fi
|
||||
|
||||
if is_symlink "$local_mode" || is_symlink "$remote_mode"
|
||||
then
|
||||
echo "Symbolic link merge conflict for '$MERGED':"
|
||||
describe_file "$local_mode" "local" "$LOCAL"
|
||||
describe_file "$remote_mode" "remote" "$REMOTE"
|
||||
resolve_symlink_merge
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Normal merge conflict for '$MERGED':"
|
||||
describe_file "$local_mode" "local" "$LOCAL"
|
||||
describe_file "$remote_mode" "remote" "$REMOTE"
|
||||
if test "$guessed_merge_tool" = true || test "$prompt" = true
|
||||
then
|
||||
printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
|
||||
read ans || return 1
|
||||
fi
|
||||
|
||||
if base_present
|
||||
then
|
||||
present=true
|
||||
else
|
||||
present=false
|
||||
fi
|
||||
|
||||
if ! run_merge_tool "$merge_tool" "$present"
|
||||
then
|
||||
echo "merge of $MERGED failed" 1>&2
|
||||
mv -- "$BACKUP" "$MERGED"
|
||||
|
||||
if test "$merge_keep_temporaries" = "false"
|
||||
then
|
||||
cleanup_temp_files
|
||||
fi
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if test "$merge_keep_backup" = "true"
|
||||
then
|
||||
mv -- "$BACKUP" "$MERGED.orig"
|
||||
else
|
||||
rm -- "$BACKUP"
|
||||
fi
|
||||
|
||||
git add -- "$MERGED"
|
||||
cleanup_temp_files
|
||||
return 0
|
||||
}
|
||||
|
||||
prompt_after_failed_merge () {
|
||||
while true
|
||||
do
|
||||
printf "Continue merging other unresolved paths [y/n]? "
|
||||
read ans || return 1
|
||||
case "$ans" in
|
||||
[yY]*)
|
||||
return 0
|
||||
;;
|
||||
[nN]*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
print_noop_and_exit () {
|
||||
echo "No files need merging"
|
||||
exit 0
|
||||
}
|
||||
|
||||
main () {
|
||||
prompt=$(git config --bool mergetool.prompt)
|
||||
GIT_MERGETOOL_GUI=
|
||||
guessed_merge_tool=false
|
||||
orderfile=
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
case "$1" in
|
||||
--tool-help=*)
|
||||
TOOL_MODE=${1#--tool-help=}
|
||||
show_tool_help
|
||||
;;
|
||||
--tool-help)
|
||||
show_tool_help
|
||||
;;
|
||||
-t|--tool*)
|
||||
case "$#,$1" in
|
||||
*,*=*)
|
||||
merge_tool=${1#*=}
|
||||
;;
|
||||
1,*)
|
||||
usage ;;
|
||||
*)
|
||||
merge_tool="$2"
|
||||
shift ;;
|
||||
esac
|
||||
;;
|
||||
--no-gui)
|
||||
GIT_MERGETOOL_GUI=false
|
||||
;;
|
||||
-g|--gui)
|
||||
GIT_MERGETOOL_GUI=true
|
||||
;;
|
||||
-y|--no-prompt)
|
||||
prompt=false
|
||||
;;
|
||||
--prompt)
|
||||
prompt=true
|
||||
;;
|
||||
-O*)
|
||||
orderfile="${1#-O}"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
git_dir_init
|
||||
require_work_tree
|
||||
|
||||
if test -z "$merge_tool"
|
||||
then
|
||||
merge_tool=$(get_merge_tool)
|
||||
subshell_exit_status=$?
|
||||
if test $subshell_exit_status = 1
|
||||
then
|
||||
guessed_merge_tool=true
|
||||
elif test $subshell_exit_status -gt 1
|
||||
then
|
||||
exit $subshell_exit_status
|
||||
fi
|
||||
fi
|
||||
merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)"
|
||||
merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
|
||||
|
||||
prefix=$(git rev-parse --show-prefix) || exit 1
|
||||
cd_to_toplevel
|
||||
|
||||
if test -n "$orderfile"
|
||||
then
|
||||
orderfile=$(
|
||||
git rev-parse --prefix "$prefix" -- "$orderfile" |
|
||||
sed -e 1d
|
||||
)
|
||||
fi
|
||||
|
||||
if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR"
|
||||
then
|
||||
set -- $(git rerere remaining)
|
||||
if test $# -eq 0
|
||||
then
|
||||
print_noop_and_exit
|
||||
fi
|
||||
elif test $# -ge 0
|
||||
then
|
||||
# rev-parse provides the -- needed for 'set'
|
||||
eval "set $(git rev-parse --sq --prefix "$prefix" -- "$@")"
|
||||
fi
|
||||
|
||||
files=$(git -c core.quotePath=false \
|
||||
diff --name-only --diff-filter=U \
|
||||
${orderfile:+"-O$orderfile"} -- "$@")
|
||||
|
||||
if test -z "$files"
|
||||
then
|
||||
print_noop_and_exit
|
||||
fi
|
||||
|
||||
printf "Merging:\n"
|
||||
printf "%s\n" "$files"
|
||||
|
||||
rc=0
|
||||
set -- $files
|
||||
while test $# -ne 0
|
||||
do
|
||||
printf "\n"
|
||||
if ! merge_file "$1"
|
||||
then
|
||||
rc=1
|
||||
test $# -ne 1 && prompt_after_failed_merge || exit 1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
exit $rc
|
||||
}
|
||||
|
||||
main "$@"
|
||||
549
Agent-Windows/OGP64/usr/libexec/git-core/git-mergetool--lib
Normal file
549
Agent-Windows/OGP64/usr/libexec/git-core/git-mergetool--lib
Normal file
|
|
@ -0,0 +1,549 @@
|
|||
# git-mergetool--lib is a shell library for common merge tool functions
|
||||
|
||||
: ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools}
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
mode_ok () {
|
||||
if diff_mode
|
||||
then
|
||||
can_diff
|
||||
elif merge_mode
|
||||
then
|
||||
can_merge
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
is_available () {
|
||||
merge_tool_path=$(translate_merge_tool_path "$1") &&
|
||||
type "$merge_tool_path" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
list_config_tools () {
|
||||
section=$1
|
||||
line_prefix=${2:-}
|
||||
|
||||
git config --get-regexp $section'\..*\.cmd' |
|
||||
while read -r key value
|
||||
do
|
||||
toolname=${key#$section.}
|
||||
toolname=${toolname%.cmd}
|
||||
|
||||
printf "%s%s\n" "$line_prefix" "$toolname"
|
||||
done
|
||||
}
|
||||
|
||||
show_tool_names () {
|
||||
condition=${1:-true} per_line_prefix=${2:-} preamble=${3:-}
|
||||
not_found_msg=${4:-}
|
||||
extra_content=${5:-}
|
||||
|
||||
shown_any=
|
||||
( cd "$MERGE_TOOLS_DIR" && ls ) | {
|
||||
while read scriptname
|
||||
do
|
||||
setup_tool "$scriptname" 2>/dev/null
|
||||
# We need an actual line feed here
|
||||
variants="$variants
|
||||
$(list_tool_variants)"
|
||||
done
|
||||
variants="$(echo "$variants" | sort -u)"
|
||||
|
||||
for toolname in $variants
|
||||
do
|
||||
if setup_tool "$toolname" 2>/dev/null &&
|
||||
(eval "$condition" "$toolname")
|
||||
then
|
||||
if test -n "$preamble"
|
||||
then
|
||||
printf "%s\n" "$preamble"
|
||||
preamble=
|
||||
fi
|
||||
shown_any=yes
|
||||
printf "%s%-15s %s\n" "$per_line_prefix" "$toolname" $(diff_mode && diff_cmd_help "$toolname" || merge_cmd_help "$toolname")
|
||||
fi
|
||||
done
|
||||
|
||||
if test -n "$extra_content"
|
||||
then
|
||||
if test -n "$preamble"
|
||||
then
|
||||
# Note: no '\n' here since we don't want a
|
||||
# blank line if there is no initial content.
|
||||
printf "%s" "$preamble"
|
||||
preamble=
|
||||
fi
|
||||
shown_any=yes
|
||||
printf "\n%s\n" "$extra_content"
|
||||
fi
|
||||
|
||||
if test -n "$preamble" && test -n "$not_found_msg"
|
||||
then
|
||||
printf "%s\n" "$not_found_msg"
|
||||
fi
|
||||
|
||||
test -n "$shown_any"
|
||||
}
|
||||
}
|
||||
|
||||
diff_mode () {
|
||||
test "$TOOL_MODE" = diff
|
||||
}
|
||||
|
||||
merge_mode () {
|
||||
test "$TOOL_MODE" = merge
|
||||
}
|
||||
|
||||
get_gui_default () {
|
||||
if diff_mode
|
||||
then
|
||||
GUI_DEFAULT_KEY="difftool.guiDefault"
|
||||
else
|
||||
GUI_DEFAULT_KEY="mergetool.guiDefault"
|
||||
fi
|
||||
GUI_DEFAULT_CONFIG_LCASE=$(git config --default false --get "$GUI_DEFAULT_KEY" | tr 'A-Z' 'a-z')
|
||||
if test "$GUI_DEFAULT_CONFIG_LCASE" = "auto"
|
||||
then
|
||||
if test -n "$DISPLAY"
|
||||
then
|
||||
GUI_DEFAULT=true
|
||||
else
|
||||
GUI_DEFAULT=false
|
||||
fi
|
||||
else
|
||||
GUI_DEFAULT=$(git config --default false --bool --get "$GUI_DEFAULT_KEY")
|
||||
subshell_exit_status=$?
|
||||
if test $subshell_exit_status -ne 0
|
||||
then
|
||||
exit $subshell_exit_status
|
||||
fi
|
||||
fi
|
||||
echo $GUI_DEFAULT
|
||||
}
|
||||
|
||||
gui_mode () {
|
||||
if test -z "$GIT_MERGETOOL_GUI"
|
||||
then
|
||||
GIT_MERGETOOL_GUI=$(get_gui_default)
|
||||
if test $? -ne 0
|
||||
then
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
test "$GIT_MERGETOOL_GUI" = true
|
||||
}
|
||||
|
||||
translate_merge_tool_path () {
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
check_unchanged () {
|
||||
if test "$MERGED" -nt "$BACKUP"
|
||||
then
|
||||
return 0
|
||||
else
|
||||
while true
|
||||
do
|
||||
echo "$MERGED seems unchanged."
|
||||
printf "Was the merge successful [y/n]? "
|
||||
read answer || return 1
|
||||
case "$answer" in
|
||||
y*|Y*) return 0 ;;
|
||||
n*|N*) return 1 ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
valid_tool () {
|
||||
setup_tool "$1" 2>/dev/null && return 0
|
||||
cmd=$(get_merge_tool_cmd "$1")
|
||||
test -n "$cmd"
|
||||
}
|
||||
|
||||
setup_user_tool () {
|
||||
merge_tool_cmd=$(get_merge_tool_cmd "$tool")
|
||||
test -n "$merge_tool_cmd" || return 1
|
||||
|
||||
diff_cmd () {
|
||||
( eval $merge_tool_cmd )
|
||||
}
|
||||
|
||||
merge_cmd () {
|
||||
( eval $merge_tool_cmd )
|
||||
}
|
||||
|
||||
list_tool_variants () {
|
||||
echo "$tool"
|
||||
}
|
||||
}
|
||||
|
||||
setup_tool () {
|
||||
tool="$1"
|
||||
|
||||
# Fallback definitions, to be overridden by tools.
|
||||
can_merge () {
|
||||
return 0
|
||||
}
|
||||
|
||||
can_diff () {
|
||||
return 0
|
||||
}
|
||||
|
||||
diff_cmd () {
|
||||
return 1
|
||||
}
|
||||
|
||||
diff_cmd_help () {
|
||||
return 0
|
||||
}
|
||||
|
||||
merge_cmd () {
|
||||
return 1
|
||||
}
|
||||
|
||||
merge_cmd_help () {
|
||||
return 0
|
||||
}
|
||||
|
||||
hide_resolved_enabled () {
|
||||
return 0
|
||||
}
|
||||
|
||||
translate_merge_tool_path () {
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
list_tool_variants () {
|
||||
echo "$tool"
|
||||
}
|
||||
|
||||
# Most tools' exit codes cannot be trusted, so By default we ignore
|
||||
# their exit code and check the merged file's modification time in
|
||||
# check_unchanged() to determine whether or not the merge was
|
||||
# successful. The return value from run_merge_cmd, by default, is
|
||||
# determined by check_unchanged().
|
||||
#
|
||||
# When a tool's exit code can be trusted then the return value from
|
||||
# run_merge_cmd is simply the tool's exit code, and check_unchanged()
|
||||
# is not called.
|
||||
#
|
||||
# The return value of exit_code_trustable() tells us whether or not we
|
||||
# can trust the tool's exit code.
|
||||
#
|
||||
# User-defined and built-in tools default to false.
|
||||
# Built-in tools advertise that their exit code is trustable by
|
||||
# redefining exit_code_trustable() to true.
|
||||
|
||||
exit_code_trustable () {
|
||||
false
|
||||
}
|
||||
|
||||
if test -f "$MERGE_TOOLS_DIR/$tool"
|
||||
then
|
||||
. "$MERGE_TOOLS_DIR/$tool"
|
||||
elif test -f "$MERGE_TOOLS_DIR/${tool%[0-9]}"
|
||||
then
|
||||
. "$MERGE_TOOLS_DIR/${tool%[0-9]}"
|
||||
else
|
||||
setup_user_tool
|
||||
rc=$?
|
||||
if test $rc -ne 0
|
||||
then
|
||||
echo >&2 "error: ${TOOL_MODE}tool.$tool.cmd not set for tool '$tool'"
|
||||
fi
|
||||
return $rc
|
||||
fi
|
||||
|
||||
# Now let the user override the default command for the tool. If
|
||||
# they have not done so then this will return 1 which we ignore.
|
||||
setup_user_tool
|
||||
|
||||
if ! list_tool_variants | grep -q "^$tool$"
|
||||
then
|
||||
echo "error: unknown tool variant '$tool'" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if merge_mode && ! can_merge
|
||||
then
|
||||
echo "error: '$tool' can not be used to resolve merges" >&2
|
||||
return 1
|
||||
elif diff_mode && ! can_diff
|
||||
then
|
||||
echo "error: '$tool' can only be used to resolve merges" >&2
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
get_merge_tool_cmd () {
|
||||
merge_tool="$1"
|
||||
if diff_mode
|
||||
then
|
||||
git config "difftool.$merge_tool.cmd" ||
|
||||
git config "mergetool.$merge_tool.cmd"
|
||||
else
|
||||
git config "mergetool.$merge_tool.cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
trust_exit_code () {
|
||||
if git config --bool "mergetool.$1.trustExitCode"
|
||||
then
|
||||
:; # OK
|
||||
elif exit_code_trustable
|
||||
then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
}
|
||||
|
||||
initialize_merge_tool () {
|
||||
# Bring tool-specific functions into scope
|
||||
setup_tool "$1" || return 1
|
||||
}
|
||||
|
||||
# Entry point for running tools
|
||||
run_merge_tool () {
|
||||
# If GIT_PREFIX is empty then we cannot use it in tools
|
||||
# that expect to be able to chdir() to its value.
|
||||
GIT_PREFIX=${GIT_PREFIX:-.}
|
||||
export GIT_PREFIX
|
||||
|
||||
merge_tool_path=$(get_merge_tool_path "$1") || exit
|
||||
base_present="$2"
|
||||
|
||||
if merge_mode
|
||||
then
|
||||
run_merge_cmd "$1"
|
||||
else
|
||||
run_diff_cmd "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Run a either a configured or built-in diff tool
|
||||
run_diff_cmd () {
|
||||
diff_cmd "$1"
|
||||
}
|
||||
|
||||
# Run a either a configured or built-in merge tool
|
||||
run_merge_cmd () {
|
||||
mergetool_trust_exit_code=$(trust_exit_code "$1")
|
||||
if test "$mergetool_trust_exit_code" = "true"
|
||||
then
|
||||
merge_cmd "$1"
|
||||
else
|
||||
touch "$BACKUP"
|
||||
merge_cmd "$1"
|
||||
check_unchanged
|
||||
fi
|
||||
}
|
||||
|
||||
list_merge_tool_candidates () {
|
||||
if merge_mode
|
||||
then
|
||||
tools="tortoisemerge"
|
||||
else
|
||||
tools="kompare"
|
||||
fi
|
||||
if test -n "$DISPLAY"
|
||||
then
|
||||
if test -n "$GNOME_DESKTOP_SESSION_ID"
|
||||
then
|
||||
tools="meld opendiff kdiff3 tkdiff xxdiff $tools"
|
||||
else
|
||||
tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
|
||||
fi
|
||||
tools="$tools gvimdiff diffuse diffmerge ecmerge"
|
||||
tools="$tools p4merge araxis bc codecompare"
|
||||
tools="$tools smerge"
|
||||
fi
|
||||
case "${VISUAL:-$EDITOR}" in
|
||||
*nvim*)
|
||||
tools="$tools nvimdiff vimdiff emerge"
|
||||
;;
|
||||
*vim*)
|
||||
tools="$tools vimdiff nvimdiff emerge"
|
||||
;;
|
||||
*)
|
||||
tools="$tools emerge vimdiff nvimdiff"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
show_tool_help () {
|
||||
tool_opt="'git ${TOOL_MODE}tool --tool=<tool>'"
|
||||
|
||||
tab=' '
|
||||
LF='
|
||||
'
|
||||
any_shown=no
|
||||
|
||||
cmd_name=${TOOL_MODE}tool
|
||||
config_tools=$({
|
||||
diff_mode && list_config_tools difftool "$tab$tab"
|
||||
list_config_tools mergetool "$tab$tab"
|
||||
} | sort)
|
||||
extra_content=
|
||||
if test -n "$config_tools"
|
||||
then
|
||||
extra_content="${tab}user-defined:${LF}$config_tools"
|
||||
fi
|
||||
|
||||
show_tool_names 'mode_ok && is_available' "$tab$tab" \
|
||||
"$tool_opt may be set to one of the following:" \
|
||||
"No suitable tool for 'git $cmd_name --tool=<tool>' found." \
|
||||
"$extra_content" &&
|
||||
any_shown=yes
|
||||
|
||||
show_tool_names 'mode_ok && ! is_available' "$tab$tab" \
|
||||
"${LF}The following tools are valid, but not currently available:" &&
|
||||
any_shown=yes
|
||||
|
||||
if test "$any_shown" = yes
|
||||
then
|
||||
echo
|
||||
echo "Some of the tools listed above only work in a windowed"
|
||||
echo "environment. If run in a terminal-only session, they will fail."
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
guess_merge_tool () {
|
||||
list_merge_tool_candidates
|
||||
cat >&2 <<-EOF
|
||||
|
||||
This message is displayed because '$TOOL_MODE.tool' is not configured.
|
||||
See 'git ${TOOL_MODE}tool --tool-help' or 'git help config' for more details.
|
||||
'git ${TOOL_MODE}tool' will now attempt to use one of the following tools:
|
||||
$tools
|
||||
EOF
|
||||
|
||||
# Loop over each candidate and stop when a valid merge tool is found.
|
||||
IFS=' '
|
||||
for tool in $tools
|
||||
do
|
||||
is_available "$tool" && echo "$tool" && return 0
|
||||
done
|
||||
|
||||
echo >&2 "No known ${TOOL_MODE} tool is available."
|
||||
return 1
|
||||
}
|
||||
|
||||
get_configured_merge_tool () {
|
||||
keys=
|
||||
if diff_mode
|
||||
then
|
||||
if gui_mode
|
||||
then
|
||||
keys="diff.guitool merge.guitool diff.tool merge.tool"
|
||||
else
|
||||
keys="diff.tool merge.tool"
|
||||
fi
|
||||
else
|
||||
if gui_mode
|
||||
then
|
||||
keys="merge.guitool merge.tool"
|
||||
else
|
||||
keys="merge.tool"
|
||||
fi
|
||||
fi
|
||||
|
||||
merge_tool=$(
|
||||
IFS=' '
|
||||
for key in $keys
|
||||
do
|
||||
selected=$(git config $key)
|
||||
if test -n "$selected"
|
||||
then
|
||||
echo "$selected"
|
||||
return
|
||||
fi
|
||||
done)
|
||||
|
||||
if test -n "$merge_tool" && ! valid_tool "$merge_tool"
|
||||
then
|
||||
echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool"
|
||||
echo >&2 "Resetting to default..."
|
||||
return 1
|
||||
fi
|
||||
echo "$merge_tool"
|
||||
}
|
||||
|
||||
get_merge_tool_path () {
|
||||
# A merge tool has been set, so verify that it's valid.
|
||||
merge_tool="$1"
|
||||
if ! valid_tool "$merge_tool"
|
||||
then
|
||||
echo >&2 "Unknown $TOOL_MODE tool $merge_tool"
|
||||
exit 1
|
||||
fi
|
||||
if diff_mode
|
||||
then
|
||||
merge_tool_path=$(git config difftool."$merge_tool".path ||
|
||||
git config mergetool."$merge_tool".path)
|
||||
else
|
||||
merge_tool_path=$(git config mergetool."$merge_tool".path)
|
||||
fi
|
||||
if test -z "$merge_tool_path"
|
||||
then
|
||||
merge_tool_path=$(translate_merge_tool_path "$merge_tool")
|
||||
fi
|
||||
if test -z "$(get_merge_tool_cmd "$merge_tool")" &&
|
||||
! type "$merge_tool_path" >/dev/null 2>&1
|
||||
then
|
||||
echo >&2 "The $TOOL_MODE tool $merge_tool is not available as"\
|
||||
"'$merge_tool_path'"
|
||||
exit 1
|
||||
fi
|
||||
echo "$merge_tool_path"
|
||||
}
|
||||
|
||||
get_merge_tool () {
|
||||
is_guessed=false
|
||||
# Check if a merge tool has been configured
|
||||
merge_tool=$(get_configured_merge_tool)
|
||||
subshell_exit_status=$?
|
||||
if test $subshell_exit_status -gt "1"
|
||||
then
|
||||
exit $subshell_exit_status
|
||||
fi
|
||||
# Try to guess an appropriate merge tool if no tool has been set.
|
||||
if test -z "$merge_tool"
|
||||
then
|
||||
merge_tool=$(guess_merge_tool) || exit
|
||||
is_guessed=true
|
||||
fi
|
||||
echo "$merge_tool"
|
||||
test "$is_guessed" = false
|
||||
}
|
||||
|
||||
mergetool_find_win32_cmd () {
|
||||
executable=$1
|
||||
sub_directory=$2
|
||||
|
||||
# Use $executable if it exists in $PATH
|
||||
if type -p "$executable" >/dev/null 2>&1
|
||||
then
|
||||
printf '%s' "$executable"
|
||||
return
|
||||
fi
|
||||
|
||||
# Look for executable in the typical locations
|
||||
for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
|
||||
cut -d '=' -f 2- | sort -u)
|
||||
do
|
||||
if test -n "$directory" && test -x "$directory/$sub_directory/$executable"
|
||||
then
|
||||
printf '%s' "$directory/$sub_directory/$executable"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s' "$executable"
|
||||
}
|
||||
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mktag.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mktag.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mktree.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mktree.exe
Normal file
Binary file not shown.
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mv.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-mv.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-name-rev.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-name-rev.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-notes.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-notes.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-objects.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-objects.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-redundant.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-redundant.exe
Normal file
Binary file not shown.
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-refs.exe
Normal file
BIN
Agent-Windows/OGP64/usr/libexec/git-core/git-pack-refs.exe
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue