chiark / gitweb /
tg-remote: use default remote if none is given
authorBert Wesarg <bert.wesarg@googlemail.com>
Sun, 3 Oct 2010 21:25:53 +0000 (23:25 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 3 Oct 2010 22:07:00 +0000 (00:07 +0200)
This is useful if the remote has new topics and you need to populate the local
top-bases.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
README
tg-remote.sh

diff --git a/README b/README
index dec299f009892922b13c8f199fd53a12a678603e..15d20dfe9a1ea3a963229e1c0a2d137f9db3cd97 100644 (file)
--- a/README
+++ b/README
@@ -327,7 +327,7 @@ tg remote
        and 'git push' to operate on them. (Do NOT use 'git push --all'
        for your pushes - plain 'git push' will do the right thing.)
 
        and 'git push' to operate on them. (Do NOT use 'git push --all'
        for your pushes - plain 'git push' will do the right thing.)
 
-       It takes a mandatory remote name argument, and optional
+       It takes a optional remote name argument, and optional
        '--populate' switch - use that for your origin-style remote,
        it will seed the local topic branch system based on the
        remote topic branches. '--populate' will also make 'tg remote'
        '--populate' switch - use that for your origin-style remote,
        it will seed the local topic branch system based on the
        remote topic branches. '--populate' will also make 'tg remote'
index 86dcd9a6ca213bfdc57f5122a557b959c8d2cd00..61774d7a0e28bf0131b1cb1f3851184bb1159c85 100644 (file)
@@ -15,13 +15,16 @@ while [ -n "$1" ]; do
        --populate)
                populate=1;;
        -*)
        --populate)
                populate=1;;
        -*)
-               echo "Usage: tg [...] remote [--populate] REMOTE" >&2
+               echo "Usage: tg [...] remote [--populate] [REMOTE]" >&2
                exit 1;;
        *)
                name="$arg";;
        esac
 done
 
                exit 1;;
        *)
                name="$arg";;
        esac
 done
 
+[ -n "$name" ] ||
+       name="$base_remote"
+
 git config "remote.$name.url" >/dev/null || die "unknown remote '$name'"
 
 
 git config "remote.$name.url" >/dev/null || die "unknown remote '$name'"