Skip to content

Commit 7914053

Browse files
Martin Koeglergitster
authored andcommitted
Remove unused object-ref code
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 271b8d2 commit 7914053

File tree

11 files changed

+1
-166
lines changed

11 files changed

+1
-166
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ LIB_OBJS = \
312312
patch-ids.o \
313313
object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \
314314
sideband.o reachable.o reflog-walk.o \
315-
quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
315+
quote.o read-cache.o refs.o run-command.o dir.o \
316316
server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
317317
tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
318318
revision.o pager.o tree-walk.o xdiff-interface.o \

builtin-fetch-pack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
385385
int retval;
386386
unsigned long cutoff = 0;
387387

388-
track_object_refs = 0;
389388
save_commit_buffer = 0;
390389

391390
for (ref = *refs; ref; ref = ref->next) {

builtin-pack-objects.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,6 @@ static void get_object_list(int ac, const char **av)
20092009

20102010
init_revisions(&revs, NULL);
20112011
save_commit_buffer = 0;
2012-
track_object_refs = 0;
20132012
setup_revisions(ac, av, &revs, NULL);
20142013

20152014
while (fgets(line, sizeof(line), stdin) != NULL) {

builtin-rev-list.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
605605
usage(rev_list_usage);
606606

607607
save_commit_buffer = revs.verbose_header || revs.grep_filter;
608-
track_object_refs = 0;
609608
if (bisect_list)
610609
revs.limited = 1;
611610

commit.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,6 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
290290
}
291291
item->date = parse_commit_date(bufptr, tail);
292292

293-
if (track_object_refs) {
294-
unsigned i = 0;
295-
struct commit_list *p;
296-
struct object_refs *refs = alloc_object_refs(n_refs);
297-
if (item->tree)
298-
refs->ref[i++] = &item->tree->object;
299-
for (p = item->parents; p; p = p->next)
300-
refs->ref[i++] = &p->item->object;
301-
set_object_refs(&item->object, refs);
302-
}
303-
304293
return 0;
305294
}
306295

object-refs.c

Lines changed: 0 additions & 87 deletions
This file was deleted.

object.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@ struct object {
3535
unsigned char sha1[20];
3636
};
3737

38-
extern int track_object_refs;
39-
4038
extern const char *typename(unsigned int type);
4139
extern int type_from_string(const char *str);
4240

4341
extern unsigned int get_max_object_index(void);
4442
extern struct object *get_indexed_object(unsigned int);
45-
extern struct object_refs *lookup_object_refs(struct object *);
4643

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

64-
struct object_refs *alloc_object_refs(unsigned count);
65-
void set_object_refs(struct object *obj, struct object_refs *refs);
66-
67-
void mark_reachable(struct object *obj, unsigned int mask);
68-
6961
struct object_list *object_list_insert(struct object *item,
7062
struct object_list **list_p);
7163

tag.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
8484
item->tagged = NULL;
8585
}
8686

87-
if (item->tagged && track_object_refs) {
88-
struct object_refs *refs = alloc_object_refs(1);
89-
refs->ref[0] = item->tagged;
90-
set_object_refs(&item->object, refs);
91-
}
92-
9387
return 0;
9488
}
9589

tree.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -202,52 +202,6 @@ struct tree *lookup_tree(const unsigned char *sha1)
202202
return (struct tree *) obj;
203203
}
204204

205-
/*
206-
* NOTE! Tree refs to external git repositories
207-
* (ie gitlinks) do not count as real references.
208-
*
209-
* You don't have to have those repositories
210-
* available at all, much less have the objects
211-
* accessible from the current repository.
212-
*/
213-
static void track_tree_refs(struct tree *item)
214-
{
215-
int n_refs = 0, i;
216-
struct object_refs *refs;
217-
struct tree_desc desc;
218-
struct name_entry entry;
219-
220-
/* Count how many entries there are.. */
221-
init_tree_desc(&desc, item->buffer, item->size);
222-
while (tree_entry(&desc, &entry)) {
223-
if (S_ISGITLINK(entry.mode))
224-
continue;
225-
n_refs++;
226-
}
227-
228-
/* Allocate object refs and walk it again.. */
229-
i = 0;
230-
refs = alloc_object_refs(n_refs);
231-
init_tree_desc(&desc, item->buffer, item->size);
232-
while (tree_entry(&desc, &entry)) {
233-
struct object *obj;
234-
235-
if (S_ISGITLINK(entry.mode))
236-
continue;
237-
if (S_ISDIR(entry.mode))
238-
obj = &lookup_tree(entry.sha1)->object;
239-
else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
240-
obj = &lookup_blob(entry.sha1)->object;
241-
else {
242-
warning("in tree %s: entry %s has bad mode %.6o\n",
243-
sha1_to_hex(item->object.sha1), entry.path, entry.mode);
244-
obj = lookup_unknown_object(entry.sha1);
245-
}
246-
refs->ref[i++] = obj;
247-
}
248-
set_object_refs(&item->object, refs);
249-
}
250-
251205
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
252206
{
253207
if (item->object.parsed)
@@ -256,8 +210,6 @@ int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
256210
item->buffer = buffer;
257211
item->size = size;
258212

259-
if (track_object_refs)
260-
track_tree_refs(item);
261213
return 0;
262214
}
263215

upload-pack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ static int get_common_commits(void)
392392
char hex[41], last_hex[41];
393393
int len;
394394

395-
track_object_refs = 0;
396395
save_commit_buffer = 0;
397396

398397
for(;;) {

0 commit comments

Comments
 (0)