]> git.ozlabs.org Git - next-scripts/commitdiff
import-akpm: use a worktree
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 8 Nov 2017 00:06:14 +0000 (11:06 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 8 Nov 2017 00:06:14 +0000 (11:06 +1100)
import-akpm

index 59ab76d5c3a03bb2539829ab283d19ba086a2188..6f5c080bdc5a9a0f464645c54cd72c5eb6ddae9a 100755 (executable)
@@ -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.*$/</
        s/[ \t]*#.*$//
        /^[ \t]*$/!p
 }
@@ -61,21 +62,9 @@ for f in $patches; do
        origin.patch)
                ;;
        linux-next.patch)
-               git branch akpm/current
+               execute git branch tmp-akpm/current
                execute git merge --no-edit --no-stat "$dnb"
-               git branch akpm/master-base
-               ;;
-       \>*)
-               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