git-checkout: Support branchless commits #181
Merged
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.
When creating a database from a git repository, bender currently fetches all branches and tags from the remote before checking out the specified reference. However, it is possible that a commit does not belong to a branch or a tag. For instance, GitHub creates PR merge commits and stores their references in
refs/pull
. To checkout such a branchless commit, it must first be fetched explicitly.Therefore, when creating the database, explicitly fetch the specified reference in addition to all branches and tags (those are still needed e.g. for
bender update
).An open corner case is when
Bender.lock
is updated with a branchless commit hash after creating the database, but the manifest is not. This will skip fetching altogether and the database might not contain the desired branchless commit. A possible solution would be to track the modification time ofBender.lock
; seemanifest_mtime
. However, since this is not the intended use of bender and, in a similar form, already possible today, I chose not to address this for now.Context: The pulp-action integrate currently does not work for
pull_request
events, since the run's context (the PR merge commit) is not accessible by the dependent's CI due to the issue addressed by this PR. (see https://github.com/pulp-platform/cva6/actions/runs/10512893871/job/29127223222)