Skip to content

Commit 7367d88

Browse files
avargitster
authored andcommitted
archive: stop passing "stage" through read_tree_recursive()
The "stage" variable being passed around in the archive code has only ever been an elaborate way to hardcode the value "0". This code was added in its original form in e4fbbfe (Add git-zip-tree, 2006-08-26), at which point a hardcoded "0" would be passed down through read_tree_recursive() to write_zip_entry(). It was then diligently added to the "struct directory" in ed22b41 (archive: support filtering paths with glob, 2014-09-21), but we were still not doing anything except passing it around as-is. Let's stop doing that in the code internal to archive.c, we'll still feed "0" to read_tree_recursive() itself, but won't use it. That we're providing it at all to read_tree_recursive() will be changed in a follow-up commit. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9614ad3 commit 7367d88

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

archive.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ struct directory {
107107
struct object_id oid;
108108
int baselen, len;
109109
unsigned mode;
110-
int stage;
111110
char path[FLEX_ARRAY];
112111
};
113112

@@ -138,7 +137,7 @@ static int check_attr_export_subst(const struct attr_check *check)
138137
}
139138

140139
static int write_archive_entry(const struct object_id *oid, const char *base,
141-
int baselen, const char *filename, unsigned mode, int stage,
140+
int baselen, const char *filename, unsigned mode,
142141
void *context)
143142
{
144143
static struct strbuf path = STRBUF_INIT;
@@ -197,15 +196,14 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
197196

198197
static void queue_directory(const unsigned char *sha1,
199198
struct strbuf *base, const char *filename,
200-
unsigned mode, int stage, struct archiver_context *c)
199+
unsigned mode, struct archiver_context *c)
201200
{
202201
struct directory *d;
203202
size_t len = st_add4(base->len, 1, strlen(filename), 1);
204203
d = xmalloc(st_add(sizeof(*d), len));
205204
d->up = c->bottom;
206205
d->baselen = base->len;
207206
d->mode = mode;
208-
d->stage = stage;
209207
c->bottom = d;
210208
d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename);
211209
hashcpy(d->oid.hash, sha1);
@@ -224,7 +222,7 @@ static int write_directory(struct archiver_context *c)
224222
write_directory(c) ||
225223
write_archive_entry(&d->oid, d->path, d->baselen,
226224
d->path + d->baselen, d->mode,
227-
d->stage, c) != READ_TREE_RECURSIVE;
225+
c) != READ_TREE_RECURSIVE;
228226
free(d);
229227
return ret ? -1 : 0;
230228
}
@@ -256,14 +254,14 @@ static int queue_or_write_archive_entry(const struct object_id *oid,
256254
if (check_attr_export_ignore(check))
257255
return 0;
258256
queue_directory(oid->hash, base, filename,
259-
mode, stage, c);
257+
mode, c);
260258
return READ_TREE_RECURSIVE;
261259
}
262260

263261
if (write_directory(c))
264262
return -1;
265263
return write_archive_entry(oid, base->buf, base->len, filename, mode,
266-
stage, context);
264+
context);
267265
}
268266

269267
struct extra_file_info {
@@ -377,8 +375,8 @@ struct path_exists_context {
377375
};
378376

379377
static int reject_entry(const struct object_id *oid, struct strbuf *base,
380-
const char *filename, unsigned mode,
381-
int stage, void *context)
378+
const char *filename, unsigned mode, int stage,
379+
void *context)
382380
{
383381
int ret = -1;
384382
struct path_exists_context *ctx = context;

0 commit comments

Comments
 (0)