diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2020-04-01 21:00:44 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-01 14:36:26 -0700 |
commit | b09b785c785c93d9e26f4fc754116c24ea02bf3c (patch) | |
tree | 5a234c51abe9f4aeb3adb94c0d5549c1780169a3 /builtin/commit-graph.c | |
parent | commit-graph: test verify across alternates (diff) | |
download | tgif-b09b785c785c93d9e26f4fc754116c24ea02bf3c.tar.xz |
commit-graph: fix buggy --expire-time option
The commit-graph builtin has an --expire-time option that takes a
datetime using OPT_EXPIRY_DATE(). However, the implementation inside
expire_commit_graphs() was treating a non-zero value as a number of
seconds to subtract from "now".
Update t5323-split-commit-graph.sh to demonstrate the correct value
of the --expire-time option by actually creating a crud .graph file
with mtime earlier than the expire time. Instead of using a super-
early time (1980) we use an explicit, and recent, time. Using
test-tool chmtime to create two files on either end of an exact
second, we create a test that catches this failure no matter the
current time. Using a fixed date is more portable than trying to
format a relative date string into the --expiry-date input.
I noticed this when inspecting some Scalar repos that had an excess
number of commit-graph files. In Scalar, we were using this second
interpretation by using "--expire-time=3600" to mean "delete graphs
older than one hour ago" to avoid deleting a commit-graph that a
foreground process may be trying to load.
Also I noticed that the help text was copied from the --max-commits
option. Fix that help text.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-graph.c')
-rw-r--r-- | builtin/commit-graph.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 38027b83d9..7339f87c2d 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -175,7 +175,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(), }; |