From 7053376fdcd6484cb1ec6e275cb547f8c71dfb1b Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 19 Jun 2017 12:49:39 -0700 Subject: [PATCH] tg.sh: make needs_update return 1 for out-of-date remote Fix the regression since 0.19.1 that caused needs_update to return a 0 status if the only needed update was from a remote branch. Turns out most clients only care about the output not the actual status code so the only affected caller was tg export which would have failed to cancel an export of a branch only out-of-date in that fashion. Correct this and make tg export picky again. The non-picky-about- out-of-date-remote-heads behavior can always be obtained whenever desired by simply using the global -u option. Signed-off-by: Kyle J. McKay --- tg.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tg.sh b/tg.sh index 9ab0de7..9f2ae37 100644 --- a/tg.sh +++ b/tg.sh @@ -1187,8 +1187,10 @@ branch_needs_update() [ -z "$_dep_annihilated" ] || return 0 if [ -n "$_dep_has_remote" ]; then - branch_contains "refs/heads/$_dep" "refs/remotes/$base_remote/$_dep" || + branch_contains "refs/heads/$_dep" "refs/remotes/$base_remote/$_dep" || { echo "refs/remotes/$base_remote/$_dep $_dep $_depchain" + _ret=1 + } fi # We want to sync with our base first and should output this before # the remote branch, but the order does not actually matter to tg-update @@ -1222,7 +1224,8 @@ branch_needs_update() # order is reversed from the order they will actually be updated in # order to accomodate tg info which treats out-of-date items that are # only in the base as already being in the head for status purposes. -# It will also return non-zero status if NAME needs update. +# It will also return non-zero status if NAME needs update (seems backwards +# but think of it as non-zero status if any non-missing output lines produced) # If needs_update() hits missing dependencies, it will append # them to space-separated $missing_deps list and skip them. needs_update() -- 2.11.4.GIT