Skip to content

Workspace directory#2495

Merged
oliversun9 merged 10 commits intomainfrom
workspace-directory
Oct 16, 2023
Merged

Workspace directory#2495
oliversun9 merged 10 commits intomainfrom
workspace-directory

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.

)
}

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://git@github.com/talgendler/buf-remote-dependency-bug.git#branch=main,subdir=service --path service/service/private/v1/private.proto with this branch succeeds.

@oliversun9 oliversun9 requested a review from bufdev October 16, 2023 18:06
@oliversun9 oliversun9 merged commit 9db765f into main Oct 16, 2023
@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