From: Catalin Marinas Date: Fri, 17 Feb 2006 21:31:43 +0000 (+0000) Subject: Allow tag objects to be passed on the command line X-Git-Tag: v0.14.3~545 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/2fef9462b26126402f26140a02d3e16cdd2d9928 Allow tag objects to be passed on the command line stgit.common.git_id() was modified to add '^0' to the revision so that a tag can be used for different operations and the corresponding commit will be returned. Commands like 'branch --create' were failing if a tag was passed. Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index ef44349..cc74122 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -124,7 +124,7 @@ def func(parser, options, args): tree_id = None if len(args) == 2: - tree_id = args[1] + tree_id = git_id(args[1]) git.create_branch(args[0], tree_id) stack.Series(args[0]).init() diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 88f1433..f7301da 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -81,7 +81,7 @@ def git_id(rev): return read_string(series.get_base_file()) # anything else failed - return git.rev_parse(rev) + return git.rev_parse(rev + '^{commit}') def check_local_changes(): if git.local_changes(): diff --git a/stgit/git.py b/stgit/git.py index 582e803..016bc3a 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -308,7 +308,7 @@ def switch_branch(name): if not branch_exists(new_head): raise GitException, 'Branch "%s" does not exist' % name - tree_id = rev_parse(new_head + '^0') + tree_id = rev_parse(new_head + '^{commit}') if tree_id != get_head(): refresh_index() if __run('git-read-tree -u -m', [get_head(), tree_id]) != 0: