]> git.ozlabs.org Git - next-scripts/commitdiff
fetch_trees: the body of a functions can be any compound command
authorStephen Rothwell <sfr@canb.auug.org.au>
Sun, 12 Jul 2020 22:09:52 +0000 (08:09 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sun, 12 Jul 2020 22:09:52 +0000 (08:09 +1000)
so the braces (and extra level of indentation) are not needed.

fetch_trees

index 3a43025550e5554ebd9fab941058824d0eac4091..74c75848344269c18f4dfcd2637d0bdf32ab8613 100755 (executable)
@@ -37,72 +37,68 @@ fetch_git()
 }
 
 fetch_mmotm()
-{
-       (
-               if ! cd ../mmotm; then
-                       printf 'Cannot chdir to ../mmotm\n' 1>&2
-                       return
-               fi
-               if ! rsync -az --partial --exclude '.git*' \
-                               --exclude broken-out.tar.gz --delete \
-                               ozlabs.org::akpm/mmotm/. .; then
-                       git reset --hard
-                       printf 'Fetcing mmotm failed\n' 1>&2
-                       return
-               fi
-               git add -A .
-               if [ "$(git status --porcelain)" ]; then
-                       git commit -m "$(head -n 1 .DATE)"
-               fi
-       )
-}
+(
+       if ! cd ../mmotm; then
+               printf 'Cannot chdir to ../mmotm\n' 1>&2
+               return
+       fi
+       if ! rsync -az --partial --exclude '.git*' \
+                       --exclude broken-out.tar.gz --delete \
+                       ozlabs.org::akpm/mmotm/. .; then
+               git reset --hard
+               printf 'Fetcing mmotm failed\n' 1>&2
+               return
+       fi
+       git add -A .
+       if [ "$(git status --porcelain)" ]; then
+               git commit -m "$(head -n 1 .DATE)"
+       fi
+)
 
 fetch_quilt()
-{
-       (
-               url=$(get_field "$1" 4)
-               url=${url%/}    # strip trailing / if necessary
+(
+       url=$(get_field "$1" 4)
+       url=${url%/}    # strip trailing / if necessary
 
-               if ! cd ../quilt; then
-                       printf 'Cannot chdir to ../quilt\n' 1>&2
-                       return
-               fi
-               if ! [ -d "$1" ] && ! mkdir "$1"; then
-                       printf 'Cannot create quilt directory for %s\n' "$1" 1>&2
-                       return
-               fi
-               if ! cd "$1"; then
-                       printf 'Cannot chdir to quilt directory for %s\n' "$1" 1>&2
-                       return
-               fi
-               if ! wget -N -nv --no-cache --no-xattr "$url/series"; then
-                       printf 'Wget of %s series file failed\n' "$1" 1>&2
+       if ! cd ../quilt; then
+               printf 'Cannot chdir to ../quilt\n' 1>&2
+               return
+       fi
+       if ! [ -d "$1" ] && ! mkdir "$1"; then
+               printf 'Cannot create quilt directory for %s\n' "$1" 1>&2
+               return
+       fi
+       if ! cd "$1"; then
+               printf 'Cannot chdir to quilt directory for %s\n' "$1" 1>&2
+               return
+       fi
+       if ! wget -N -nv --no-cache --no-xattr "$url/series"; then
+               printf 'Wget of %s series file failed\n' "$1" 1>&2
+               cd ..
+               rm -rf "$1"
+               git checkout "$1"
+               return
+       fi
+       find . -type f | sed 's,^./,,;/^series$/d' | sort >.series.old
+       if grep -q NEXT_PATCHES series; then
+               sed -n '/NEXT_PATCHES_START/,/NEXT_PATCHES_END/p' series
+       else
+               cat series
+       fi |
+               sed -e 's/[ \t]*#.*$//' -e '/^[ \t]*$/d' |
+               sort >.series.next
+       if [ -s .series.next ]; then
+               if ! wget -N -nv --no-cache --no-xattr -B "$url/" -i .series.next; then
+                       printf 'Wget of series %s failed\n' "$1" 1>&2
                        cd ..
                        rm -rf "$1"
                        git checkout "$1"
                        return
                fi
-               find . -type f | sed 's,^./,,;/^series$/d' | sort >.series.old
-               if grep -q NEXT_PATCHES series; then
-                       sed -n '/NEXT_PATCHES_START/,/NEXT_PATCHES_END/p' series
-               else
-                       cat series
-               fi |
-                       sed -e 's/[ \t]*#.*$//' -e '/^[ \t]*$/d' |
-                       sort >.series.next
-               if [ -s .series.next ]; then
-                       if ! wget -N -nv --no-cache --no-xattr -B "$url/" -i .series.next; then
-                               printf 'Wget of series %s failed\n' "$1" 1>&2
-                               cd ..
-                               rm -rf "$1"
-                               git checkout "$1"
-                               return
-                       fi
-               fi
-               comm -23 .series.old .series.next | xargs -r rm -f
-               rm -f .series.old .series.next
-       )
-}
+       fi
+       comm -23 .series.old .series.next | xargs -r rm -f
+       rm -f .series.old .series.next
+)
 
 trees="$*"
 if ! [ "$trees" ]; then