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

Conditional config doesn't apply when initializing or cloning a repository #5144

Open
jennings opened this issue Dec 19, 2024 · 3 comments
Open

Comments

@jennings
Copy link
Contributor

Description

When initializing or cloning a new repository, conditional config is not considered when creating the first empty commit.

Steps to Reproduce the Problem

  1. Add the following conditional config (Windows, but probably not relevant to this issue):
    [user]
    name = "Stephen"
    [[--scope]]
    --when.repositories = ["\\\\?\\C:\\src\\github.com"]
    [--scope.user]
    email = "[email protected]"
  2. Execute: jj git clone [email protected]:jj-vcs/jj C:\src\github.com\jj

Expected Behavior

The working copy commit created by jj should have the email [email protected].

Actual Behavior

The working copy commit has no email address set.

Specifications

  • Platform: Windows
  • Version: jj 0.24.0-f5d450d7c3a8f8a49e30aef0fd18d8295ffc8cb6
@yuja
Copy link
Contributor

yuja commented Dec 19, 2024

It's working as intended (because the repository to load configuration for doesn't exist), but yeah, it's a bit inconvenient. We might need some way to specify configuration for the cwd, not for the repository/workspace directory.

EDIT: or add special case to initialization commands to preload settings for the destination directory.

@jennings
Copy link
Contributor Author

Don't get me wrong, I'm very grateful to have this feature now. I simply ran into this and #5144 when setting it up, so I wanted to write it down before I forgot.

Suppose we had both --when.repositories and --when.cwd. Is there a scenario when you'd want the repositories behavior? If not, I think special case might make the most sense.

@yuja
Copy link
Contributor

yuja commented Dec 19, 2024

Suppose we had both --when.repositories and --when.cwd. Is there a scenario when you'd want the repositories behavior? If not, I think special case might make the most sense.

In most scenarios, --when.repositories (or --when.workspaces) would be preferred. The workspace path can be specified by -R (which doesn't change the cwd.) That said, I agree that special case is probably better. It might look ugly, but initialization code is a bit weird in some way.

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

2 participants