X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tg-update.sh;h=5caf6910a17f7c39906fe6456bd550faf4b537c2;hb=9092d7656e160bc7384d82c6c42062817ae0a20f;hp=03b8f3fc6b81bc1cc78263122cb0f412f2a0521e;hpb=308892d0c071135031994606170c8be6653e7197;p=topgit.git diff --git a/tg-update.sh b/tg-update.sh index 03b8f3f..5caf691 100644 --- a/tg-update.sh +++ b/tg-update.sh @@ -21,8 +21,10 @@ base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ## First, take care of our base -depcheck="$(mktemp)" -needs_update "$name" >"$depcheck" +depcheck="$(mktemp -t tg-depcheck.XXXXXX)" +missing_deps= +needs_update "$name" >"$depcheck" || : +[ -z "$missing_deps" ] || die "some dependencies are missing: $missing_deps" if [ -s "$depcheck" ]; then # We need to switch to the base branch # ...but only if we aren't there yet (from failed previous merge) @@ -37,13 +39,13 @@ if [ -s "$depcheck" ]; then sed 's/^\([^+]\)/-\1/' | # now each line is +branch or -branch (+ == recurse) uniq -s 1 | # fold branch lines; + always comes before - and thus wins within uniq while read depline; do - action="${depline:0:1}" - dep="${depline:1}" + action="$(echo "$depline" | cut -c 1)" + dep="$(echo "$depline" | cut -c 2-)" # We do not distinguish between dependencies out-of-date - # and base out-of-date cases for $dep here, but thanks - # to needs_update returning : for the latter, we do - # correctly recurse here in both cases. + # and base out-of-date cases for $dep here, + # but thanks to needs_update returning : for the latter, + # we do correctly recurse here in both cases. if [ x"$action" = x+ ]; then info "Recursing to $dep..." @@ -55,7 +57,7 @@ if [ -s "$depcheck" ]; then # The merge got stuck! Let the user fix it up. info "You are in a subshell. If you abort the merge," info "use \`exit 1\` to abort the recursive update altogether." - if ! sh -i; then + if ! sh -i