From 9274724486fd2ca300d485ba8bb083404de2e164 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer <mschiffer@universe-factory.net> Date: Tue, 31 Dec 2013 17:03:39 +0100 Subject: [PATCH] Add support for old git version without -C --- scripts/patch.sh | 16 ++++++++-------- scripts/unpatch.sh | 4 ++-- scripts/update-patches.sh | 7 ++++--- scripts/update.sh | 11 ++++++----- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/scripts/patch.sh b/scripts/patch.sh index fbaebd7e8..b3ad55643 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -6,17 +6,17 @@ shopt -s nullglob . "$1"/modules for module in $GLUON_MODULES; do - dir="$1"/$module - git -C $dir checkout -B patching base + cd "$1"/$module + git checkout -B patching base if [ "$1"/patches/$module/*.patch ]; then - git -C "$dir" am "$1"/patches/$module/*.patch || ( - git -C "$dir" am --abort - git -C "$dir" checkout patched - git -C "$dir" branch -D patching + git am "$1"/patches/$module/*.patch || ( + git am --abort + git checkout patched + git branch -D patching false ) fi - git -C "$dir" checkout -B patched - git -C "$dir" branch -d patching + git checkout -B patched + git branch -d patching done diff --git a/scripts/unpatch.sh b/scripts/unpatch.sh index 4e5cfaaac..062b5cdc5 100755 --- a/scripts/unpatch.sh +++ b/scripts/unpatch.sh @@ -5,6 +5,6 @@ set -e . "$1"/modules for module in $GLUON_MODULES; do - dir="$1"/$module - git -C "$dir" checkout base + cd "$1"/$module + git checkout base done diff --git a/scripts/update-patches.sh b/scripts/update-patches.sh index c4c0b53c1..ee0ea15a3 100755 --- a/scripts/update-patches.sh +++ b/scripts/update-patches.sh @@ -6,13 +6,14 @@ shopt -s nullglob . "$1"/modules for module in $GLUON_MODULES; do - dir="$1"/$module rm -f "$1"/patches/$module/*.patch mkdir -p "$1"/patches/$module + cd "$1"/$module + n=0 - for commit in $(git -C "$dir" rev-list --reverse --no-merges base..patched); do + for commit in $(git rev-list --reverse --no-merges base..patched); do let n=n+1 - git -C "$dir" show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' $commit > "$1"/patches/$module/"$(printf '%04u' $n)-$(git -C "$dir" show -s --pretty=format:%f $commit).patch" + git show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' $commit > "$1"/patches/$module/"$(printf '%04u' $n)-$(git show -s --pretty=format:%f $commit).patch" done done diff --git a/scripts/update.sh b/scripts/update.sh index 2bda671fe..f840b457b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -5,13 +5,14 @@ set -e . "$1"/modules for module in $GLUON_MODULES; do - dir="$1"/$module - mkdir -p "$dir" var=$(echo $module | tr '[:lower:]/' '[:upper:]_') eval repo=\${MODULE_${var}_REPO} eval commit=\${MODULE_${var}_COMMIT} - git -C "$dir" init - git -C "$dir" checkout $commit 2>/dev/null || git -C "$dir" fetch $repo - git -C "$dir" checkout -B base $commit + mkdir -p "$1"/$module + cd "$1"/$module + git init + + git checkout $commit 2>/dev/null || fetch $repo + git checkout -B base $commit done -- GitLab