Fixing "ref HEAD is not a symbolic ref" error; logging enhancements #748
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses the following issues:
During its operations, jira-prepare-commit-msg used this command to determine the branch name to work on:
Unfortunately it doesn't work for rebases and just throws the fatal error: "ref HEAD is not a symbolic ref"
Note that we barely want to rewrite a bunch of previous commits when rebase, don't we? So ideally we should skip running the hook, but we can't. There is no way to figure out from our
.husky/prepare-commit-msg
script if it's a rebase or a regular commit.One solution is to use another command to detect branch name:
because it doesn't crash and seems to be returning the same "HEAD" string for rebase commits.
So we can detect that and silently exit not trying to interfere in the middle of a rebase.
Now about logging.
We don't really need to see all those "start" and "done" messages. The only thing we might want to see is the new rewritten commit message. And that one was not displayed. Fixed it.
Example
Was:
Became: