Skip to contentSkip to conversation

git rebase silently ignores nonexistent -X (--strategy-option) but git merge does not

PATCH [email protected] 1 participant 1 message Aug 8

lore
Share & tools
lore
#0 lore raw

Hello,

When provide nonexistent <option> to -X when doing rebase it silently ignores it. Same scenario when executing merge results in error. Such situation can lead to false positive for end user who will be confident that whole operation succeeded.

Fedora Linux 44, 7.1.7-200.fc44.x86_64

$ git --version
git version 2.55.0

Example scenario:

$ git clone https://github.com/schacon/simplegit-progit.git
Cloning into 'simplegit-progit'...
remote: Enumerating objects: 13, done.
remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13 (from 1)
Receiving objects: 100% (13/13), done.
Resolving deltas: 100% (3/3), done.
$ cd simplegit-progit
$ git branch -c iss1
$ git checkout iss1
$ vi Rakefile
$ git diff
Rakefile +2 -2
index 8f94139..8080252 100644
@@ -5,8 +5,8 @@ require 'rake/gempackagetask'
 spec = Gem::Specification.new do |s|
     s.platform  =   Gem::Platform::RUBY
     s.name      =   "simplegit"
-    s.version   =   "0.1.1"
-    s.author    =   "Scott Chacon"
+    s.version   =   "0.1.1"■■■■■
+    s.author    =   "Scott Chacon Big"
     s.email     =   "[email protected]"
     s.summary   =   "A simple gem for using Git in Ruby code."
     s.files     =   FileList['lib/**/*'].to_a

--------------
// ■ - space character
--------------

$ git commit -am 'iss1: author name change'
[iss1 fa40d71] iss1: author name change
 1 file changed, 2 insertions(+), 2 deletions(-)
$ git checkout master
Switched to branch 'master'
$ vi Rakefile
$ git diff
Rakefile +1 -1
index 8f94139..e458853 100644
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
 spec = Gem::Specification.new do |s|
     s.platform  =   Gem::Platform::RUBY
     s.name      =   "simplegit"
-    s.version   =   "0.1.1"
+    s.version   =   "0.1.2"
     s.author    =   "Scott Chacon"
     s.email     =   "[email protected]"
     s.summary   =   "A simple gem for using Git in Ruby code."
$ git commit -am 'master: version update'
[master f2b3ef3] master: version update
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git checkout iss1
Switched to branch 'iss1'
$ git rebase master
Auto-merging Rakefile
CONFLICT (content): Merge conflict in Rakefile
error: could not apply fa40d71... iss1: author name change
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm &lt;conflicted_files>", then run "git
rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run
"git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict
false"
Could not apply fa40d71... # iss1: author name change
$ git rebase --abort
$ git rebase -X sillyoption master
Auto-merging Rakefile
CONFLICT (content): Merge conflict in Rakefile
error: could not apply fa40d71... iss1: author name change
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm &lt;conflicted_files>", then run "git
rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run
"git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict
false"
Could not apply fa40d71... # iss1: author name change