Closed sandr01d closed 2 years ago
git revert "$commits"
would not work for multiple commits because git will fail to recognize that we want to revert separate commits e.g. '3f649be' and 'b344261' instead of one commit '3f649be b344261' (containing a space). git revert $(echo "$commits")
would work though. I think this is better than using eval
, as this makes the intent clearer IMO. Should I update the PR accordingly?
git revert $(echo "$commits")
would work though. I think this is better than usingeval
, as this makes the intent clearer IMO.
I think the same as you.
So, shellcheck failed on the solution we've discussed and I took the opportunity for a bit of refactoring. The commit hashes are now passed into an array and I revert each commit one by one. This also solves git logging an error and aborting when a commit is selected that already has been reverted.
Check list
Description
Before this commit, the regex for extracting the commit hash when using
grc
assumed that each line starts with '* '. This is not the case when your commit history contains merges that were not squashed and looks more like thisIn the example above, selecting the line
| * c753f1c (test-branch) Test commit 5 4 days ago
would fail to revert the commit. This is now fixed. Note: The fish implementation does not seem to have this issue.Type of change
Test environment