git-notify icon indicating copy to clipboard operation
git-notify copied to clipboard

post-rewrite hook fails if repository does not have remote called `origin`

Open jevakallio opened this issue 3 years ago • 3 comments

Need to come up with a better way to get a rebase commit log than what we do now: https://github.com/jevakallio/git-notify/blob/master/src/git.ts#L28

For the time being as a workaround, you can skip installing the post-rewrite hook altogether -- the use case for this is pretty niche, in most people's workflows they'll end up pulling the commits to a local branch before rebasing on top of their work, so they should see the message anyway.

Please 👍 this issue if you personally experienced it and want it fixed. Contributions also welcome.

jevakallio avatar Feb 28 '21 19:02 jevakallio

Is the issue that origin could have a different name or there is no origin at all because they haven't added a remote?

jordyvandomselaar avatar Mar 06 '21 00:03 jordyvandomselaar

@jordyvandomselaar both. I think the former is more likely since it's rare people work in detached repositories.

I'm not sure how to get the remote from which commits were previously pulled, so for convenience I just assumed origin here.

jevakallio avatar Mar 07 '21 18:03 jevakallio

@jevakallio I thought about it for a bit. Since the name could be anything and some projects can even have multiple "origins", perhaps it's a good idea to add a flag so the user can enter the name?

jordyvandomselaar avatar Mar 10 '21 18:03 jordyvandomselaar