github GitoxideLabs/gitoxide gix-command-v0.9.1
gix-command v0.9.1

7 hours ago

Bug Fixes

  • Derive $0 for sh -c from the shell's basename
    gix-command invokes shells as sh -c <script> <command_name> [args...],
    where the command_name operand becomes $0 inside the shell. Shells
    use $0 to prefix their own diagnostic messages (e.g.
    sh: line 1: <cmd>: command not found), so the value should identify
    the actually-running shell.

    Derive the value from the shell program itself, using the basename of
    the path passed to Command::new for the shell:

    • With the default shell on Unix (/bin/sh), $0 is sh.
    • With the default shell on Windows (sh.exe from Git for Windows),
      $0 is sh.exe, matching the launched binary's actual name.
    • With a customized shell_program, $0 reflects the chosen shell
      (e.g. bash, zsh), so its diagnostics correctly identify it.

    If the shell path has no extractable basename — Path::file_name()
    returns None for degenerate input like an empty string or / — fall
    back to _, the conventional placeholder for an unused $0 used in
    shell one-liners. This keeps the construction total without claiming a
    specific shell name.

    Using the basename also avoids an MSYS2-specific surprise on Windows:
    Cygwin/MSYS2 shells translate some command-line content received via
    lpCommandLine, including full Windows paths, so a full shell path
    passed as $0 would come back from the shell as its translated form.

    This fixes #1842. (See #1840 and #1842 regarding some of these issues.)

Commit Statistics

  • 12 commits contributed to the release over the course of 28 calendar days.
  • 28 days passed between releases.
  • 1 commit was understood as conventional.
  • 0 issues like '(#ID)' were seen in commit messages

Commit Details

view details
  • Uncategorized
    • Merge pull request #2607 from SarthakB11/fix/issue-1842 (faecc23)
    • Derive $0 for sh -c from the shell's basename (8323858)
    • Add tests for $0 deriving from the actually-running shell (d62e33c)
    • Pass sh (not --) as $0 to sh -c (6752a96)
    • Merge pull request #2575 from SarthakB11/fix/issue-2316 (4743361)
    • Review (1980190)
    • Document why each fixture archive is .gitignored (e3d5a04)
    • Merge pull request #2568 from GitoxideLabs/dependabot/cargo/cargo-56d6b174d8 (ab2fee1)
    • Update crates to Rust 2024 edition (2cb17b2)
    • Remove rust_2018_idioms lint declarations (e10d5f6)
    • Raise MSRV for hash dependency updates (3675a8d)
    • Merge pull request #2546 from GitoxideLabs/fix-2545 (adb8328)

Don't miss a new gitoxide release

NewReleases is sending notifications on new releases.