commit-graph: fix buggy --expire-time option#255
Merged
derrickstolee merged 2 commits intomicrosoft:vfs-2.26.0from Apr 2, 2020
Merged
commit-graph: fix buggy --expire-time option#255derrickstolee merged 2 commits intomicrosoft:vfs-2.26.0from
derrickstolee merged 2 commits intomicrosoft:vfs-2.26.0from
Conversation
derrickstolee
added a commit
to derrickstolee/scalar
that referenced
this pull request
Apr 1, 2020
See microsoft/git#255. For some reason I got myself confused as to what --expire-time was for. The command-line interface says one thing while the internal implementation does something different. Scalar and VFS for Git were doing what the internal implementation was expecting, but the option parsing was not properly reflecting the data correctly. This means that a lot of users have an excess of commit-graph files in their object directories. This will quickly clean them all up. Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
32c55c0 to
c7b4b07
Compare
This was referenced Apr 1, 2020
kewillford
approved these changes
Apr 1, 2020
Member
kewillford
left a comment
There was a problem hiding this comment.
LGTM one comment on another possible test case.
kewillford
reviewed
Apr 1, 2020
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>
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>
c7b4b07 to
56a3126
Compare
derrickstolee
added a commit
to microsoft/scalar
that referenced
this pull request
Apr 2, 2020
Wow, this was really not working as expected. See microsoft/git#255 for how broken the `--expire-time` argument was. Fix this by using the fixed argument and passing a datetime instead of an offset by seconds. This will provide a longer window for old commit-graph files, but apparently we've been leaving turd files around for a long time without anyone noticing.
derrickstolee
added a commit
to microsoft/VFSForGit
that referenced
this pull request
Apr 2, 2020
Wow, this was really not working as expected. See microsoft/git#255 for how broken the `--expire-time` argument was. Fix this by using the fixed argument and passing a datetime instead of an offset by seconds. This will provide a longer window for old commit-graph files, but apparently we've been leaving turd files around for a long time without anyone noticing.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will need a change in microsoft/scalar and microsoft/vfsforgit to handle the correct input. It has never worked.