From cb477dedcf13b1d8e81ee8578a8b7e24c37593b0 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Mon, 21 Jul 2008 12:30:08 -0400 Subject: [PATCH] cmd_fetch: fix the no-arguments usage --- yap/yap.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yap/yap.py b/yap/yap.py index ac98525..4a5465a 100644 --- a/yap/yap.py +++ b/yap/yap.py @@ -1003,11 +1003,17 @@ argument. def cmd_fetch(self, repo=None): "" self._check_git() + current = get_output("git symbolic-ref HEAD") + if not current: + raise YapError("Not on a branch!") + if repo and repo not in [ x[0] for x in self._list_remotes() ]: raise YapError("No such repository: %s" % repo) if repo is None: + current = current[0].replace('refs/heads/', '') remote = get_output("git config branch.%s.remote" % current) - repo = remote[0] + if remote: + repo = remote[0] if repo is None: raise YapError("No tracking branch configured; specify a repository") os.system("git fetch %s" % repo) -- 2.11.4.GIT