From d1eb3f85c890ab979bb95febf1060f351b39daf3 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Tue, 27 Sep 2005 14:59:52 +0100 Subject: [PATCH] Add support for git-rev-parse The git_id() function now calls git.rev_parse() if it cannot get the id. Signed-off-by: Catalin Marinas --- stgit/commands/common.py | 2 +- stgit/git.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stgit/commands/common.py b/stgit/commands/common.py index c6d4535..eacae95 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -56,7 +56,7 @@ def git_id(string, strict = False): # maybe GIT knows more about this id if not strict: - return git_id + return git.rev_parse(git_id) elif len(string_list) == 2: patch_name = string_list[0] if patch_name == '': diff --git a/stgit/git.py b/stgit/git.py index 7ab9aef..cc0ae79 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -233,6 +233,11 @@ def __set_head(val): """ write_string(head_link, val) +def rev_parse(git_id): + """Parse the string and return an SHA1 id + """ + _output(['git-rev-parse', git_id]) + def add(names): """Add the files or recursively add the directory contents """ -- 2.11.0