Optimise the git.switch() function
[stgit] / stgit / commands / common.py
index db0466d..c4ddc94 100644 (file)
@@ -31,7 +31,7 @@ class CmdException(Exception):
 
 
 # Utility functions
-def git_id(string):
+def git_id(string, strict = False):
     """Return the GIT id
     """
     if not string:
@@ -54,8 +54,9 @@ def git_id(string):
             if os.path.isfile(id_file):
                 return read_string(id_file)
 
-        # maybe GIT know more about this id
-        return git_id
+        # maybe GIT knows more about this id
+        if not strict:
+            return git_id
     elif len(string_list) == 2:
         patch_name = string_list[0]
         if patch_name == '':