Right now, you can push a commit introducing a not-yet existing Git submodule commit reference.
However, such commits can be rejected for submodule repositories hosted at git.haskell.org, thus forcing the user to push the submodule first, and only after that push the submodule-affecting commit in ghc.git
This kind of sanity checking ghc.git commits will become more important, if more repositories are converted into Git submodules.
Trac metadata
Trac field
Value
Version
7.6.3
Type
Task
TypeOfFailure
OtherFailure
Priority
normal
Resolution
Unresolved
Component
None
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
thoughtpolice
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
GraphQL error: The resource that you are attempting to access does not exist or you don't have permission to perform this action
Moreover, when adding a new submodule ref to a repository hosted at git.haskell.org another hook script could add a hidden ref or a Git note to the referenced commit, effectively providing a back-ref, and ensuring the commit doesn't become dangling and subsequently garbage collected.
Another idea: to avoid updating submodule refs by accident (which has happened a few times already), the respective commit message ought contain the word "submodule" or maybe "update(s) submodule" as a safe-guard.
I've implemented a server-side hook and enabled it for git-sandbox.git and ghc.git The hacked-up implementation can be found in this gist
Some details:
only commits becoming reachable via non-wip/-branches ("persistent branches") are validated
if a non-merge commit results in a modified gitlink-type, or a merge commit results in a gitlink-type entry which is different from all its ancestors, then
the git commit message body must contain the string submodule
each touched gitlink is
looked up in the .gitmodules file and resolved to the respective git repo hosted git.haskell.org,
the referenced submodule commit must be reachable from a "persistent branch" (i.e. a non-wip/-branch)
This scheme relies on "persistent branches" not being allowed to be deleted or non-fast-fwd updated.
Here's a sample session demonstrating the new server-side validation checks, when trying to update the Win32 package to version 2.3.0.2 (from previously 2.3.0.1);
After having synced up libraries/Win32 to point version 2.3.0.2 of Win32 we have the following change to commit to ghc.git (git add libaries/Win32):
Moreover, when adding a new submodule ref to a repository hosted at git.haskell.org another hook script could add a hidden ref or a Git note to the referenced commit, effectively providing a back-ref, and ensuring the commit doesn't become dangling and subsequently garbage collected.