{"thread":{"id":"17779","subject":"[RFC PATCH v2] Teach rebase to rebase even if upstream is up to date","startedAt":"2009-02-13T22:48:01Z","lastAt":"2009-02-14T19:56:58Z","messageCount":4,"participants":["Sverre Rabbelier","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"104550","messageId":"1234565281-20960-1-git-send-email-srabbelier@gmail.com","threadId":"17779","inReplyTo":null,"subject":"[RFC PATCH v2] Teach rebase to rebase even if upstream is up to date","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-02-13T22:48:01Z","receivedAt":"2009-02-13T22:48:01Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Normally, if the current branch is up to date, the rebase is aborted.\nHowever, it may be desirable to allow rebasing even if the current\nbranch is up to date. When using the '--whitespace=fix' option -f is\nimplied.\n\nSigned-off-by: Sverre Rabbelier <srabbelier@gmail.com>\n---\n\nOnly added the 'case \"$1\" in...' bit since the RFC v1. I'm not sure\nhow to do the test-cases. Should they go into t3400-rebase.sh, and if\nso, any suggesions on how to write these test cases?\n\n git-rebase.sh |   25 ++++++++++++++++++++-----\n 1 files changed, 20 insertions(+), 5 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 6d3eddb..ccfd2b9 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--onto <newbase>] [<upstream>|--root] [<branch>]'\n+USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto <newbase>] [<upstream>|--root] [<branch>]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -48,6 +48,7 @@ prec=4\n verbose=\n git_am_opt=\n rebase_root=\n+force_rebase=\n \n continue_merge () {\n \ttest -n \"$prev_head\" || die \"prev_head must be defined\"\n@@ -294,12 +295,21 @@ do\n \t\t;;\n \t--whitespace=*)\n \t\tgit_am_opt=\"$git_am_opt $1\"\n+\n+    case \"$1\" in\n+    --whitespace=fix|--whitespace=strip)\n+      force_rebase=t\n+      ;;\n+    esac\n \t\t;;\n \t-C*)\n \t\tgit_am_opt=\"$git_am_opt $1\"\n \t\t;;\n \t--root)\n \t\trebase_root=t\n+    ;;\n+  -f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force_rebas|--force-rebase)\n+    force_rebase=t\n \t\t;;\n \t-*)\n \t\tusage\n@@ -419,10 +429,15 @@ if test \"$upstream\" = \"$onto\" && test \"$mb\" = \"$onto\" &&\n \t# linear history?\n \t! (git rev-list --parents \"$onto\"..\"$branch\" | grep \" .* \") > /dev/null\n then\n-\t# Lazily switch to the target branch if needed...\n-\ttest -z \"$switch_to\" || git checkout \"$switch_to\"\n-\techo >&2 \"Current branch $branch_name is up to date.\"\n-\texit 0\n+\tif test -z \"$force_rebase\"\n+\tthen\n+\t\t# Lazily switch to the target branch if needed...\n+\t\ttest -z \"$switch_to\" || git checkout \"$switch_to\"\n+\t\techo >&2 \"Current branch $branch_name is up to date.\"\n+\t\texit 0\n+\telse\n+\t\techo \"Current branch $branch_name is up to date, rebase forced.\"\n+  fi\n fi\n \n if test -n \"$verbose\"\n-- \n1.6.2.rc0.206.g681e7.dirty\n"},{"id":"104593","messageId":"alpine.DEB.1.00.0902140703540.10279@pacific.mpi-cbg.de","threadId":"17779","inReplyTo":"1234565281-20960-1-git-send-email-srabbelier@gmail.com","subject":"Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-14T06:07:04Z","receivedAt":"2009-02-14T06:07:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\n\nOn Fri, 13 Feb 2009, Sverre Rabbelier wrote:\n\n> +    case \"$1\" in\n> +    --whitespace=fix|--whitespace=strip)\n\n\t--whitespace=*?\n\nI know that you can turn it off with --whitespace=nowarn, but that's \nsuch an outlier that we do not have to care about it, right?\n\nOr if we really want to:\n\n\t--whitespace=nowarn) ;;\n\t--whitespace=*) force_rebase=t ;;\n\nHm?\n\nCiao,\nDscho\n"},{"id":"104655","messageId":"bd6139dc0902140957pa5852d6m61211054b3f5e395@mail.gmail.com","threadId":"17779","inReplyTo":"alpine.DEB.1.00.0902140703540.10279@pacific.mpi-cbg.de","subject":"Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-02-14T17:57:28Z","receivedAt":"2009-02-14T17:57:28Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"On Sat, Feb 14, 2009 at 07:07, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> I know that you can turn it off with --whitespace=nowarn, but that's\n> such an outlier that we do not have to care about it, right?\n\nWell, actually, in the v1 thread Junio mentioned that it should not\nimply -f for --whitespace=nowarn.\n\n> Or if we really want to:\n>\n>        --whitespace=nowarn) ;;\n>        --whitespace=*) force_rebase=t ;;\n>\n> Hm?\n\nNo strong opinion on my side, what does the gitster have to say about it?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"104678","messageId":"7vr620ssfp.fsf@gitster.siamese.dyndns.org","threadId":"17779","inReplyTo":"bd6139dc0902140957pa5852d6m61211054b3f5e395@mail.gmail.com","subject":"Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-14T19:56:58Z","receivedAt":"2009-02-14T19:56:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> On Sat, Feb 14, 2009 at 07:07, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n>> I know that you can turn it off with --whitespace=nowarn, but that's\n>> such an outlier that we do not have to care about it, right?\n>\n> Well, actually, in the v1 thread Junio mentioned that it should not\n> imply -f for --whitespace=nowarn.\n>\n>> Or if we really want to:\n>>\n>>        --whitespace=nowarn) ;;\n>>        --whitespace=*) force_rebase=t ;;\n>>\n>> Hm?\n>\n> No strong opinion on my side, what does the gitster have to say about it?\n\n\"Fix\" is obviously a request to \"fix\" things.  On the other hand, at least\nto me, \"warn\" is more about \"*if you were to* rewrite and find issues,\nplease notify me\".  So I prefer what is queued already.\n"}]}