diff options
author | Tim Labath <tim.labath@gmail.com> | 2012-03-18 09:34:28 +0000 |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2012-03-18 09:34:28 +0000 |
commit | df6acf69d961f52faed943a571018b0ad13c3231 (patch) | |
tree | 2dfb4b62e84c7152244a2daf22986a202f9bc7e4 | |
parent | 1de3048d08fc6491630c45437f88f5ab03c0508f (diff) | |
download | cgit-df6acf69d961f52faed943a571018b0ad13c3231.tar.gz |
ui-snapshot.c: setup archiving to support export-subst attributes
-rw-r--r-- | ui-snapshot.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 07cc944..3e75289 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -70,6 +70,9 @@ static int make_snapshot(const struct cgit_snapshot_format *format, const char *filename) { struct archiver_args args; + const unsigned char *commit_sha1; + time_t archive_time; + struct tree *tree; struct commit *commit; unsigned char sha1[20]; @@ -82,6 +85,14 @@ static int make_snapshot(const struct cgit_snapshot_format *format, cgit_print_error(fmt("Not a commit reference: %s", hex)); return 1; } + + commit_sha1 = commit->object.sha1; + archive_time = commit->date; + + tree = parse_tree_indirect(sha1); + if (tree == NULL) + cgit_print_error(fmt("Not a tree object: %s", sha1)); + memset(&args, 0, sizeof(args)); if (prefix) { args.base = fmt("%s/", prefix); @@ -90,8 +101,10 @@ static int make_snapshot(const struct cgit_snapshot_format *format, args.base = ""; args.baselen = 0; } - args.tree = commit->tree; - args.time = commit->date; + args.tree = tree; + args.commit_sha1 = commit_sha1; + args.commit = commit; + args.time = archive_time; args.compression_level = Z_DEFAULT_COMPRESSION; ctx.page.mimetype = xstrdup(format->mimetype); ctx.page.filename = xstrdup(filename); |