summaryrefslogtreecommitdiff
path: root/archive.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-03-20 22:37:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-20 23:09:26 (GMT)
commit7367d88261e5df7b1458cc02217f0e302bc2e127 (patch)
treeec1377fff591706015667178481dfb1afa841b70 /archive.c
parent9614ad3ce09937f3124db09cc8c6dd2777a15515 (diff)
downloadgit-7367d88261e5df7b1458cc02217f0e302bc2e127.zip
git-7367d88261e5df7b1458cc02217f0e302bc2e127.tar.gz
git-7367d88261e5df7b1458cc02217f0e302bc2e127.tar.bz2
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 e4fbbfe9ecc (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 ed22b4173bd (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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive.c')
-rw-r--r--archive.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/archive.c b/archive.c
index 5919d9e..4f27133 100644
--- a/archive.c
+++ b/archive.c
@@ -107,7 +107,6 @@ struct directory {
struct object_id oid;
int baselen, len;
unsigned mode;
- int stage;
char path[FLEX_ARRAY];
};
@@ -138,7 +137,7 @@ static int check_attr_export_subst(const struct attr_check *check)
}
static int write_archive_entry(const struct object_id *oid, const char *base,
- int baselen, const char *filename, unsigned mode, int stage,
+ int baselen, const char *filename, unsigned mode,
void *context)
{
static struct strbuf path = STRBUF_INIT;
@@ -197,7 +196,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
static void queue_directory(const unsigned char *sha1,
struct strbuf *base, const char *filename,
- unsigned mode, int stage, struct archiver_context *c)
+ unsigned mode, struct archiver_context *c)
{
struct directory *d;
size_t len = st_add4(base->len, 1, strlen(filename), 1);
@@ -205,7 +204,6 @@ static void queue_directory(const unsigned char *sha1,
d->up = c->bottom;
d->baselen = base->len;
d->mode = mode;
- d->stage = stage;
c->bottom = d;
d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename);
hashcpy(d->oid.hash, sha1);
@@ -224,7 +222,7 @@ static int write_directory(struct archiver_context *c)
write_directory(c) ||
write_archive_entry(&d->oid, d->path, d->baselen,
d->path + d->baselen, d->mode,
- d->stage, c) != READ_TREE_RECURSIVE;
+ c) != READ_TREE_RECURSIVE;
free(d);
return ret ? -1 : 0;
}
@@ -256,14 +254,14 @@ static int queue_or_write_archive_entry(const struct object_id *oid,
if (check_attr_export_ignore(check))
return 0;
queue_directory(oid->hash, base, filename,
- mode, stage, c);
+ mode, c);
return READ_TREE_RECURSIVE;
}
if (write_directory(c))
return -1;
return write_archive_entry(oid, base->buf, base->len, filename, mode,
- stage, context);
+ context);
}
struct extra_file_info {
@@ -377,8 +375,8 @@ struct path_exists_context {
};
static int reject_entry(const struct object_id *oid, struct strbuf *base,
- const char *filename, unsigned mode,
- int stage, void *context)
+ const char *filename, unsigned mode, int stage,
+ void *context)
{
int ret = -1;
struct path_exists_context *ctx = context;