Skip to content

Commit a8a50f2

Browse files
rscharfegitster
authored andcommitted
tree: stop using the_repository
Push the use of the_repository to the remaining callers by turning the compatibility wrappers into macros, whose use still requires USE_THE_REPOSITORY_VARIABLE to be defined. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e61c387 commit a8a50f2

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

tree.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define USE_THE_REPOSITORY_VARIABLE
2-
31
#include "git-compat-util.h"
42
#include "hex.h"
53
#include "tree.h"
@@ -185,11 +183,6 @@ int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
185183
return 0;
186184
}
187185

188-
int parse_tree_gently(struct tree *item, int quiet_on_missing)
189-
{
190-
return repo_parse_tree_gently(the_repository, item, quiet_on_missing);
191-
}
192-
193186
int repo_parse_tree_gently(struct repository *r, struct tree *item,
194187
int quiet_on_missing)
195188
{
@@ -219,11 +212,6 @@ void free_tree_buffer(struct tree *tree)
219212
tree->object.parsed = 0;
220213
}
221214

222-
struct tree *parse_tree_indirect(const struct object_id *oid)
223-
{
224-
return repo_parse_tree_indirect(the_repository, oid);
225-
}
226-
227215
struct tree *repo_parse_tree_indirect(struct repository *r,
228216
const struct object_id *oid)
229217
{

tree.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,18 @@ struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
1919

2020
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
2121

22-
int parse_tree_gently(struct tree *tree, int quiet_on_missing);
22+
#define parse_tree_gently(t, q) repo_parse_tree_gently(the_repository, t, q)
2323
int repo_parse_tree_gently(struct repository *r, struct tree *item,
2424
int quiet_on_missing);
25-
static inline int parse_tree(struct tree *tree)
26-
{
27-
return parse_tree_gently(tree, 0);
28-
}
25+
#define parse_tree(t) repo_parse_tree(the_repository, t)
2926
static inline int repo_parse_tree(struct repository *r, struct tree *item)
3027
{
3128
return repo_parse_tree_gently(r, item, 0);
3229
}
3330
void free_tree_buffer(struct tree *tree);
3431

3532
/* Parses and returns the tree in the given ent, chasing tags and commits. */
36-
struct tree *parse_tree_indirect(const struct object_id *oid);
33+
#define parse_tree_indirect(o) repo_parse_tree_indirect(the_repository, o)
3734
struct tree *repo_parse_tree_indirect(struct repository *r,
3835
const struct object_id *oid);
3936

0 commit comments

Comments
 (0)