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>

Junio C Hamano committed Jul 2, 2012 at 09:46 UTC e48ba200be908f02a3fb30adcbb8000b7100cb32
1 file changed +8 -8
sha1_name.c
+8 -8
@@ -333,7 +333,7 @@ static inline int upstream_mark(const char *string, int len)
333 return 0;
334 }
335
336 -static int get_sha1_1(const char *name, int len, unsigned char *sha1);
336 +static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags);
337
338 static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
339 {
@@ -370,7 +370,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
370 ret = interpret_branch_name(str+at, &buf);
371 if (ret > 0) {
372 /* substitute this branch name and restart */
373 - return get_sha1_1(buf.buf, buf.len, sha1);
373 + return get_sha1_1(buf.buf, buf.len, sha1, 0);
374 } else if (ret == 0) {
375 return -1;
376 }
@@ -440,7 +440,7 @@ static int get_parent(const char *name, int len,
440 unsigned char *result, int idx)
441 {
442 unsigned char sha1[20];
443 - int ret = get_sha1_1(name, len, sha1);
443 + int ret = get_sha1_1(name, len, sha1, 0);
444 struct commit *commit;
445 struct commit_list *p;
446
@@ -473,7 +473,7 @@ static int get_nth_ancestor(const char *name, int len,
473 struct commit *commit;
474 int ret;
475
476 - ret = get_sha1_1(name, len, sha1);
476 + ret = get_sha1_1(name, len, sha1, 0);
477 if (ret)
478 return ret;
479 commit = lookup_commit_reference(sha1);
@@ -554,7 +554,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
554 else
555 return -1;
556
557 - if (get_sha1_1(name, sp - name - 2, outer))
557 + if (get_sha1_1(name, sp - name - 2, outer, 0))
558 return -1;
559
560 o = parse_object(outer);
@@ -621,7 +621,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
621 return -1;
622 }
623
624 -static int get_sha1_1(const char *name, int len, unsigned char *sha1)
624 +static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags)
625 {
626 int ret, has_suffix;
627 const char *cp;
@@ -1098,7 +1098,7 @@ static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
1098
1099 memset(oc, 0, sizeof(*oc));
1100 oc->mode = S_IFINVALID;
1101 - ret = get_sha1_1(name, namelen, sha1);
1101 + ret = get_sha1_1(name, namelen, sha1, 0);
1102 if (!ret)
1103 return ret;
1104 /* 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,
1176 strncpy(object_name, name, cp-name);
1177 object_name[cp-name] = '\0';
1178 }
1179 - if (!get_sha1_1(name, cp-name, tree_sha1)) {
1179 + if (!get_sha1_1(name, cp-name, tree_sha1, 0)) {
1180 const char *filename = cp+1;
1181 char *new_filename = NULL;
1182