Skip to content

Commit

Permalink
git-rev-parse: parse ".." before simple SHA1's
Browse files Browse the repository at this point in the history
This fixes "<hexsha1>..*", since get_sha1() will happily ignore any
garbage at the end and thus we never got to the ".." check before.
  • Loading branch information
Linus Torvalds committed Jun 20, 2005
1 parent fc4263c commit 800644c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down

0 comments on commit 800644c

Please sign in to comment.