From eb4f30ea92bdc27f9138ed0fe90e7ede21b84c9e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 20 Aug 2026 09:13:14 -0700 Subject: [PATCH] Meta/update-from-lore: accept an existing branch name to update --- update-from-lore.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/update-from-lore.sh b/update-from-lore.sh index d4bddcf7e6..5b1b1e60c7 100755 --- a/update-from-lore.sh +++ b/update-from-lore.sh @@ -13,6 +13,17 @@ afresh () { exit $? } +redo_or_afresh () { + if git show-ref --quiet --verify "refs/heads/$1" + then + git checkout "$1" || exit + return + else + afresh "$1" + return + fi +} + force= while case "$#" in 0) break;; esac do @@ -30,7 +41,7 @@ done case "$#" in 0) : happy ;; -1) afresh "$1" ;; +1) redo_or_afresh "$1" ;; *) echo >&2 "$0: extra arguments" ;; esac