Amend panics when `true` is not available at `/usr/bin/true`
git error: /usr/lib/git-core/git-rebase: 1: eval: /usr/bin/true: not found
Could not execute editor
panic: exit status 1
goroutine 1 [running]:
github.com/ejoffe/spr/spr.check(...)
/Users/eitan/Code/spr/spr/spr.go:426
github.com/ejoffe/spr/spr.(*stackediff).mustgit(...)
/Users/eitan/Code/spr/spr/spr.go:421
github.com/ejoffe/spr/spr.(*stackediff).AmendCommit(0xc0000d3f28, 0x5efa78, 0xc000116000)
/Users/eitan/Code/spr/spr/spr.go:73 +0x6b0
main.main()
/Users/eitan/Code/spr/cmd/amend/main.go:57 +0x32e
It looks like the path to true is hardcoded for /usr/bin/true as per this line:
https://github.com/ejoffe/spr/blob/a9bb60ff8c7ac2fbe03a58d041c1db309fb9be6b/git/realgit/realcmd.go#L38
I have /bin/true which I just copied to /usr/bin/true which fixed this problem but maybe spr should just look for something in the PATH?
I think we can safely replace "/user/bin/true" with just true here. It's probably a good idea to add a check that "true" exists and if not throw a meaningful error.
The point of this is to basically just auto accept whatever text comes into the $EDITOR that git pulls up, is that right? I wonder if there's a way to basically set an auto accept without having to open an editor?
Yes, that's correct, and to give some more color. This handles a special init case where there are some commits in the branch already and git spr is run for the very first time. When spr runs the first time, it installs the commit-msg hook which appends a commit-id to each commit for tracking purposes. If spr runs and detects that there are some commits without a commit-id it uses this mechanism of auto accept rebase to rewrite the commits in order for the hook to append the commit-id to them. There might be a better way to achieve this.
If spr runs and detects that there are some commits without a commit-id it uses this mechanism of auto accept rebase to rewrite the commits in order for the hook to append the commit-id to them. There might be a better way to achieve this.
I've seen other similar projects do this by simply having a foo install-hook command which needs to run before creating the commits.
closing as this hasn't occured in a while.