* [PATCH TopGit] tg.sh: check for removed branch in branch_annihilated
@ 2011-03-11 7:28 Andrey Borzenkov
0 siblings, 0 replies; only message in thread
From: Andrey Borzenkov @ 2011-03-11 7:28 UTC (permalink / raw)
To: git
Check that branch was not deleted by external means; prevents
errors from further git commands due to non-existing refs.
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
---
tg.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tg.sh b/tg.sh
index 9082d88..e8447cb 100644
--- a/tg.sh
+++ b/tg.sh
@@ -175,9 +175,9 @@ branch_annihilated()
_name="$1";
# use the merge base in case the base is ahead.
- mb="$(git merge-base "refs/top-bases/$_name" "$_name")";
+ mb="$(git merge-base "refs/top-bases/$_name" "$_name" 2> /dev/null)";
- test "$(git rev-parse "$mb^{tree}")" = "$(git rev-parse "$_name^{tree}")";
+ test -z "$mb" || test "$(git rev-parse "$mb^{tree}")" = "$(git rev-parse "$_name^{tree}")";
}
# is_sha1 REF
--
tg: (d279e29..) u/removed-branch (depends on: origin/master)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-11 7:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11 7:28 [PATCH TopGit] tg.sh: check for removed branch in branch_annihilated Andrey Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).