]> git.wh0rd.org Git - home.git/commitdiff
r: handle updated branch output
authorMike Frysinger <vapier@gentoo.org>
Mon, 5 Oct 2015 16:28:03 +0000 (12:28 -0400)
committerMike Frysinger <vapier@gentoo.org>
Mon, 5 Oct 2015 16:28:17 +0000 (12:28 -0400)
.bin/r

diff --git a/.bin/r b/.bin/r
index 31377ef2866dded8d9445aff59aa04c96c4df276..cc26b7b6af132286f6c04589e47ddc7979ae971f 100755 (executable)
--- a/.bin/r
+++ b/.bin/r
@@ -3,6 +3,10 @@ g() { git "$@"; }
 err() { printf '%b\n' "$*" 1>&2; exit 1; }
 vr() { echo "$@"; "$@"; }
 
+case $1 in
+-x) set -x; shift;;
+esac
+
 case $1 in
 ""|-*) ;;
 l)
@@ -94,7 +98,10 @@ rebase)
                        while read -a line ; do
                                dir=${line[0]}
                                proj=${line[2]}
-                               cd "${root}/${dir}"
+                               if ! cd "${root}/${dir}" ; then
+                                       echo "bad ${proj}"
+                                       continue
+                               fi
                                (
                                out=$(env _proj=${proj} r rb all . 2>&1)
                                if [[ -n ${out} ]] ; then
@@ -104,7 +111,8 @@ rebase)
                                                        printf '%s### %s%-40s%s: %s\n' \
                                                                "${BRACKET}" "${GOOD}" "${line%%:*}" "${NORMAL}" "${line#*:}"
                                                else
-                                                       echo "${line}"
+                                                       printf '%s### %s%-40s%s: ERROR: %s\n' \
+                                                               "${BRACKET}" "${BAD}" "${dir}" "${NORMAL}" "${line}"
                                                fi
                                        done < <(echo "${out}")
                                fi
@@ -121,7 +129,7 @@ rebase)
                        {
                                if ($0 ~ "^[*] *[(]no branch[)]") {
                                        next
-                               } else if ($0 ~ "^[*] *[(]detached from ") {
+                               } else if ($0 ~ "^[*] *[(](HEAD )?detached (from|at) ") {
                                        next
                                } else if ($1 == "*") {
                                        b = $2