diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-10-18 22:25:27 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-10-18 23:05:33 +0200 |
commit | 5912d74c69fb1cbfcb5f57261543d8b7afcedef1 (patch) | |
tree | d311fc0f0c62ea3a8257d82e21a5bc6049c09852 /src/revparse.c | |
parent | b2b571ce0c2969bdc00bfa400d20da5cdece1dcd (diff) | |
download | libgit2-5912d74c69fb1cbfcb5f57261543d8b7afcedef1.tar.gz |
revparse: properly handle refnames containing a @
Fix #994
Diffstat (limited to 'src/revparse.c')
-rw-r--r-- | src/revparse.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/revparse.c b/src/revparse.c index 191f6374c..83eea7d3f 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -795,20 +795,24 @@ int git_revparse_single(git_object **out, git_repository *repo, const char *spec case '@': { - git_object *temp_object = NULL; + if (spec[pos+1] == '{') { + git_object *temp_object = NULL; - if ((error = extract_curly_braces_content(&buf, spec, &pos)) < 0) - goto cleanup; + if ((error = extract_curly_braces_content(&buf, spec, &pos)) < 0) + goto cleanup; - if ((error = ensure_base_rev_is_not_known_yet(base_rev, spec)) < 0) - goto cleanup; + if ((error = ensure_base_rev_is_not_known_yet(base_rev, spec)) < 0) + goto cleanup; - if ((error = handle_at_syntax(&temp_object, &reference, spec, identifier_len, repo, git_buf_cstr(&buf))) < 0) - goto cleanup; + if ((error = handle_at_syntax(&temp_object, &reference, spec, identifier_len, repo, git_buf_cstr(&buf))) < 0) + goto cleanup; - if (temp_object != NULL) - base_rev = temp_object; - break; + if (temp_object != NULL) + base_rev = temp_object; + break; + } else { + /* Fall through */ + } } default: |