]> git.ozlabs.org Git - next-scripts/commitdiff
make sure we always have a commit to give to update-ref
authorStephen Rothwell <sfr@canb.auug.org.au>
Mon, 9 Jun 2008 13:22:22 +0000 (23:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 9 Jun 2008 13:22:22 +0000 (23:22 +1000)
we now always create series.orig and put it back later
fix typo in sed expression

update_trees

index 7e5525ce1d684e0e2d32afc395e89c3aed1dd6b9..618df5e4e37824a2eab0b129dd9438ce578e7615 100755 (executable)
@@ -38,12 +38,12 @@ for name in $quilters; do
                        ;;
        esac
        log "Importing $name based on $base"
-       git rev-list -n 1 "$rbase" -- >/dev/null 2>&1 || {
+       rbase_sha1=$(git rev-parse --verify "$rbase^{commit}") || {
                log "Unknown BASE"
                continue
        }
-       grep -q NEXT_PATCHES "$sfile" && {
-               mv -f "$sfile" "$sfile.orig"
+       mv -f "$sfile" "$sfile.orig"
+       if grep -q NEXT_PATCHES "$sfile.orig"; then
                do_echo=:
                while read line; do
                        case $line in
@@ -54,23 +54,26 @@ for name in $quilters; do
                        esac
                        $do_echo $line
                done <"$sfile.orig" >"$sfile"
-       }
+       else
+               cp "$sfile.orig" "$sfile"
+       fi
 
        git show-ref --quiet --verify "refs/heads/quilt/$name" ||
-               execute git branch "quilt/$name" "$rbase"
+               execute git branch "quilt/$name" "$rbase_sha1"
 
        mv -f "$sfile" "$sfile.tmp"
-       sed -e '/^[     ]*$/d' -e '^[   ]*#/d' <"$sfile.tmp" >"$sfile"
+       sed -e '/^[     ]*$/d' -e '/^[  ]*#/d' <"$sfile.tmp" >"$sfile"
        rm -f "$sfile.tmp"
        [ -s "$sfile" ] || {
                log "   quilt series is empty"
                [ -f "$sfile.orig" ] &&
                        mv -f "$sfile.orig" "$sfile"
+               execute git update-ref "refs/heads/quilt/$name" "$rbase_sha1"
                continue
        }
 
        execute git checkout "quilt/$name"
-       execute git reset --hard "$rbase"
+       execute git reset --hard "$rbase_sha1"
 
        author=$(grep -v '^#' ../real_control | awk -F '        ' '$3=="'"$name"'" { printf("%s", $1); }' | sed 's/,.*$//')
        execute git quiltimport --author "$author" --patches "../quilt/$name"