Merge branch 'fixes'
commit
d53174dbae
13
sha1_name.c
13
sha1_name.c
|
@ -91,9 +91,12 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne
|
||||||
last = mid;
|
last = mid;
|
||||||
}
|
}
|
||||||
if (first < num) {
|
if (first < num) {
|
||||||
unsigned char now[20];
|
unsigned char now[20], next[20];
|
||||||
nth_packed_object_sha1(p, first, now);
|
nth_packed_object_sha1(p, first, now);
|
||||||
if (match_sha(len, match, now)) {
|
if (match_sha(len, match, now)) {
|
||||||
|
if (nth_packed_object_sha1(p, first+1, next) ||
|
||||||
|
!match_sha(len, match, next)) {
|
||||||
|
/* unique within this pack */
|
||||||
if (!found) {
|
if (!found) {
|
||||||
memcpy(found_sha1, now, 20);
|
memcpy(found_sha1, now, 20);
|
||||||
found++;
|
found++;
|
||||||
|
@ -103,6 +106,12 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* not even unique within this pack */
|
||||||
|
found = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == 1)
|
if (found == 1)
|
||||||
|
@ -121,7 +130,7 @@ static int find_unique_short_object(int len, char *canonical,
|
||||||
if (!has_unpacked && !has_packed)
|
if (!has_unpacked && !has_packed)
|
||||||
return -1;
|
return -1;
|
||||||
if (1 < has_unpacked || 1 < has_packed)
|
if (1 < has_unpacked || 1 < has_packed)
|
||||||
return -1;
|
return error("short SHA1 %.*s is ambiguous.", len, canonical);
|
||||||
if (has_unpacked != has_packed) {
|
if (has_unpacked != has_packed) {
|
||||||
memcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1), 20);
|
memcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1), 20);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
static const char git_symbolic_ref_usage[] =
|
static const char git_symbolic_ref_usage[] =
|
||||||
"git-symbolic-ref name [ref]";
|
"git-symbolic-ref name [ref]";
|
||||||
|
|
||||||
static int check_symref(const char *HEAD)
|
static void check_symref(const char *HEAD)
|
||||||
{
|
{
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
const char *git_HEAD = strdup(git_path("%s", HEAD));
|
const char *git_HEAD = strdup(git_path("%s", HEAD));
|
||||||
|
|
Loading…
Reference in New Issue