@@ -98,16 +98,17 @@ static int process_commit(struct commit * commit)
9898 return CONTINUE ;
9999}
100100
101- static struct object_list * * add_object (struct object * obj , struct object_list * * p )
101+ static struct object_list * * add_object (struct object * obj , struct object_list * * p , const char * name )
102102{
103103 struct object_list * entry = xmalloc (sizeof (* entry ));
104104 entry -> item = obj ;
105105 entry -> next = NULL ;
106+ entry -> name = name ;
106107 * p = entry ;
107108 return & entry -> next ;
108109}
109110
110- static struct object_list * * process_blob (struct blob * blob , struct object_list * * p )
111+ static struct object_list * * process_blob (struct blob * blob , struct object_list * * p , const char * name )
111112{
112113 struct object * obj = & blob -> object ;
113114
@@ -116,10 +117,10 @@ static struct object_list **process_blob(struct blob *blob, struct object_list *
116117 if (obj -> flags & (UNINTERESTING | SEEN ))
117118 return p ;
118119 obj -> flags |= SEEN ;
119- return add_object (obj , p );
120+ return add_object (obj , p , name );
120121}
121122
122- static struct object_list * * process_tree (struct tree * tree , struct object_list * * p )
123+ static struct object_list * * process_tree (struct tree * tree , struct object_list * * p , const char * name )
123124{
124125 struct object * obj = & tree -> object ;
125126 struct tree_entry_list * entry ;
@@ -131,12 +132,12 @@ static struct object_list **process_tree(struct tree *tree, struct object_list *
131132 if (parse_tree (tree ) < 0 )
132133 die ("bad tree object %s" , sha1_to_hex (obj -> sha1 ));
133134 obj -> flags |= SEEN ;
134- p = add_object (obj , p );
135+ p = add_object (obj , p , name );
135136 for (entry = tree -> entries ; entry ; entry = entry -> next ) {
136137 if (entry -> directory )
137- p = process_tree (entry -> item .tree , p );
138+ p = process_tree (entry -> item .tree , p , entry -> name );
138139 else
139- p = process_blob (entry -> item .blob , p );
140+ p = process_blob (entry -> item .blob , p , entry -> name );
140141 }
141142 return p ;
142143}
@@ -147,12 +148,12 @@ static void show_commit_list(struct commit_list *list)
147148 while (list ) {
148149 struct commit * commit = pop_most_recent_commit (& list , SEEN );
149150
150- p = process_tree (commit -> tree , p );
151+ p = process_tree (commit -> tree , p , "" );
151152 if (process_commit (commit ) == STOP )
152153 break ;
153154 }
154155 while (objects ) {
155- puts ( sha1_to_hex (objects -> item -> sha1 ));
156+ printf ( "%s %s\n" , sha1_to_hex (objects -> item -> sha1 ), objects -> name );
156157 objects = objects -> next ;
157158 }
158159}
0 commit comments