From: Mike Frysinger Date: Mon, 5 Oct 2015 16:28:03 +0000 (-0400) Subject: r: handle updated branch output X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=24988ec09ea9cbb6e8e5bd9fb5e89837be7d0673;p=home.git r: handle updated branch output --- diff --git a/.bin/r b/.bin/r index 31377ef..cc26b7b 100755 --- 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