Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Junio C Hamano committed Oct 4, 2005
2 parents b23f02e + f5a5e9b commit d53174d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,23 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne
last = mid;
}
if (first < num) {
unsigned char now[20];
unsigned char now[20], next[20];
nth_packed_object_sha1(p, first, now);
if (match_sha(len, match, now)) {
if (!found) {
memcpy(found_sha1, now, 20);
found++;
if (nth_packed_object_sha1(p, first+1, next) ||
!match_sha(len, match, next)) {
/* unique within this pack */
if (!found) {
memcpy(found_sha1, now, 20);
found++;
}
else if (memcmp(found_sha1, now, 20)) {
found = 2;
break;
}
}
else if (memcmp(found_sha1, now, 20)) {
else {
/* not even unique within this pack */
found = 2;
break;
}
Expand All @@ -121,7 +130,7 @@ static int find_unique_short_object(int len, char *canonical,
if (!has_unpacked && !has_packed)
return -1;
if (1 < has_unpacked || 1 < has_packed)
return -1;
return error("short SHA1 %.*s is ambiguous.", len, canonical);
if (has_unpacked != has_packed) {
memcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1), 20);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion symbolic-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
static const char git_symbolic_ref_usage[] =
"git-symbolic-ref name [ref]";

static int check_symref(const char *HEAD)
static void check_symref(const char *HEAD)
{
unsigned char sha1[20];
const char *git_HEAD = strdup(git_path("%s", HEAD));
Expand Down

0 comments on commit d53174d

Please sign in to comment.