From 24988ec09ea9cbb6e8e5bd9fb5e89837be7d0673 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 5 Oct 2015 12:28:03 -0400 Subject: [PATCH] r: handle updated branch output --- .bin/r | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 -- 2.39.5