forked from git-for-windows/git
-
Notifications
You must be signed in to change notification settings - Fork 92
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
derrickstolee
merged 2 commits into
microsoft:vfs-2.26.0
from
derrickstolee:commit-graph-expire-fix
Apr 2, 2020
Merged
commit-graph: fix buggy --expire-time option #255
derrickstolee
merged 2 commits into
microsoft:vfs-2.26.0
from
derrickstolee:commit-graph-expire-fix
Apr 2, 2020
Conversation
This file contains 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
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>
derrickstolee
force-pushed
the
commit-graph-expire-fix
branch
from
April 1, 2020 18:18
32c55c0
to
c7b4b07
Compare
This was referenced Apr 1, 2020
kewillford
approved these changes
Apr 1, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
derrickstolee
force-pushed
the
commit-graph-expire-fix
branch
from
April 1, 2020 20:44
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
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.