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

Deleting files produces empty commits #266

Closed
klieret opened this issue Jul 27, 2022 · 8 comments · Fixed by #273
Closed

Deleting files produces empty commits #266

klieret opened this issue Jul 27, 2022 · 8 comments · Fixed by #273
Labels
bug Something isn't working

Comments

@klieret
Copy link

klieret commented Jul 27, 2022

Describe the bug
Deleting a file produces empty commits instead of deleting them

To Reproduce

Run the following command on a test repository containing a README.md (you can fork mine):

multi-gitter run "rm README.md" -R klieret/multi-gitter-delete-bug-demonstration -m "Remove file"

Expected behavior

I expect a commit that has README.md deleted.

What happens instead

The output looks normal:

INFO[0000] Running on 1 repositories
INFO[0000] Cloning and running script                    repo=klieret/multi-gitter-delete-bug-demonstration
INFO[0000] Pushing changes to remote                     repo=klieret/multi-gitter-delete-bug-demonstration
INFO[0001] Creating pull request                         repo=klieret/multi-gitter-delete-bug-demonstration
Repositories with a successful run:
  klieret/multi-gitter-delete-bug-demonstration #1

But you get a PR with an empty commit. Which is bad because the README.md should be deleted, but also bad because empty commits shouldn't be added by multi-gitter.

@klieret klieret added the bug Something isn't working label Jul 27, 2022
@lindell
Copy link
Owner

lindell commented Jul 27, 2022

Thanks for a concise repo :D This does indeed seems like a bug. I'm unable to repo, or fix right now as I don't have access to a dev computer. But can you try to run with --git-type=cmd and see if it gives the same result?

@klieret
Copy link
Author

klieret commented Jul 27, 2022

Will try later!

I was also wondering whether maybe using git rm instead of plain rm might solve this? (or a manual git add afterwards)

@lindell
Copy link
Owner

lindell commented Jul 27, 2022

Running git commands should not be needed, and could cause strange behavior.

@klieret
Copy link
Author

klieret commented Jul 27, 2022

Indeed git-type=cmd solves this. So it's an issue with go-git?

@lindell
Copy link
Owner

lindell commented Jul 27, 2022

Could be, or more likely how multi-gitter is using it. But one of the two guaranteed ☺️

Can't see anything obvious here:

err = w.AddWithOptions(&git.AddOptions{

But will have to look closer when I have access to a computer:)

@lindell
Copy link
Owner

lindell commented Aug 8, 2022

Seems that this is actually a go-git issue: go-git/go-git#223

There is a linked workaround that I will test later this week to see if it works (or if you want to try it out).

@lindell
Copy link
Owner

lindell commented Aug 11, 2022

Added a fix here: #273 with a test that fails without the fix.

@github-actions
Copy link
Contributor

Included in release v0.42.3 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants