You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some gitignored local configuration I maintain locally in the same directory as a git repo. Running go-apidiff irrecoverably deletes all of those files because of the git clean it does here:
This behavior is destructive and essentially impossible to know about until it's too late. This behavior should be documented and put behind a descriptive flag like --force-clean.
The text was updated successfully, but these errors were encountered:
It took quite a bit of trial and error to make go-apidiff robustly handle various scenarios with what it might encounter in a git tree. The main guard that I thought protected against destructive actions is this IsClean() check:
returnnil, &GitStatusError{stat, fmt.Errorf("current git tree is dirty")}
}
It's been quite a long time since I wrote most of this code, and I unfortunately don't even remember why wt.Clean() is called there.
There are definitely some oddities I've encountered with go-git, where it behaves a little bit different to the git CLI, so that might partly explain it.
I don't have a lot of time to work on this project, but I'd definitely be willing to accept a PR that either:
handles this scenario in a non-destructive way
adds additional checks for potential destructive actions and just fails out
I have some
gitignore
d local configuration I maintain locally in the same directory as a git repo. Runninggo-apidiff
irrecoverably deletes all of those files because of thegit clean
it does here:go-apidiff/pkg/diff/run.go
Lines 199 to 201 in 00f8d2e
This behavior is destructive and essentially impossible to know about until it's too late. This behavior should be documented and put behind a descriptive flag like
--force-clean
.The text was updated successfully, but these errors were encountered: