From: Chuck Lever Date: Wed, 26 Oct 2005 18:51:45 +0000 (-0400) Subject: Make switching to the current branch a no-op X-Git-Tag: v0.8~50 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/9756a20261dd76630b570b274afc18c3bf4c6589 Make switching to the current branch a no-op Check if "stg branch name" is switching to the branch we are already in, and make that case a no-op. Signed-off-by: Chuck Lever --- diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index c731a69..3e5efef 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -197,6 +197,9 @@ def func(parser, options, args): elif len(args) == 1: + if args[0] == git.get_head_file(): + raise CmdException, 'Branch "%s" is already the current branch' % args[0] + print 'Switching to branch "%s"...' % args[0], sys.stdout.flush()