chiark / gitweb /
Generalize subcommand selection in "tg depend"
authorPer Cederqvist <ceder@lysator.liu.se>
Tue, 24 Aug 2010 18:32:39 +0000 (20:32 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 24 Aug 2010 18:51:05 +0000 (20:51 +0200)
Prepare "tg depend" for new subcommands by moving the implementation
of "tg add" to a function.

Signed-off-by: Per Cederqvist <ceder@lysator.liu.se>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
tg-depend.sh

index 43d8321..6d98b5f 100644 (file)
@@ -43,10 +43,14 @@ branchrev="$(git rev-parse --verify "$name" 2>/dev/null)" ||
        die "invalid branch name: $name"
 
 ## Record new dependency
+depend_add()
+{
+       echo "$name" >>"$root_dir/.topdeps"
+       git add -f "$root_dir/.topdeps"
+       git commit -m"New TopGit dependency: $name"
+       $tg update
+}
 
-echo "$name" >>"$root_dir/.topdeps"
-git add -f "$root_dir/.topdeps"
-git commit -m"New TopGit dependency: $name"
-$tg update
+depend_$subcmd
 
 # vim:noet