Skip to content

Commit

Permalink
Remove unused object-ref code
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Martin Koegler authored and Junio C Hamano committed Feb 26, 2008
1 parent 271b8d2 commit 7914053
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 166 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ LIB_OBJS = \
patch-ids.o \
object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \
sideband.o reachable.o reflog-walk.o \
quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
quote.o read-cache.o refs.o run-command.o dir.o \
server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
revision.o pager.o tree-walk.o xdiff-interface.o \
Expand Down
1 change: 0 additions & 1 deletion builtin-fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
int retval;
unsigned long cutoff = 0;

track_object_refs = 0;
save_commit_buffer = 0;

for (ref = *refs; ref; ref = ref->next) {
Expand Down
1 change: 0 additions & 1 deletion builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,6 @@ static void get_object_list(int ac, const char **av)

init_revisions(&revs, NULL);
save_commit_buffer = 0;
track_object_refs = 0;
setup_revisions(ac, av, &revs, NULL);

while (fgets(line, sizeof(line), stdin) != NULL) {
Expand Down
1 change: 0 additions & 1 deletion builtin-rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
usage(rev_list_usage);

save_commit_buffer = revs.verbose_header || revs.grep_filter;
track_object_refs = 0;
if (bisect_list)
revs.limited = 1;

Expand Down
11 changes: 0 additions & 11 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,6 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
}
item->date = parse_commit_date(bufptr, tail);

if (track_object_refs) {
unsigned i = 0;
struct commit_list *p;
struct object_refs *refs = alloc_object_refs(n_refs);
if (item->tree)
refs->ref[i++] = &item->tree->object;
for (p = item->parents; p; p = p->next)
refs->ref[i++] = &p->item->object;
set_object_refs(&item->object, refs);
}

return 0;
}

Expand Down
87 changes: 0 additions & 87 deletions object-refs.c

This file was deleted.

8 changes: 0 additions & 8 deletions object.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ struct object {
unsigned char sha1[20];
};

extern int track_object_refs;

extern const char *typename(unsigned int type);
extern int type_from_string(const char *str);

extern unsigned int get_max_object_index(void);
extern struct object *get_indexed_object(unsigned int);
extern struct object_refs *lookup_object_refs(struct object *);

/** Internal only **/
struct object *lookup_object(const unsigned char *sha1);
Expand All @@ -61,11 +58,6 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
/** Returns the object, with potentially excess memory allocated. **/
struct object *lookup_unknown_object(const unsigned char *sha1);

struct object_refs *alloc_object_refs(unsigned count);
void set_object_refs(struct object *obj, struct object_refs *refs);

void mark_reachable(struct object *obj, unsigned int mask);

struct object_list *object_list_insert(struct object *item,
struct object_list **list_p);

Expand Down
6 changes: 0 additions & 6 deletions tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
item->tagged = NULL;
}

if (item->tagged && track_object_refs) {
struct object_refs *refs = alloc_object_refs(1);
refs->ref[0] = item->tagged;
set_object_refs(&item->object, refs);
}

return 0;
}

Expand Down
48 changes: 0 additions & 48 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,52 +202,6 @@ struct tree *lookup_tree(const unsigned char *sha1)
return (struct tree *) obj;
}

/*
* NOTE! Tree refs to external git repositories
* (ie gitlinks) do not count as real references.
*
* You don't have to have those repositories
* available at all, much less have the objects
* accessible from the current repository.
*/
static void track_tree_refs(struct tree *item)
{
int n_refs = 0, i;
struct object_refs *refs;
struct tree_desc desc;
struct name_entry entry;

/* Count how many entries there are.. */
init_tree_desc(&desc, item->buffer, item->size);
while (tree_entry(&desc, &entry)) {
if (S_ISGITLINK(entry.mode))
continue;
n_refs++;
}

/* Allocate object refs and walk it again.. */
i = 0;
refs = alloc_object_refs(n_refs);
init_tree_desc(&desc, item->buffer, item->size);
while (tree_entry(&desc, &entry)) {
struct object *obj;

if (S_ISGITLINK(entry.mode))
continue;
if (S_ISDIR(entry.mode))
obj = &lookup_tree(entry.sha1)->object;
else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
obj = &lookup_blob(entry.sha1)->object;
else {
warning("in tree %s: entry %s has bad mode %.6o\n",
sha1_to_hex(item->object.sha1), entry.path, entry.mode);
obj = lookup_unknown_object(entry.sha1);
}
refs->ref[i++] = obj;
}
set_object_refs(&item->object, refs);
}

int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
{
if (item->object.parsed)
Expand All @@ -256,8 +210,6 @@ int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
item->buffer = buffer;
item->size = size;

if (track_object_refs)
track_tree_refs(item);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ static int get_common_commits(void)
char hex[41], last_hex[41];
int len;

track_object_refs = 0;
save_commit_buffer = 0;

for(;;) {
Expand Down
1 change: 0 additions & 1 deletion walker.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ int walker_fetch(struct walker *walker, int targets, char **target,
int i;

save_commit_buffer = 0;
track_object_refs = 0;

for (i = 0; i < targets; i++) {
if (!write_ref || !write_ref[i])
Expand Down

0 comments on commit 7914053

Please sign in to comment.