summaryrefslogtreecommitdiff
path: root/fsck-objects.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-05-28 23:05:02 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-28 23:05:02 -0700
commit52bc0e294c0d5924db0e5e8f25284e467c6d2983 (patch)
tree86f9e8fe89841de0e69e91902865002dffdaa6bf /fsck-objects.c
parentMerge branch 'jc/cache-tree' into next (diff)
parentMerge branch 'lt/tree' into jc/lt-tree-n-cache-tree (diff)
downloadtgif-52bc0e294c0d5924db0e5e8f25284e467c6d2983.tar.xz
Merge branch 'jc/lt-tree-n-cache-tree' into next
* jc/lt-tree-n-cache-tree: Remove "tree->entries" tree-entry list from tree parser Switch "read_tree_recursive()" over to tree-walk functionality Make "tree_entry" have a SHA1 instead of a union of object pointers Add raw tree buffer info to "struct tree" Don't use "sscanf()" for tree mode scanning git-fetch: avoid using "case ... in (arm)"
Diffstat (limited to 'fsck-objects.c')
-rw-r--r--fsck-objects.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fsck-objects.c b/fsck-objects.c
index 1922b6d84c..42778e87d0 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -11,6 +11,7 @@
#include "cache-tree.h"
#define REACHABLE 0x0001
+#define SEEN 0x0002
static int show_root = 0;
static int show_tags = 0;
@@ -161,7 +162,7 @@ static int fsck_tree(struct tree *item)
struct tree_entry_list *entry, *last;
last = NULL;
- for (entry = item->entries; entry; entry = entry->next) {
+ for (entry = create_tree_entry_list(item); entry; entry = entry->next) {
if (strchr(entry->name, '/'))
has_full_path = 1;
has_zero_pad |= entry->zeropad;
@@ -198,17 +199,15 @@ static int fsck_tree(struct tree *item)
default:
break;
}
- free(last->name);
free(last);
}
last = entry;
}
- if (last) {
- free(last->name);
+ if (last)
free(last);
- }
- item->entries = NULL;
+ free(item->buffer);
+ item->buffer = NULL;
retval = 0;
if (has_full_path) {
@@ -278,6 +277,9 @@ static int fsck_sha1(unsigned char *sha1)
struct object *obj = parse_object(sha1);
if (!obj)
return error("%s: object not found", sha1_to_hex(sha1));
+ if (obj->flags & SEEN)
+ return 0;
+ obj->flags |= SEEN;
if (obj->type == blob_type)
return 0;
if (obj->type == tree_type)
@@ -465,6 +467,7 @@ int main(int argc, char **argv)
{
int i, heads;
+ track_object_refs = 1;
setup_git_directory();
for (i = 1; i < argc; i++) {