Skip to content

feat: add historic git-backed filesystem#217

Open
dmcilvaney wants to merge 4 commits into
microsoft:mainfrom
dmcilvaney:damcilva/gitfs
Open

feat: add historic git-backed filesystem#217
dmcilvaney wants to merge 4 commits into
microsoft:mainfrom
dmcilvaney:damcilva/gitfs

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

When creating synthetic dist-gits, there are certain packages that use overlays which mutate the calculated release value for a package. If the overlays are only applied to the last commit in the dist-git, then if a package changes the 'version' of a package the autorelease tool will see the version change ONLY on that last commit, and conclude the release should be reset back to '1'. If we then add another commit to the dist-git, the version should be '2', but the autorelease tool will still see the version bump happen only on the last commit, and again reset the release to '1'. (see kernel-headers for an example)

To avoid this, we must apply the overlays to all commits in the dist-git, as they would have appeared at the time of the commit. azldev already abstracts filesystem access through 'fs', so we can implement a 'gitfs' that loads toml configs from the project's git history. A copy-on-write in-memory filesystem allows for writing if necessary.

When creating synthetic dist-gits, there are certain packages that use
overlays which mutate the calculated release value for a package. If the
overlays are only applied to the last commit in the dist-git, then if a
package changes the 'version' of a package the autorelease tool will see
the version change ONLY on that last commit, and conclude the release
should be reset back to '1'. If we then add another commit to the
dist-git, the version should be '2', but the autorelease tool will
still see the version bump happen only on the last commit, and again
reset the release to '1'. (see kernel-headers for an example)

To avoid this, we must apply the overlays to all commits in the dist-git,
as they would have appeared at the time of the commit. azldev already
abstracts filesystem access through 'fs', so we can implement a 'gitfs'
that loads toml configs from the project's git history. A copy-on-write
in-memory filesystem allows for writing if necessary.
Copilot AI review requested due to automatic review settings June 1, 2026 21:56
@dmcilvaney
Copy link
Copy Markdown
Contributor Author

Requires #216 for tests to pass

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds infrastructure to load project configuration from a repository’s historical git state, enabling “replay” of overlays across all commits when generating synthetic dist-gits.

Changes:

  • Introduces internal/utils/gitfs — a read-only afero.Fs backed by a git tree at a specific commit, compatible with existing glob/include behavior.
  • Adds historic project-config entry points (LoadProjectConfigAtCommit, ResolveComponentOverlaysAtCommit) that read config from git history using gitfs plus a writable in-memory overlay.
  • Extends fileperms with read-only permission constants used by the synthetic/historic filesystem view.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/utils/gitfs/gitfs.go Implements the git-backed read-only afero.Fs used to read files at a specific commit.
internal/utils/gitfs/gitfs_test.go Validates reading, stat, readdir, doublestar globbing, and read-only behavior for gitfs.
internal/utils/fileperms/fileperms.go Adds ReadOnlyFile / ReadOnlyExec modes for immutable filesystem views.
internal/projectconfig/historic.go Adds APIs to load and resolve project config/overlays at a specific commit using gitfs.
internal/projectconfig/historic_test.go Tests historic config loading and overlay resolution across commits and permissive parsing behavior.

Comment thread internal/projectconfig/historic.go
Comment thread internal/projectconfig/historic.go
Comment thread internal/projectconfig/historic.go Outdated
Comment thread internal/utils/gitfs/gitfs.go
Comment thread internal/utils/gitfs/gitfs.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants