mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
util/git-replay-merge.sh: make the tool compatible with git worktrees
This commit is contained in:
parent
32c86e29e2
commit
db87352742
1 changed files with 17 additions and 10 deletions
|
|
@ -14,7 +14,6 @@ set -e
|
|||
SELF="$(basename $0)"
|
||||
SELF="${SELF/-/ }"
|
||||
|
||||
STATE_FILE=".git/REPLAY_MERGE"
|
||||
DONT_PUSH=${DONT_PUSH:=false}
|
||||
DONT_ACCEPT=${DONT_ACCEPT:=false}
|
||||
|
||||
|
|
@ -40,13 +39,6 @@ die_with_usage() {
|
|||
" ${SELF} --abort"
|
||||
}
|
||||
|
||||
verify_gitlab_cli() {
|
||||
which gitlab >/dev/null 2>&1 || \
|
||||
die "You need to have gitlab cli installed and configured: "\
|
||||
"" \
|
||||
"$ gem install --user-install gitlab"
|
||||
}
|
||||
|
||||
die_with_continue_instructions() {
|
||||
die "" \
|
||||
"Replay interrupted. Conflicts need to be fixed manually." \
|
||||
|
|
@ -62,7 +54,7 @@ die_before_push() {
|
|||
}
|
||||
|
||||
die_if_wrong_dir() {
|
||||
if [[ ! -d ".git" ]]; then
|
||||
if [[ ! -d "$WORKDIR" ]]; then
|
||||
die "You need to run this command from the toplevel of the working tree."
|
||||
fi
|
||||
}
|
||||
|
|
@ -90,6 +82,21 @@ die_if_local_behind_target() {
|
|||
fi
|
||||
}
|
||||
|
||||
get_workdir() {
|
||||
DOTGIT="$(git rev-parse --show-toplevel)/.git"
|
||||
if [[ -f "${WORKDIR}" ]]; then
|
||||
sed -n 's/^gitdir: //p' "${DOTGIT}"
|
||||
fi
|
||||
echo "${DOTGIT}"
|
||||
}
|
||||
|
||||
verify_gitlab_cli() {
|
||||
which gitlab >/dev/null 2>&1 || \
|
||||
die "You need to have gitlab cli installed and configured: "\
|
||||
"" \
|
||||
"$ gem install --user-install gitlab"
|
||||
}
|
||||
|
||||
branch_exists() {
|
||||
ESCAPED_BRANCH_NAME=${1//\//\\\/}
|
||||
BRANCH_REGEX="/^(remotes\/)?${ESCAPED_BRANCH_NAME}$/"
|
||||
|
|
@ -211,7 +218,7 @@ cleanup() {
|
|||
rm -f "${STATE_FILE}"
|
||||
}
|
||||
|
||||
cd $(git rev-parse --show-toplevel)
|
||||
STATE_FILE="$(get_workdir)/REPLAY_MERGE"
|
||||
|
||||
next_action="go"
|
||||
while [[ $# -ge 1 ]]; do
|
||||
|
|
|
|||
Loading…
Reference in a new issue