chiark
/
gitweb
/
~ian
/
topgit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
737a9fa
)
tg-delete.sh: Factor out the emptiness test to tg.sh:branch_empty()
author
Petr Baudis
<pasky@suse.cz>
Sun, 3 Aug 2008 02:20:04 +0000
(
04:20
+0200)
committer
Petr Baudis
<pasky@suse.cz>
Sun, 3 Aug 2008 02:20:04 +0000
(
04:20
+0200)
tg-delete.sh
patch
|
blob
|
history
tg.sh
patch
|
blob
|
history
diff --git
a/tg-delete.sh
b/tg-delete.sh
index 287c4fa738366fac09d0ce126a8f5a55d28644dc..f0114cc6b78568025116823078fc144c2e9cb05b 100644
(file)
--- a/
tg-delete.sh
+++ b/
tg-delete.sh
@@
-35,7
+35,7
@@
baserev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "cannot delete your current branch"
nonempty=
die "cannot delete your current branch"
nonempty=
-
[ -z "$(git diff-tree "refs/top-bases/$name" "$name" | fgrep -v " .top")" ]
|| nonempty=1
+
branch_empty "$name"
|| nonempty=1
[ -z "$nonempty" ] || [ -n "$force" ] || die "branch is non-empty: $name"
[ -z "$nonempty" ] || [ -n "$force" ] || die "branch is non-empty: $name"
diff --git
a/tg.sh
b/tg.sh
index 54b7875a39673886ef3abde6908922d512f0873f..56c5709f1d8f319e7d356d1b0fe9f0880cf98fed 100644
(file)
--- a/
tg.sh
+++ b/
tg.sh
@@
-112,6
+112,12
@@
needs_update()
} || : # $1 is not tracked by TopGit anymore
}
} || : # $1 is not tracked by TopGit anymore
}
+# branch_empty NAME
+branch_empty()
+{
+ [ -z "$(git diff-tree "refs/top-bases/$1" "$1" | fgrep -v " .top")" ]
+}
+
# switch_to_base NAME [SEED]
switch_to_base()
{
# switch_to_base NAME [SEED]
switch_to_base()
{