scmpuff
scmpuff copied to clipboard
Unable to parse git status after using `git add . -N`
• git add . -N
2020/08/19 14:08:07
Failed to decode git status change code for chunk: [ A lib/censored_path.ex]
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/
• git status --porcelain
A lib/censored_path.ex
M lib/modified_file.ex
From man git-add
-N, --intent-to-add
Record only the fact that the path will be added later. An entry for the path is
placed in the index with no content. This is useful for, among other things,
showing the unstaged content of such files with git diff and committing them with
git commit -a.
I'm using this flow when I want to add new files using -p
. Without intent-to-add git add -p
won't pick up the new files.
Interesting! Have not come across that change code before. Could you please provide me a step of steps to take in a naked git repository to reproduce the status?
I see from checking the documentation for git status
compared to when this was written there are some new codes documented that might need to be accommodated for now, including the " A"
status in this issue, but also potentially " R"
"DR"
" C"
and "DC"
statuses. (And based on the updated chart, "DM"
may no longer be possible?)
diff --git a/commands/status/process.go b/commands/status/process.go
index cb4163b..1cc0ce3 100644
--- a/commands/status/process.go
+++ b/commands/status/process.go
@@ -280,15 +280,17 @@ Below documentation from git status:
X Y Meaning
-------------------------------------------------
- [MD] not updated
+ [AMD] not updated
M [ MD] updated in index
A [ MD] added to index
- D [ M] deleted from index
+ D deleted from index
R [ MD] renamed in index
C [ MD] copied in index
[MARC] index and work tree matches
[ MARC] M work tree changed since index
[ MARC] D deleted in work tree
+ [ D] R renamed in work tree
+ [ D] C copied in work tree
-------------------------------------------------
D D unmerged, both deleted
A U unmerged, added by us
Hey, yeah not many people now about -N
, but it's very useful for the workflows like the one I've shared above.
Here's the minimal number of steps to reproduce the issue:
mkdir test
cd test
git init .
touch file_to_be_added.txt
git add . -N
I'm not sure how to get the other statuses unfortunately