-
-
Notifications
You must be signed in to change notification settings - Fork 550
fix(gix-config-value): expand ~user with no path after it #2986
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,17 @@ mod interpolate { | |
| Ok(()) | ||
| } | ||
|
|
||
| #[cfg(not(any(target_os = "windows", target_os = "android")))] | ||
| #[test] | ||
| fn tilde_with_given_user_and_no_path() -> crate::Result { | ||
| // `git -c foo.bar='~root' config --type=path foo.bar` prints that user's home | ||
| // directory on git 2.50.1: everything past the `~` is the user name when there | ||
| // is no `/`, and no trailing slash is needed. | ||
| let home = std::env::current_dir()?; | ||
| assert_eq!(interpolate_without_context("~user")?, home.join("user")); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new AGENTS.md reference: AGENTS.md:L118-L121 Useful? React with 👍 / 👎. |
||
| Ok(()) | ||
| } | ||
|
|
||
| fn interpolate_without_context( | ||
| path: impl AsRef<str>, | ||
| ) -> Result<PathBuf, gix_config_value::path::interpolate::Error> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~userformWhen callers rely on this public API's rustdoc, they are still told that only
~user/triggers named-user interpolation and that other nonempty values remain unchanged;Context::home_for_userlikewise documents only~name/. With this condition, bare~userinstead invokes the callback and can returnMissing, so update both public descriptions to include the slashless form.AGENTS.md reference: AGENTS.md:L147-L152
Useful? React with 👍 / 👎.