mirror of
https://github.com/git/git.git
synced 2024-11-24 18:33:43 +08:00
sha1_name.c: get_sha1_1() takes lookup flags
This is to pass the disambiguation hints from the caller down the callchain. Nothing is changed in this step, as everybody just passes 0 in the flag. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6269b6b676
commit
e48ba200be
16
sha1_name.c
16
sha1_name.c
@ -333,7 +333,7 @@ static inline int upstream_mark(const char *string, int len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_sha1_1(const char *name, int len, unsigned char *sha1);
|
||||
static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags);
|
||||
|
||||
static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
|
||||
{
|
||||
@ -370,7 +370,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
|
||||
ret = interpret_branch_name(str+at, &buf);
|
||||
if (ret > 0) {
|
||||
/* substitute this branch name and restart */
|
||||
return get_sha1_1(buf.buf, buf.len, sha1);
|
||||
return get_sha1_1(buf.buf, buf.len, sha1, 0);
|
||||
} else if (ret == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -440,7 +440,7 @@ static int get_parent(const char *name, int len,
|
||||
unsigned char *result, int idx)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
int ret = get_sha1_1(name, len, sha1);
|
||||
int ret = get_sha1_1(name, len, sha1, 0);
|
||||
struct commit *commit;
|
||||
struct commit_list *p;
|
||||
|
||||
@ -473,7 +473,7 @@ static int get_nth_ancestor(const char *name, int len,
|
||||
struct commit *commit;
|
||||
int ret;
|
||||
|
||||
ret = get_sha1_1(name, len, sha1);
|
||||
ret = get_sha1_1(name, len, sha1, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
commit = lookup_commit_reference(sha1);
|
||||
@ -554,7 +554,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (get_sha1_1(name, sp - name - 2, outer))
|
||||
if (get_sha1_1(name, sp - name - 2, outer, 0))
|
||||
return -1;
|
||||
|
||||
o = parse_object(outer);
|
||||
@ -621,7 +621,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_sha1_1(const char *name, int len, unsigned char *sha1)
|
||||
static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags)
|
||||
{
|
||||
int ret, has_suffix;
|
||||
const char *cp;
|
||||
@ -1098,7 +1098,7 @@ static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
|
||||
|
||||
memset(oc, 0, sizeof(*oc));
|
||||
oc->mode = S_IFINVALID;
|
||||
ret = get_sha1_1(name, namelen, sha1);
|
||||
ret = get_sha1_1(name, namelen, sha1, 0);
|
||||
if (!ret)
|
||||
return ret;
|
||||
/* sha1:path --> object name of path in ent sha1
|
||||
@ -1176,7 +1176,7 @@ static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
|
||||
strncpy(object_name, name, cp-name);
|
||||
object_name[cp-name] = '\0';
|
||||
}
|
||||
if (!get_sha1_1(name, cp-name, tree_sha1)) {
|
||||
if (!get_sha1_1(name, cp-name, tree_sha1, 0)) {
|
||||
const char *filename = cp+1;
|
||||
char *new_filename = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user