Unsupported new git status change code: [ A]
This occurs fairly frequently, I use direnv and this means I have .envrc files in my directories. However, running gs then gives me the message:
2025/02/13 15:43:23
Failed to decode git status change code for chunk: [ A .envrc]
Please file a bug including this error message as well as the output of:
git status --porcelain
You can file the bug at: https://github.com/mroth/scmpuff/issues/
Output of git status --porcelain:
A .envrc
A devenv.lock
A flake.lock
A flake.nix
?? .devenv.flake.nix
?? .devenv/
?? .direnv/
?? devenv.nix
?? devenv.yaml
Contents of .envrc are "use flake":
❯ hexdump .envrc
0000000 7375 2065 6c66 6b61 0a65
000000a
Interesting, the issue here is not the filename but rather the [ A] git status change code, which used to not exist but was seemingly added to git at some point. (In your porcelain example, it's crashing on the first file it encounters with that status).
From the git status documentation when scmpuff was written:
X Y Meaning
-------------------------------------------------
[MD] not updated
But currently I now see in the git status documentation (https://git-scm.com/docs/git-status#_short_format) that same status is possible with a A in the second field:
X Y Meaning
-------------------------------------------------
[AMD] not updated
It should be relatively straightforward to update the parser to handle this case (though there are a bunch more new cases I see in that documentation too, so longer term #33 is probably the direction I'd like to update this project with), but I'm also curious how you get a git directory into the status where that code shows up, since I haven't encountered it before.
Here is a command log from me creating and having this issue:
$ mkdir scmpuff-test
$ cd scmpuff-test
$ git init
$ git branch -m main
$ nix flake new . -t templates#utils-generic
$ gs
If I can give any more environment issue to help diagnose the source of the new file status, let me know.
Hi @jackbashford, thanks for your patience. scmpuff v0.6.0 is now out which contains a debug command that should be able to help us reproduce and solve this issue. If you upgrade to this version and then run scmpuff debug dump --archive in a repository that has this state, it will generate an archive containing debug files I can use to make a test case with an exact reproduction of the repo state.
Happens for me when I have a git repo with untracked files, and then I initialise a Jujutsu repo on top. This changes the untracked file to a new file not staged for commit.
To repro:
❯ git clone https://github.com/jkoppel/jj-workshop
Cloning into 'jj-workshop'...
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 44 (delta 11), reused 8 (delta 8), pack-reused 26 (from 2)
Receiving objects: 100% (44/44), 15.11 KiB | 429.00 KiB/s, done.
Resolving deltas: 100% (11/11), done.
❯ cd jj-workshop
❯ echo foo > bar
❯ gs
# On branch: main | [*] => $e*
#
➤ Untracked files
#
# untracked: [1] bar
#
❯ jj git init --colocate
Done importing changes from the underlying Git repo.
Setting the revset alias `trunk()` to `main@origin`
Hint: The following remote bookmarks aren't associated with the existing local bookmarks:
main@origin
Hint: Run the following command to keep local bookmarks updated on future pulls:
jj bookmark track main@origin
Initialized repo in "."
Hint: Running `git clean -xdf` will remove `.jj/`!
❯ gs
Error: failed to process git status output: porcelainv1: failed to process status entries: failed to convert entry: unknown git status XY code: [ A]
Please file a bug including this error message as well as the output from:
scmpuff debug dump --archive
You can file the bug at: https://github.com/mroth/scmpuff/issues/%
❯ scmpuff debug dump --archive
--- SCMPUFF DEBUG DUMPTOOL ---
User: compute
Timestamp: 20250808113709
git version: git version 2.50.1
os.Getwd: "/home/compute/jj-workshop"
show-toplevel: "/home/compute/jj-workshop"
show-cdup: ""
$ git status --branch --porcelain=v1
## main...origin/main
A bar
2025/08/08 11:37:09 Created archive compute-jj-workshop-20250808113709.zip
❯ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
new file: bar
Untracked files:
(use "git add <file>..." to include in what will be committed)
compute-jj-workshop-20250808113709.zip
no changes added to commit (use "git add" and/or "git commit -a")
An easy way to get the A flag to show up, that doesn't rely on any other tools/binaries (like nix or jj) is shown in https://github.com/mroth/scmpuff/issues/53
It's basically this:
mkdir scmpuff_test
cd scmpuff_test
git init .
touch file_to_be_added.txt
git add . -N
Now, when running git status --porcelain I see this:
A file_to_be_added.txt
Following up with a git add file_to_be_added.txt the porcelain output changes to
A file_to_be_added.txt
So, difficult to see, but the first output had <space>A, the second one (after git add) doesn't have the initial <space>.