mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
Merge branch 'ds/commit-graph-expiry-fix'
"git commit-graph write --expire-time=<timestamp>" did not use the given timestamp correctly, which has been corrected. * ds/commit-graph-expiry-fix: commit-graph: fix buggy --expire-time option
This commit is contained in:
commit
25b336421f
@ -143,7 +143,7 @@ static int graph_write(int argc, const char **argv)
|
||||
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
|
||||
N_("maximum ratio between two levels of a split commit-graph")),
|
||||
OPT_EXPIRY_DATE(0, "expire-time", &split_opts.expire_time,
|
||||
N_("maximum number of commits in a non-base split commit-graph")),
|
||||
N_("only expire files older than a given date-time")),
|
||||
OPT_END(),
|
||||
};
|
||||
|
||||
|
@ -1707,7 +1707,7 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
|
||||
timestamp_t expire_time = time(NULL);
|
||||
|
||||
if (ctx->split_opts && ctx->split_opts->expire_time)
|
||||
expire_time -= ctx->split_opts->expire_time;
|
||||
expire_time = ctx->split_opts->expire_time;
|
||||
if (!ctx->split) {
|
||||
char *chain_file_name = get_chain_filename(ctx->odb);
|
||||
unlink(chain_file_name);
|
||||
|
@ -210,8 +210,14 @@ test_expect_success 'test merge stragety constants' '
|
||||
git config core.commitGraph true &&
|
||||
test_line_count = 2 $graphdir/commit-graph-chain &&
|
||||
test_commit 15 &&
|
||||
git commit-graph write --reachable --split --size-multiple=10 --expire-time=1980-01-01 &&
|
||||
touch $graphdir/to-delete.graph $graphdir/to-keep.graph &&
|
||||
test-tool chmtime =1546362000 $graphdir/to-delete.graph &&
|
||||
test-tool chmtime =1546362001 $graphdir/to-keep.graph &&
|
||||
git commit-graph write --reachable --split --size-multiple=10 \
|
||||
--expire-time="2019-01-01 12:00 -05:00" &&
|
||||
test_line_count = 1 $graphdir/commit-graph-chain &&
|
||||
test_path_is_missing $graphdir/to-delete.graph &&
|
||||
test_path_is_file $graphdir/to-keep.graph &&
|
||||
ls $graphdir/graph-*.graph >graph-files &&
|
||||
test_line_count = 3 graph-files
|
||||
) &&
|
||||
|
Loading…
Reference in New Issue
Block a user