Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit-graph: fix buggy --expire-time option #255

Merged

Commits on Apr 1, 2020

  1. t5319: replace 'touch -m' with 'test-tool chmtime'

    The use of 'touch -m' to modify a file's mtime is slightly less
    portable than using our own 'test-tool chmtime'. The important
    thing is that these pack-files are ordered in a special way to
    ensure the multi-pack-index selects some as the "newer" pack-files
    when resolving duplicate objects.
    
    Reported-by: Jeff King <peff@peff.net>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    24e26ec View commit details
    Browse the repository at this point in the history
  2. 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>
    derrickstolee committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    56a3126 View commit details
    Browse the repository at this point in the history