Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse git status after using git add . -N #53

Open
tadast opened this issue Aug 19, 2020 · 2 comments
Open

Unable to parse git status after using git add . -N #53

tadast opened this issue Aug 19, 2020 · 2 comments

Comments

@tadast
Copy link

tadast commented Aug 19, 2020

• 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.

@mroth
Copy link
Owner

mroth commented Aug 19, 2020

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

@tadast
Copy link
Author

tadast commented Aug 19, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants