From 1f2b3613717e5c93bd76cea20450b88ddb71c466 Mon Sep 17 00:00:00 2001 From: Christoph Koehler Date: Wed, 17 Apr 2024 20:42:09 -0600 Subject: [PATCH] config: add XDG_CONFIG_HOME config location for MacOS --- CHANGELOG.md | 3 +++ docs/config.md | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a673d3dc..f010699ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * You can check whether Watchman fsmonitor is enabled or installed with the new `jj debug watchman status` command. +* On MacOS, jj will now look for its config in `$XDG_CONFIG_HOME` in addition + to `~/Library/Application Support/jj/` + ### Fixed bugs * Revsets now support `\`-escapes in string literal. diff --git a/docs/config.md b/docs/config.md index 7b9597b499..d355443807 100644 --- a/docs/config.md +++ b/docs/config.md @@ -734,7 +734,7 @@ using `jj debug watchman status`. ### User config file -An easy way to find the user config file is: +An easy way to find the user config file (if one exists) is: ```bash jj config path --user @@ -742,17 +742,18 @@ jj config path --user The rest of this section covers the details of where this file can be located. -On all platforms, the user's global `jj` configuration file is located at either -`~/.jjconfig.toml` (where `~` represents `$HOME` on Unix-likes, or -`%USERPROFILE%` on Windows) or in a platform-specific directory. The -platform-specific location is recommended for better integration with platform -services. It is an error for both of these files to exist. - -| Platform | Value | Example | -| :------- | :------------------------------------------------- | :-------------------------------------------------------- | -| Linux | `$XDG_CONFIG_HOME/jj/config.toml` | `/home/alice/.config/jj/config.toml` | -| macOS | `$HOME/Library/Application Support/jj/config.toml` | `/Users/Alice/Library/Application Support/jj/config.toml` | -| Windows | `{FOLDERID_RoamingAppData}\jj\config.toml` | `C:\Users\Alice\AppData\Roaming\jj\config.toml` | +On all platforms, the user's global `jj` configuration file is located at +either `~/.jjconfig.toml` (where `~` represents `$HOME` on Unix-likes, or +`%USERPROFILE%` on Windows), in a platform-specific directory, or +`$XDG_CONFIG_HOME` (if different from the platform-specific directory, like on +MacOS). The platform-specific location is recommended for better integration +with platform services. It is an error for more than one of these files to exist. + +| Platform | Value | Example | +| :------- | ---------------------------------------- | --------------------------------------------- | +| Linux | `$XDG_CONFIG_HOME/jj/config.toml` | `/home/alice/.config/jj/config.toml` | +| macOS | `~/Library/Application Support/jj/config.toml` or `$XDG_CONFIG_HOME/jj/config.toml` | `/Users/alice/Library/Application Support/jj/config.toml` or `/Users/Alice/.config/jj/config.toml` | +| Windows | `{FOLDERID_RoamingAppData}\jj\config.toml` | `C:\Users\Alice\AppData\Roaming\jj\config.toml` | The location of the `jj` config file can also be overridden with the `JJ_CONFIG` environment variable. If it is not empty, it should contain the path