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

workspaces: allow filtering out files from workspace root #1287

Open
flokli opened this issue Oct 24, 2023 · 8 comments
Open

workspaces: allow filtering out files from workspace root #1287

flokli opened this issue Oct 24, 2023 · 8 comments

Comments

@flokli
Copy link
Contributor

flokli commented Oct 24, 2023

I want to move tvix from a separate views/tvix/workspace.josh file to a workspace.json file shipped inside the directory, mostly to remove filter ambiguity as described in #1155 (comment), as well as aligning more with how josh seems to be used elsewhere.

However, I need to exclude some files from the tvix directory the workspace.josh would then be in. Specifically, most default.nix files in there should be excluded (see here).

It seems it's not possible to customize the implicit :/<workspace root> filter, so that certain files are excluded, at least not while just using workspace=tvix as the only filter parameter (during clones).

@LMG
Copy link
Collaborator

LMG commented Oct 24, 2023

Would something like ,,:exclude[::path/to/workspace/path/to/file]:workspace=path/to/workspace do what you want?

@LMG
Copy link
Collaborator

LMG commented Oct 24, 2023

Or do you want to still be able to clone with only the :workspace filter?

@flokli
Copy link
Contributor Author

flokli commented Oct 24, 2023

I think it would, but the URL would become quite messy. We want to exclude default.nix and **/default.nix (except these inside tvix_tests) from the workspace.

I don't want to push the burden of specifying these filters to people cloning it, this should be possible to specify from workspace.josh itself.

@flokli flokli changed the title workspaces: allow filtering out files workspaces: allow filtering out files from workspace root Oct 24, 2023
@LMG
Copy link
Collaborator

LMG commented Oct 24, 2023

And an exclude filter inside the workspace.josh doesn't work, even making sure to target the files as if the workspace folder was the root?
(That might well be, especially since the change to how we compose this implicit filter with the workspace one, I don't have my computer to check right now.)

@LMG
Copy link
Collaborator

LMG commented Oct 24, 2023

Another option right now could be to add this filter as an implicit prefix to all clones. There is a CLI option for this. That would mean you can never get those files through josh tho.

Be aware this prefix only applies to git clones, not to graphql queries.

@flokli
Copy link
Contributor Author

flokli commented Oct 24, 2023

Filtering default.nix globally via all josh-proxy queries wouldn't work either way, it's only for specific workspaces.

No need to rush, let's check this peacefully once you have a bigger computer again ;-)

@christian-schilling
Copy link
Member

Currently there is no way to do this unfortunatly. It is good to know though that you are having this use case as we are investigating a new feature for workspaces anyway that will allow "pre-selecting" files from the tree before applying general filters. So knowing about this we can make sure your case is covered.

@flokli
Copy link
Contributor Author

flokli commented Nov 6, 2023

The other way around we have it currently also causes problems - people checking out a workspace, and then pushing back their commits now always include a change to a workspace.josh file - see https://cl.tvl.fyi/c/depot/+/9985.

This was a plain commit adding a foo.txt into the workspace checkout:

commit f07638db7ba5b7082a9d4c7ba15b67ec9889530b (HEAD -> canon)
Author: Florian Klink <flokli@flokli.de>
Date:   Mon Nov 6 13:56:06 2023 +0200

    test - please ignore.
    
    Change-Id: I28568b95b9c2f72e977a7d048423bb4730c1733f

diff --git a/foo.txt b/foo.txt
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/foo.txt
@@ -0,0 +1 @@
+test

(using https://code.tvl.fyi/depot.git:workspace=views/tvix.git at 9b90ccb7089b1e21763126336125cbd354c20f00).

On the other side (in Gerrit), this showed up as a commit also editing views/tvix/workspace.josh to an earlier version of it - even though the change changing the file is already part of 9b90ccb7089b1e21763126336125cbd354c20f00.

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

No branches or pull requests

3 participants