Skip to content

Commit 0d7a6e4

Browse files
raalkmlJunio C Hamano
authored andcommitted
Clarify fetch error for missing objects.
Otherwise there're such things like: Cannot obtain needed none 9a6e87b60dbd2305c95cecce7d9d60f849a0658d while processing commit 0000000000000000000000000000000000000000. which while looks weird. What is the none needed for? Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 59f8674 commit 0d7a6e4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

fetch.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ void pull_say(const char *fmt, const char *hex)
2222
fprintf(stderr, fmt, hex);
2323
}
2424

25-
static void report_missing(const char *what, const unsigned char *missing)
25+
static void report_missing(const struct object *obj)
2626
{
2727
char missing_hex[41];
28-
29-
strcpy(missing_hex, sha1_to_hex(missing));;
30-
fprintf(stderr,
31-
"Cannot obtain needed %s %s\nwhile processing commit %s.\n",
32-
what, missing_hex, sha1_to_hex(current_commit_sha1));
28+
strcpy(missing_hex, sha1_to_hex(obj->sha1));;
29+
fprintf(stderr, "Cannot obtain needed %s %s\n",
30+
obj->type ? typename(obj->type): "object", missing_hex);
31+
if (!is_null_sha1(current_commit_sha1))
32+
fprintf(stderr, "while processing commit %s.\n",
33+
sha1_to_hex(current_commit_sha1));
3334
}
3435

3536
static int process(struct object *obj);
@@ -177,7 +178,7 @@ static int loop(void)
177178
*/
178179
if (! (obj->flags & TO_SCAN)) {
179180
if (fetch(obj->sha1)) {
180-
report_missing(typename(obj->type), obj->sha1);
181+
report_missing(obj);
181182
return -1;
182183
}
183184
}

0 commit comments

Comments
 (0)