Repository navigation
Preserve hook arguments and expand GVFS lock exemptions - #2164
Draft
Tyrie Vella (tyrielv) wants to merge 2 commits into
Draft
Tyrie Vella (tyrielv) wants to merge 2 commits into
Tyrie Vella (tyrielv) wants to merge 2 commits into
Conversation
Exempt reflog and audited ref, object, and reader commands. Classify describe, grep, merge-file, and refs modes conservatively. Keep locks for unknown options and modes that can change tracked files, refresh the index, or dispatch arbitrary commands. Add policy tests for both hook phases and adversarial option forms. Add mounted tests for contention, placeholder creation, and index preservation during reflog writes. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Quote forwarded arguments with Windows command-line rules. Spaces and embedded quotes must not create false options or hide metadata. Keep partial exemptions locked when the appended metadata is missing. Add installed-loader round trips and quoted-value contention tests. Pin optional-value behavior with adversarial unit cases. Verify each reflog rewrite beside index and tracked-content preservation. Use safe-output names and the shared PID argument prefix. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
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.
Problem and Context
The command hook still takes the global GVFS lock for several commands that do not change index membership or tracked checkout content.
During that lock, unrelated first opens of projected files can fail with
FileNotFound.This includes
reflog, whose write modes change refs and reflogs rather than the index or tracked files.Other commands need mode-specific checks because some options refresh the index, overwrite an input file, or dispatch an arbitrary program.
Those checks depend on exact argument boundaries.
The native hook loader currently joins arguments without quotes, so a value with spaces can appear as a false mode or option separator.
Changes
reflogmodes, including ref updates and the read-only index traversal forexpire --stale-fix.bundle,format-patch,notes, andreplace. Their output files and configured helpers use the same trust boundary as existing exemptions.commit-tree,merge-tree,mktag,mktree,pack-refs, andupdate-server-infofor object and ref operations.column,diff-pairs,fmt-merge-msg,format-rev,get-tar-commit-id,last-modified,patch-id,pickaxe,show-index,stripspace,url-parse, andvar.describeandgrep. Keep locks for dirty/broken descriptions, pager dispatch, abbreviated options, and unknown options.merge-fileonly with a recognized stdout or object-output mode. Keep locks when an option disables that mode.refssubcommands. Keep locks formigrateand unknown subcommands.These exemptions do not provide snapshot isolation. Ref locks remain in effect, and configured helpers retain the existing command policy's trust assumptions.
Validation
An original-loader negative control splits
ours -pinto two arguments.The new loader preserves the argument and prevents that partial-exemption bypass.