From: Stephen Rothwell Date: Wed, 8 Nov 2017 00:06:14 +0000 (+1100) Subject: import-akpm: use a worktree X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=1e782e8967ca661a109662f070538fc56e18ae77;p=next-scripts import-akpm: use a worktree --- diff --git a/import-akpm b/import-akpm index 59ab76d..6f5c080 100755 --- a/import-akpm +++ b/import-akpm @@ -38,18 +38,19 @@ db=$(git describe "$base") dnb=$(git describe --contains "$nbase") log "Importing akpm based on $db/$dnb" -[ -d "../quilt-tmp" ] || - execute git clone -s -l -n -q . ../quilt-tmp +[ -d "../tmp-akpm" ] && { + log "akpm import directory already exists" + exit 1 +} -log '$' cd ../quilt-tmp -cd ../quilt-tmp -execute git checkout -b akpm/master "$db" -git branch akpm/current-base +execute git worktree add -b tmp-akpm/master ../tmp-akpm "$db" + +log '$' cd ../tmp-akpm +cd ../tmp-akpm +execute git branch tmp-akpm/current-base sed_exp=' /NEXT_PATCHES_START/,/NEXT_PATCHES_END/{ - s/[ \t]*#.*NEXT_PATCHES_START[ \t]*\([^ \t]*\).*$/>\1/ - s/[ \t]*#.*NEXT_PATCHES_END.*$/*) - cbranch="${f#>}" - [ "$cbranch" ] && - cref="$(git rev-parse --verify HEAD)" - ;; - \<) - [ "$cbranch" ] && { - [ "$cref" != "$(git rev-parse --verify HEAD)" ] && - git branch -f "akpm/$cbranch" - cbranch="" - } + execute git branch tmp-akpm/master-base ;; *) execute git am -s --patch-format=mbox "$mmotm/broken-out/$f" @@ -83,19 +72,15 @@ for f in $patches; do esac done -[ "$cbranch" ] && - [ "$cref" != "$(git rev-parse --verify HEAD)" ] && - git branch -f "akpm/$cbranch" - log '$' cd $cpwd cd $cpwd -execute git fetch --force --no-tags ../quilt-tmp \ - refs/heads/akpm/master:refs/heads/akpm/master \ - refs/heads/akpm/master-base:refs/heads/akpm/master-base \ - refs/heads/akpm/current:refs/heads/akpm/current \ - refs/heads/akpm/current-base:refs/heads/akpm/current-base +execute rm -rf ../tmp-akpm +execute git worktree prune -rm -rf ../quilt-tmp +for i in akpm/current akpm/current-base akpm/master akpm/master-base; do + execute git branch -f $i tmp-$i + execute git branch -D tmp-$i +done exit 0