diff --git a/walker.c b/walker.c
index c10eca88261eed6b0e5c3fc2fdc19b8332c4ac6b..e57630e983488e5c0222dc47a5e32d6efb184762 100644 (file)
--- a/walker.c
+++ b/walker.c
static void report_missing(const struct object *obj)
{
char missing_hex[41];
static void report_missing(const struct object *obj)
{
char missing_hex[41];
- strcpy(missing_hex, sha1_to_hex(obj->sha1));;
+ strcpy(missing_hex, sha1_to_hex(obj->sha1));
fprintf(stderr, "Cannot obtain needed %s %s\n",
obj->type ? typename(obj->type): "object", missing_hex);
if (!is_null_sha1(current_commit_sha1))
fprintf(stderr, "Cannot obtain needed %s %s\n",
obj->type ? typename(obj->type): "object", missing_hex);
if (!is_null_sha1(current_commit_sha1))
free(tree->buffer);
tree->buffer = NULL;
tree->size = 0;
free(tree->buffer);
tree->buffer = NULL;
tree->size = 0;
+ tree->object.parsed = 0;
return 0;
}
return 0;
}
@@ -190,9 +191,13 @@ static int interpret_target(struct walker *walker, char *target, unsigned char *
if (!get_sha1_hex(target, sha1))
return 0;
if (!check_ref_format(target)) {
if (!get_sha1_hex(target, sha1))
return 0;
if (!check_ref_format(target)) {
- if (!walker->fetch_ref(walker, target, sha1)) {
+ struct ref *ref = alloc_ref(target);
+ if (!walker->fetch_ref(walker, ref)) {
+ hashcpy(sha1, ref->old_sha1);
+ free(ref);
return 0;
}
return 0;
}
+ free(ref);
}
return -1;
}
}
return -1;
}
int walker_targets_stdin(char ***target, const char ***write_ref)
{
int targets = 0, targets_alloc = 0;
int walker_targets_stdin(char ***target, const char ***write_ref)
{
int targets = 0, targets_alloc = 0;
- struct strbuf buf;
+ struct strbuf buf = STRBUF_INIT;
*target = NULL; *write_ref = NULL;
*target = NULL; *write_ref = NULL;
- strbuf_init(&buf, 0);
while (1) {
char *rf_one = NULL;
char *tg_one;
while (1) {
char *rf_one = NULL;
char *tg_one;