martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
8.25k stars 277 forks source link

JJ seems to ignore configuration on MacOS #4406

Open fride opened 1 week ago

fride commented 1 week ago

Description

Apparently JJ seems to ignore my user configuration on my machine. When I checkout a project (like eg this one) it warns me about missing user name and email, even though both are configured in ~/Library/Application Support/<username>/jj/config.toml

Steps to Reproduce the Problem

  1. configure user name and email
  2. Clone a git repository: jj git clone https://github.com/martinvonz/jj.git
  3. There are warning about missing configurations

Expected Behavior

There should be no warnings.

Actual Behavior

JJ claims that neither user name nor email are set.

Fetching into new repo in "/private/tmp/jj"
..
Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
  jj config set --user user.name "Some One"
  jj config set --user user.email "someone@example.com"
...

Specifications

martinvonz commented 1 week ago

What does jj config path --user say? Maybe jj thinks the config is in a different file than ~/Library/Application Support/<username>/jj/config.toml.

fride commented 1 week ago

It says the expected

jj config path --user
/Users/<me>/Library/Application Support/jj/config.toml

The strange thing is that the config is there but apparently not used for a git repos. Is there a setting where it looks for the git config?

> jj config list
ui.editor = "nvim"
ui.pager = "less -R"
user.emal = "jan@friderici.net"
user.name = "Jan Friderici"
revset-aliases."trunk()" = "main@origin"
martinvonz commented 1 week ago

And jj config list --user user lists your configured values? Here's my outout for reference:

$ jj config list --user user
user.email = "martinvonz@google.com"
user.name = "Martin von Zweigbergk"
fride commented 1 week ago

Yes, everything is there. Maybe the git configuration is in a place that jj dislikes?

martinvonz commented 1 week ago

We read very little from the git configuration, and we don't read the user name and email, for example.

Oh, I think I spotted your problem! You have a typo in user.emal (should be user.email, of course).

fride commented 1 week ago

OMG! No. Thanks a lot. 🙈

fride commented 1 week ago

Typo on my side. Sorry for the inconvenience.

martinvonz commented 1 week ago

We could make the error message more specific and say which of the two (name or email) are missing. Maybe that would have helped you spot the problem more quickly.

fride commented 1 week ago

As my scatterbrain produced it I could try this as my first PR. Do you think that would be 1) easy and 2) a useful addition?

martinvonz commented 1 week ago

Yes, should be very easy. A more specific message seems like it would have been useful to at least you :) I'm not sure exactly how specific we should make it in the three different scenarios. I'll let you figure that out.