Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ediff-merge-script
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _MKTEMP="/bin/mktemp"
_LOCAL=${1}
_REMOTE=${2}
_MERGED=${3}
if [ -r "${4}" ] ; then
if [ -r "${4}" ]; then
_BASE=${4}
_EDIFF=ediff-merge-files-with-ancestor
_EVAL="(${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" \"${_BASE}\" nil \"${_MERGED}\")"
Expand Down
28 changes: 14 additions & 14 deletions git-clone-related
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
# Fail if any command fails.
set +e

if [ "$1" = "--debug" ] ; then
if [ "$1" = "--debug" ]; then
DEBUG=1
shift
set -x
fi

# FALLBACK_BRANCH may be unset.
if [ "$1" = "--upstream-branch" ] ; then
if [ "$1" = "--upstream-branch" ]; then
shift
FALLBACK_BRANCH=$1
shift
Expand Down Expand Up @@ -82,7 +82,7 @@ if [ "$#" -eq 0 ]; then
set -- -q --single-branch --depth 1
fi

if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "Entering git-clone-related $UPSTREAM_ORG $REPO_NAME $DESTINATION $*"
fi

Expand All @@ -101,49 +101,49 @@ else
SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)"

CI_INFO="$SCRIPTDIR/../plume-scripts/ci-info"
if [ ! -f "$CI_INFO" ] ; then
if [ ! -f "$CI_INFO" ]; then
CI_INFO="$SCRIPTDIR/../.plume-scripts/ci-info"
fi
if [ ! -f "$CI_INFO" ] ; then
if [ ! -f "$CI_INFO" ]; then
CI_INFO="$SCRIPTDIR/.plume-scripts/ci-info"
fi
if [ ! -f "$CI_INFO" ] ; then
if [ ! -f "$CI_INFO" ]; then
(cd "$SCRIPTDIR" && git clone --depth 1 https://github.com/plume-lib/plume-scripts .plume-scripts)
fi
if [ ! -f "$CI_INFO" ] ; then
if [ ! -f "$CI_INFO" ]; then
echo "CI_INFO does not exist: $CI_INFO"
exit 1
fi

if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "About to run ci-info --debug"
"${CI_INFO}" --debug "${UPSTREAM_ORG}"
echo "Ran ci-info --debug"
echo "About to run ci-info"
fi

eval "$("${CI_INFO}" "${UPSTREAM_ORG}")"
if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "Finished running ci-info"
fi
UPSTREAM_REPO_URL="https://github.com/${UPSTREAM_ORG}/${REPO_NAME}.git"

if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "About to run git-find-fork" "${CI_ORGANIZATION}" "${UPSTREAM_ORG}" "${REPO_NAME}"
fi
# REPO_URL is what will be cloned. It might be the same as UPSTREAM_REPO_URL.
REPO_URL=$("${SCRIPTDIR}"/git-find-fork "${CI_ORGANIZATION}" "${UPSTREAM_ORG}" "${REPO_NAME}")
if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "git-find-fork ${CI_ORGANIZATION} ${UPSTREAM_ORG} ${REPO_NAME} => ${REPO_URL}"
fi
if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "About to run git-find-branch" "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"}
fi
REPO_BRANCH=$("${SCRIPTDIR}"/git-find-branch "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"})
if [ -n "$DEBUG" ] ; then
if [ -n "$DEBUG" ]; then
echo "git-find-branch ${REPO_URL} ${CI_BRANCH_NAME} => ${REPO_BRANCH}"
fi
if [ "$UPSTREAM_REPO_URL" != "$REPO_URL" ] && [ "$REPO_BRANCH" != "$CI_BRANCH_NAME" ] ; then
if [ "$UPSTREAM_REPO_URL" != "$REPO_URL" ] && [ "$REPO_BRANCH" != "$CI_BRANCH_NAME" ]; then
## Don't use the fallback branch (e.g., master) of the downstream repo
REPO_URL="$UPSTREAM_REPO_URL"
REPO_BRANCH=$("${SCRIPTDIR}"/git-find-branch "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"})
Expand Down
6 changes: 3 additions & 3 deletions resolve-adjacent-conflicts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ echo "which is an obsolete version in https://github.com/plume-lib/git-scripts .

DEBUG=0

if [ "$#" -eq 0 ] ; then
if [ "$#" -eq 0 ]; then
readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .)
else
files=("$@")
Expand All @@ -49,14 +49,14 @@ SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)"
status=0

for file in "${files[@]}" ; do
if [ "$DEBUG" ] ; then
if [ "$DEBUG" ]; then
echo "before resolve-conflicts.py: $(sha256sum "$file")"
cat "$file"
fi
if ! "${SCRIPTDIR}"/resolve-conflicts.py --adjacent_lines "$file" ; then
status=1
fi
if [ "$DEBUG" ] ; then
if [ "$DEBUG" ]; then
echo "after resolve-conflicts.py: (status=$status: $(sha256sum "$file")"
cat "$file"
fi
Expand Down
2 changes: 1 addition & 1 deletion resolve-blank-lines
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# `git diff` has a `--ignore-blank-lines` option, but `git merge` has
# no option for ignoring blank lines. This script addresses that shortcoming.

if [ "$#" -eq 0 ] ; then
if [ "$#" -eq 0 ]; then
readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .)
else
files=("$@")
Expand Down
2 changes: 1 addition & 1 deletion resolve-import-conflicts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "which is an obsolete version in https://github.com/plume-lib/git-scripts .
# However, this can be run after a git mergetool that leaves conflict markers
# in files, as the default git mergetool does.

if [ "$#" -eq 0 ] ; then
if [ "$#" -eq 0 ]; then
readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .)
else
files=("$@")
Expand Down
4 changes: 2 additions & 2 deletions tests/git-clone-related-test/test-git-clone-related.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ clonedbranch=$(git -C "$goaldir" rev-parse --abbrev-ref HEAD)

rm -rf "$startdir" "$goaldir"

if [ "$clonedrepo" != "$GOAL_REPO" ] ; then
if [ "$clonedrepo" != "$GOAL_REPO" ]; then
echo "test-git-clone-related.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\""
echo "expected repo $GOAL_REPO, got: $clonedrepo"
exit 2
fi
if [ "$clonedbranch" != "$GOAL_BRANCH" ] ; then
if [ "$clonedbranch" != "$GOAL_BRANCH" ]; then
echo "test-git-clone-related.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\""
echo "expected branch $GOAL_BRANCH, got: $clonedbranch"
exit 2
Expand Down