Add support for old git version without -C

This commit is contained in:
Matthias Schiffer 2013-12-31 17:03:39 +01:00
parent 25db7bce77
commit 9274724486
4 changed files with 20 additions and 18 deletions

View File

@ -6,17 +6,17 @@ shopt -s nullglob
. "$1"/modules . "$1"/modules
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
dir="$1"/$module cd "$1"/$module
git -C $dir checkout -B patching base git checkout -B patching base
if [ "$1"/patches/$module/*.patch ]; then if [ "$1"/patches/$module/*.patch ]; then
git -C "$dir" am "$1"/patches/$module/*.patch || ( git am "$1"/patches/$module/*.patch || (
git -C "$dir" am --abort git am --abort
git -C "$dir" checkout patched git checkout patched
git -C "$dir" branch -D patching git branch -D patching
false false
) )
fi fi
git -C "$dir" checkout -B patched git checkout -B patched
git -C "$dir" branch -d patching git branch -d patching
done done

View File

@ -5,6 +5,6 @@ set -e
. "$1"/modules . "$1"/modules
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
dir="$1"/$module cd "$1"/$module
git -C "$dir" checkout base git checkout base
done done

View File

@ -6,13 +6,14 @@ shopt -s nullglob
. "$1"/modules . "$1"/modules
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
dir="$1"/$module
rm -f "$1"/patches/$module/*.patch rm -f "$1"/patches/$module/*.patch
mkdir -p "$1"/patches/$module mkdir -p "$1"/patches/$module
cd "$1"/$module
n=0 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 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
done done

View File

@ -5,13 +5,14 @@ set -e
. "$1"/modules . "$1"/modules
for module in $GLUON_MODULES; do for module in $GLUON_MODULES; do
dir="$1"/$module
mkdir -p "$dir"
var=$(echo $module | tr '[:lower:]/' '[:upper:]_') var=$(echo $module | tr '[:lower:]/' '[:upper:]_')
eval repo=\${MODULE_${var}_REPO} eval repo=\${MODULE_${var}_REPO}
eval commit=\${MODULE_${var}_COMMIT} eval commit=\${MODULE_${var}_COMMIT}
git -C "$dir" init
git -C "$dir" checkout $commit 2>/dev/null || git -C "$dir" fetch $repo mkdir -p "$1"/$module
git -C "$dir" checkout -B base $commit cd "$1"/$module
git init
git checkout $commit 2>/dev/null || fetch $repo
git checkout -B base $commit
done done