chiark / gitweb /
Make switching to the current branch a no-op
authorChuck Lever <cel@netapp.com>
Wed, 26 Oct 2005 18:51:45 +0000 (14:51 -0400)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 27 Oct 2005 19:47:12 +0000 (20:47 +0100)
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 <cel@netapp.com>
stgit/commands/branch.py

index c731a6987951b23bf8cfd5e3984784668e16c3ea..3e5efef132d98d54baa5703a41d1b67c3c8fc08d 100644 (file)
@@ -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()