Skip to content

stg refresh crashes when a file has "copied" status #615

@matyasselmeci

Description

@matyasselmeci

When detects a file is a copy, it can end up having the "copied" status in the repo - this causes stg refresh to crash with the message not expecting 'C' copied status with porcelain v2. Backtrace:

thread 'main' panicked at src/stupid/status.rs:138:21:
not expecting 'C' copied status with porcelain v2
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14
   2: stg::stupid::status::Status::from_char
   3: stg::cmd::refresh::assemble_refresh_tree
   4: stg::cmd::refresh::run
   5: stg::execute_command
   6: stg::main

This is how I can reproduce it:

mkdir testrepo && cd testrepo
echo hi > hi
git init; git add hi; git commit -m initial
stg init; stg new mypatch -m mypatch
cp hi hi2
git add -N hi2
echo bye >> hi

git status --short now shows

 M hi
 C hi -> hi2

and running stg refresh results in the above crash.

Versions:

Stacked Git 2.5.4
git version 2.46.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions