Credentials helper launching in all its variety#496
Merged
Conversation
It's special as it creates its own repository.
Previously this was hard-coded to `radicle`, now it's just an extension scheme along with a statically known string. This means we have to explicitly support new formats which should be fine.
…upport (#450) No leniency because it's hard to decide what to do, allowing connections is probably not it, so better fail with the correct error message.
…450) This wasn't supposed to happen but a requirement to get `serde` support back.
align usage of stdin and stdout to factor it elsewhere.
…for more flexible helper invocation (#450)
avoid using actual credentials helper where none is required
…module. (#450) Also allow to pass arbitrary bytes (more or less) as context by not forcing it all into a string. Values can now be everything, which helps with passing paths or other values.
Conflicts: cargo-smart-release/Cargo.toml experiments/diffing/Cargo.toml experiments/object-access/Cargo.toml experiments/traversal/Cargo.toml git-attributes/Cargo.toml git-config/Cargo.toml git-odb/Cargo.toml git-pack/Cargo.toml git-ref/Cargo.toml git-repository/Cargo.toml git-url/Cargo.toml gitoxide-core/Cargo.toml
…redential-lite` (#450)
Needs integration with Repo configuration, which includes prompt options actually.
…lled with all arguments (#450)
When true, default false, inject the git installation configuration file if present at the cost of one `git config` invocation. Note that we rely on the underlying `git-config` crate to not load duplicate files. We also currently lie about the scope which is actually unclear - have seen 'unknown' or normal scopes like `system`.
#450) This is important as it may contain additional credential helper configuration that we definitely need to find the credentials that git usually finds.
8 tasks
Eliah Kagan (EliahKagan)
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
May 17, 2026
`gix-command` was already using the `command_name` operand to set `$0` inside `-c` invocations, but the value passed was a fixed literal: `--` historically (since GitoxideLabs#496) and most recently `"sh"`. Both have the same shortcoming: they decouple the value the shell uses to identify itself in diagnostic messages from the shell that is actually running. The fixed literal `"sh"` improves over `"--"` only when the shell really is `sh`. When a caller selects a different shell via `Prepare::with_shell_program(...)`, the shell will still announce itself as `sh` in any error output. For example, with bash configured and an invalid command, errors would read `sh: line 1: ...` even though bash is what produced them. Derive the value from the shell program itself instead, using the basename of the path that is passed to `Command::new` for the shell. Concretely: - With the default shell on Unix (`/bin/sh`), `$0` is `sh`. Same as before in practice, but no longer hardcoded. - With the default shell on Windows (`sh.exe` from Git for Windows), `$0` is `sh.exe`, matching what's actually being launched rather than a literal that drops the `.exe`. - With a customized `shell_program`, `$0` reflects the chosen shell (e.g. `bash`, `zsh`), so its diagnostics correctly identify it. The basename avoids the MSYS2 path-translation surprise that the full shell path can trigger on Windows, where Cygwin/MSYS2 programs rewrite absolute Windows paths handed to them via `lpCommandLine`. Filenames without path separators do not trigger that rewrite. The construction-test assertions in `gix-command/tests/command.rs` and `gix-credentials/tests/program/from_custom_definition.rs` are updated to derive the expected `command_name` slot from the same source (a new `SH_BASENAME` `LazyLock` alongside `SH`), so the assertions remain correct on Windows where the basename is `sh.exe` rather than `sh`. The one test that configures a custom shell (`single_and_multiple_arguments_as_part_of_command_with_given_shell`) now expects the basename of its `/somepath/to/bash` argument, i.e. `bash`, which is what the corrected code will produce there. The previously-added `spawn::with_shell::dollar_zero_*` tests, which spawn the shell and read `$0` directly, now pass under this implementation. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Eliah Kagan (EliahKagan)
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
May 17, 2026
`gix-command` already used the `command_name` operand to set `$0` inside `-c` invocations, but the value passed was a fixed literal: `--` historically (since GitoxideLabs#496) and most recently `"sh"`. Both have the same shortcoming: they decouple the value the shell uses to identify itself in diagnostic messages from the shell that is actually running. The fixed literal `"sh"` improves over `"--"` only when the shell really is `sh`. When a caller selects a different shell via `Prepare::with_shell_program(...)`, the shell will still announce itself as `sh` in any error output. For example, with bash configured and an invalid command, errors would read `sh: line 1: ...` even though bash is what produced them. Derive the value from the shell program itself, using the basename of the path that is passed to `Command::new` for the shell. Concretely: - With the default shell on Unix (`/bin/sh`), `$0` is `sh`. Same as before in practice, but no longer hardcoded. - With the default shell on Windows (`sh.exe` from Git for Windows), `$0` is `sh.exe`, matching what's actually being launched rather than a literal that drops the `.exe`. - With a customized `shell_program`, `$0` reflects the chosen shell (e.g. `bash`, `zsh`), so its diagnostics correctly identify it. The basename avoids the MSYS2 path-translation surprise that the full shell path can trigger on Windows, where Cygwin/MSYS2 programs rewrite absolute Windows paths handed to them via `lpCommandLine`. Filenames without path separators do not trigger that rewrite. The tests added in the preceding commit now pass under this implementation, including the construction-test assertions whose `SH_BASENAME`-derived expected value matches `sh.exe` on Windows and the bash-specific assertion whose expected value is `"bash"`. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Eliah Kagan (EliahKagan)
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
May 17, 2026
`gix-command` already used the `command_name` operand to set `$0` inside `-c` invocations, but the value passed was a fixed literal: `--` historically (since GitoxideLabs#496) and most recently `"sh"`. Both have the same shortcoming: they decouple the value the shell uses to identify itself in diagnostic messages from the shell that is actually running. The fixed literal `"sh"` improves over `"--"` only when the shell really is `sh`. When a caller selects a different shell via `Prepare::with_shell_program(...)`, the shell will still announce itself as `sh` in any error output. For example, with bash configured and an invalid command, errors would read `sh: line 1: ...` even though bash is what produced them. Derive the value from the shell program itself, using the basename of the path that is passed to `Command::new` for the shell. Concretely: - With the default shell on Unix (`/bin/sh`), `$0` is `sh`. Same as before in practice, but no longer hardcoded. - With the default shell on Windows (`sh.exe` from Git for Windows), `$0` is `sh.exe`, matching what's actually being launched rather than a literal that drops the `.exe`. - With a customized `shell_program`, `$0` reflects the chosen shell (e.g. `bash`, `zsh`), so its diagnostics correctly identify it. The basename avoids the MSYS2 path-translation surprise that the full shell path can trigger on Windows, where Cygwin/MSYS2 programs rewrite absolute Windows paths handed to them via `lpCommandLine`. Filenames without path separators do not trigger that rewrite. The tests added in the preceding commit now pass under this implementation, including the construction-test assertions whose `SH_BASENAME`-derived expected value matches `sh.exe` on Windows and the bash-specific assertion whose expected value is `"bash"`. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
protocol.*.allowsupport helper functions (instead of programs)no need, only interesting for testing actuallygit-commandto spawn commands 'git-style' and eventually also hooks, somewhat similar torun-command.c.credential.helperconfiguration (via git-sec)git-promptexpectrldriven testgitinvocations.- on MacOS
/usr/bin/gitthe 'system' config is scope 'unknown' and would need to be parsed via-l --show-originand the first line is the path. '--system' is not present. On windows,--systemworks as expected and these count as installation directory.gix remote refsfor non-symbolic remote, like in PR checkoutsgix credentialas equivalent togit credential, just for funNext PR
git-secremove tag fromAccess, make acheckthat only returns onOption, ignoringDeny.Out of scope
branch.<name>.mergesupport, as we don't yet merge anything and fetching still fetches the entire refspec of as configured in the remote.Predecessor