Skip to content

Crash when stashing current directory #2651

Open
@MoreDelay

Description

@MoreDelay

Describe the bug
When you start gitui in a newly created directory, and then stash away all changes in that new directory, gitui crashes with this error:

Error: git error:failed to resolve path '.': No such file or directory; class=Os (2); code=NotFound (-3)

Caused by:
    failed to resolve path '.': No such file or directory; class=Os (2); code=NotFound (-3)

To Reproduce
Steps to reproduce the behavior:

  1. In a repository, create a new directory (e.g. mkdir test/) and add new files (e.g. touch test/file.txt)
  2. Go into the new directory (cd test) and start gitui
  3. Go to the stashing tab and put the new file (test/file.txt) to the stash
  4. See error

Expected behavior
The program doesn't crash, or if it does, it shows a nice(r) error message. There are many reasonable behavior possible, such as not relying on the current working directory existing, or falling back to the git root as the current working directory, or refusing to stash away the current working directory. I think anything would be better than the current error message.

Context:

  • OS/Distro + Version: Fedora Linux 42
  • GitUI Version gitui 0.26.3 2025-04-22 ()
  • Rust version: cargo 1.86.0 (adf9b6ad1 2025-02-28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions