diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-20 08:29:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-20 08:29:13 -0700 |
commit | 800644c5cb3aad99a229a09112f42fa88b63c1c4 (patch) | |
tree | 8273c6e88004a86de60bca391f0891e46265e66f | |
parent | fc4263ce4b6a613622dbe985a8e6aca015789cf1 (diff) | |
download | git-800644c5cb3aad99a229a09112f42fa88b63c1c4.tar.gz git-800644c5cb3aad99a229a09112f42fa88b63c1c4.tar.xz |
git-rev-parse: parse ".." before simple SHA1's
This fixes "<hexsha1>..*", since get_sha1() will happily ignore any
garbage at the end and thus we never got to the ".." check before.
-rw-r--r-- | rev-parse.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/rev-parse.c b/rev-parse.c index fd5f2ddca..1f4f3240d 100644 --- a/rev-parse.c +++ b/rev-parse.c @@ -78,20 +78,6 @@ int main(int argc, char **argv) printf("%s\n", arg); continue; } - if (!get_sha1(arg, sha1)) { - if (no_revs) - continue; - def = NULL; - printf("%s\n", sha1_to_hex(sha1)); - continue; - } - if (*arg == '^' && !get_sha1(arg+1, sha1)) { - if (no_revs) - continue; - def = NULL; - printf("^%s\n", sha1_to_hex(sha1)); - continue; - } dotdot = strstr(arg, ".."); if (dotdot) { unsigned char end[20]; @@ -111,6 +97,20 @@ int main(int argc, char **argv) } *dotdot = '.'; } + if (!get_sha1(arg, sha1)) { + if (no_revs) + continue; + def = NULL; + printf("%s\n", sha1_to_hex(sha1)); + continue; + } + if (*arg == '^' && !get_sha1(arg+1, sha1)) { + if (no_revs) + continue; + def = NULL; + printf("^%s\n", sha1_to_hex(sha1)); + continue; + } if (revs_only) continue; def = NULL; |