aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Junio C Hamano <gitster@pobox.com> 2009-09-16 14:45:18 -0700
committerGravatar Junio C Hamano <gitster@pobox.com> 2009-09-16 14:45:18 -0700
commitaf4f6405296dec699321ca59d48583ffa0323b0e (patch)
tree8858983d81b0eef76eb55d21a0d96b7b16846eca
parent6674d310d179400358d581f9725cbd4a2c32e3bf (diff)
parent9a217391e931763d168d177decfe5e962d306bac (diff)
downloadgit-af4f6405296dec699321ca59d48583ffa0323b0e.tar.gz
git-af4f6405296dec699321ca59d48583ffa0323b0e.zip
Merge branch 'jc/maint-unpack-objects-strict' into maint
* jc/maint-unpack-objects-strict: Fix "unpack-objects --strict" Conflicts: builtin-unpack-objects.c
-rw-r--r--builtin-unpack-objects.c16
-rw-r--r--t/t5531-deep-submodule-push.sh35
2 files changed, 44 insertions, 7 deletions
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index 557148a693..3d650a1c41 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -181,10 +181,10 @@ static void write_cached_object(struct object *obj)
static int check_object(struct object *obj, int type, void *data)
{
if (!obj)
- return 0;
+ return 1;
if (obj->flags & FLAG_WRITTEN)
- return 1;
+ return 0;
if (type != OBJ_ANY && obj->type != type)
die("object type mismatch");
@@ -195,22 +195,24 @@ static int check_object(struct object *obj, int type, void *data)
if (type != obj->type || type <= 0)
die("object of unexpected type");
obj->flags |= FLAG_WRITTEN;
- return 1;
+ return 0;
}
if (fsck_object(obj, 1, fsck_error_function))
die("Error in object");
- if (!fsck_walk(obj, check_object, NULL))
+ if (fsck_walk(obj, check_object, NULL))
die("Error on reachable objects of %s", sha1_to_hex(obj->sha1));
write_cached_object(obj);
- return 1;
+ return 0;
}
static void write_rest(void)
{
unsigned i;
- for (i = 0; i < nr_objects; i++)
- check_object(obj_list[i].obj, OBJ_ANY, NULL);
+ for (i = 0; i < nr_objects; i++) {
+ if (obj_list[i].obj)
+ check_object(obj_list[i].obj, OBJ_ANY, NULL);
+ }
}
static void added_object(unsigned nr, enum object_type type,
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
new file mode 100644
index 0000000000..65d8d474bc
--- /dev/null
+++ b/t/t5531-deep-submodule-push.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+test_description='unpack-objects'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ mkdir pub.git &&
+ GIT_DIR=pub.git git init --bare
+ GIT_DIR=pub.git git config receive.fsckobjects true &&
+ mkdir work &&
+ (
+ cd work &&
+ git init &&
+ mkdir -p gar/bage &&
+ (
+ cd gar/bage &&
+ git init &&
+ >junk &&
+ git add junk &&
+ git commit -m "Initial junk"
+ ) &&
+ git add gar/bage &&
+ git commit -m "Initial superproject"
+ )
+'
+
+test_expect_success push '
+ (
+ cd work &&
+ git push ../pub.git master
+ )
+'
+
+test_done