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

Handle deleted+untracked files #13

Closed
wants to merge 1 commit into from

Conversation

noahp
Copy link

@noahp noahp commented Oct 6, 2021

If a file is deleted, staged, then added back, we crash:

❯ git rm README.md
❯ echo "heyo" >> README.md
❯ ./bin/git-status-tree
Traceback (most recent call last):
        5: from /bin/git-status-tree:6:in `<main>'
        4: from /src/git_status_tree.rb:22:in `to_s'
        3: from /lib/node.rb:118:in `to_tree_s'
        2: from /lib/nodes_collection.rb:170:in `to_tree_s'
        1: from /lib/node.rb:112:in `to_tree_s'
/lib/node.rb:112:in `+': no implicit conversion of Array into String (TypeError)

Add a workaround. My ruby is extremely terrible but this at least
prevents crashing in this case 😬.

❯ ./bin/git-status-tree
.
├── lib
│   └── node.rb (M+)
└── README.md (??)

I don't know how to add test coverage for this 😞.

If a file is deleted, staged, then added back, we crash:

```bash
❯ git rm README.md
❯ echo "heyo" >> README.md
❯ ./bin/git-status-tree
Traceback (most recent call last):
        5: from /bin/git-status-tree:6:in `<main>'
        4: from /src/git_status_tree.rb:22:in `to_s'
        3: from /lib/node.rb:118:in `to_tree_s'
        2: from /lib/nodes_collection.rb:170:in `to_tree_s'
        1: from /lib/node.rb:112:in `to_tree_s'
/lib/node.rb:112:in `+': no implicit conversion of Array into String (TypeError)
```

Add a workaround. My ruby is extremely terrible but this at least
prevents crashing in this case 😬.

```bash
❯ ./bin/git-status-tree
.
├── lib
│   └── node.rb (M+)
└── README.md (??)
```

I don't know how to add test coverage for this 😞.
@knugie
Copy link
Collaborator

knugie commented Oct 6, 2021

Thanks for raising this issue. Which Ruby and git versions did you use? I'll have a closer look tomorrow.

@noahp
Copy link
Author

noahp commented Oct 6, 2021

I was using these versions:

❯ git --version
git version 2.30.2

❯ ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-gnu]

Thanks for taking a look!

@knugie
Copy link
Collaborator

knugie commented Oct 7, 2021

✅ Fixed 21d5119
✅ Released https://github.com/knugie/git-status-tree/releases/tag/v1.0.1
✅ Published https://rubygems.org/gems/git-status-tree/versions/1.0.1

Thank you very much for contributing @noahp

@knugie knugie closed this Oct 7, 2021
@noahp
Copy link
Author

noahp commented Oct 8, 2021

Thank you for fixing it so quickly! love this utility, been using it daily for years, thanks so much for building it 👍 !

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

Successfully merging this pull request may close these issues.

None yet

2 participants