Skip to content
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

Workspace directory #2495

Merged
merged 10 commits into from
Oct 16, 2023
Merged

Workspace directory #2495

merged 10 commits into from
Oct 16, 2023

Conversation

oliversun9
Copy link
Contributor

Fixes #2480
This fixes the problem where in some occasions dependencies from workspace are not loaded correctly when --path is passed. For example, buf build workspacedir/a --path workspacedir/a/foo.proto when workspacedir/b and workspacedir/c also exist. In module_file_set_builder.go module b and module c would be hashed based on their TargetFileInfos, which are both empty slices due to the --path filter. Same hash means only one of them gets added to the list of potential dependencies.

In this PR, workspace modules are distinguished by their directories relative to the workspace directory. This is accomplished by adding WorkspaceDirectory to interface bufmodule.Module.

@@ -302,48 +304,6 @@ func TestWorkspaceNestedArchive(t *testing.T) {
)
}

func TestWorkspaceGit(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is re-enabled, but moved to workspace_unix_test.go because there seems to be a problem with git clone on the Windows CI, see workflow run. This might fix it. This change doesn't reduce the number of tests because it's already skipped on main.

@@ -1,4 +1,5 @@
version: v1
directories:
- a/proto
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a third module to test for the behavior when there are two potential dependency modules, which is what the bug is about. I verified that this fails on main and passes on this branch.

@oliversun9
Copy link
Contributor Author

Verified that running buf lint ssh://[email protected]/talgendler/buf-remote-dependency-bug.git#branch=main,subdir=service --path service/service/private/v1/private.proto with this branch succeeds.

@oliversun9 oliversun9 merged commit 9db765f into main Oct 16, 2023
7 checks passed
@oliversun9 oliversun9 deleted the workspace-directory branch October 16, 2023 20:07
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.

Calling buf linter or generate on a remote git repository returns a dependency does not exist error
2 participants