From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>,
Johannes Sixt <j.sixt@viscovery.net>,
git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Christian Couder <chriscool@tuxfamily.org>,
Thomas Rast <trast@student.ethz.ch>
Subject: Re: [PATCH] rebase: define options in OPTIONS_SPEC
Date: Mon, 28 Feb 2011 20:59:26 -0500 (EST) [thread overview]
Message-ID: <alpine.DEB.2.00.1102272055320.5025@debian> (raw)
In-Reply-To: <7v7hcl4uan.fsf@alter.siamese.dyndns.org>
On Sun, 27 Feb 2011, Junio C Hamano wrote:
> Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
>
> > What is the difference between the "options" and "actions" sections?
>
> For historical reasons, "git rebase" does not take subcommands in the way
> many other commands do (e.g. "git bisect start", "git rerere remaining",
> "git stash save"). Some --option to the command are used for specifying
> the subcommand. "git rebase --continue", if it were designed to be
> consistent with the other commands, would have been "git rebase continue"
> instead. "Actions" part lists them.
>
> This is somewhat unfortunate, but is understandable given that "rebase"
> didn't have its own options at all, and there was only one mode of
> operation, namely, to start the rebase process. It allowed the user to be
> terse, i.e. instead off having to say "git rebase onto master", it was
> sufficient to say "git rebase master".
>
> When "git rebase --continue" was introduced (before, you were supposed to
> say "git am --resolved", which was nonsense from the UI point of view),
> somebody should have noticed this as a problem and started a process to
> deprecate the "git rebase <branchname>" and to require explicit subcommand
> names, just like we did to "git stash [save]", but that didn't happen.
>
> Perhaps this is something to consider at 2.0 boundary.
>
Thanks for the explanation. It sounds like I should leave only
--continue, --skip and --abort in the "Actions" section.
I just noticed another problem with my patch. I had assumed that
specifying 'n,no-stat ...' on one line would give me a '-n' argument
to handle if e.g. '-n', '--no-stat' or '--no-sta' was passed. To my
surprise, when passing '--no-stat' on the command line, parse-options
gives me the long form back. If I pass '--no-sta', I get the curious
error: Ambiguous option: no-sta (could be --no-stat or --no-stat)
I figured these are related to the automatic support for negative
options (now I understand what you were talking about when you
mentioned that to someone a few days ago). So here comes an updated
patch where I have marked all of the options except for a few
(e.g. 'autosquash') with a '!' to tell parse-options that they have no
negative forms.
And thanks for fixing up my patch that moved the rebase scripts to
SCRIPT_LIB.
-- 8< --
Subject: [PATCH v2] rebase: define options in OPTIONS_SPEC
Interactive rebase used to have its own command line processing. Since
it used the 'git rev-parse --parseopt' functionality exposed through
git-sh-setup, it had some flexibility, like matching prefixes of long
options, that non-interactive rebase didn't. When interactive rebase's
command line processing was factored out into git-rebase.sh in cf432ca
(rebase: factor out command line option processing, 2011-02-06), this
flexibility was lost. Give back that flexibility to interactive and
non-interactive by defining its options in OPTIONS_SPEC.
Also improve the usage message to contain the --continue, --skip and
--abort sub commands.
Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---
Applies on top of mz/rebase.
Are USAGE and LONG_USAGE still needed?
I based the definitions on the now-lost OPTIONS_SPEC from interactive
rebase and on Documentation/git-rebase.txt.
git-rebase.sh | 101 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 56 insertions(+), 45 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index a040ab5..7a54bfc 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -28,7 +28,39 @@ Example: git-rebase master~1 topic
'
SUBDIRECTORY_OK=Yes
-OPTIONS_SPEC=
+OPTIONS_KEEPDASHDASH=
+OPTIONS_SPEC="\
+git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]
+git rebase [-i] [options] --onto <newbase> --root [<branch>]
+git-rebase [-i] --continue | --abort | --skip
+--
+ Available options are
+v,verbose! display a diffstat of what changed upstream
+q,quiet! be quiet. implies --no-stat
+onto=! rebase onto given branch instead of upstream
+p,preserve-merges! try to recreate merges instead of ignoring them
+s,strategy=! use the given merge strategy
+no-ff! cherry-pick all commits, even if unchanged
+m,merge! use merging strategies to rebase
+i,interactive! let the user edit the list of commits to rebase
+f,force-rebase! force rebase even if branch is up to date
+X,strategy-option=! pass the argument through to the merge strategy
+stat! display a diffstat of what changed upstream
+n,no-stat! do not show diffstat of what changed upstream
+verify allow pre-rebase hook to run
+rerere-autoupdate allow rerere to update index with resolved conflicts
+root! rebase all reachable commits up to the root(s)
+autosquash move commits that begin with squash!/fixup! under -i
+committer-date-is-author-date! passed to 'git am'
+ignore-date! passed to 'git am'
+whitespace=! passed to 'git apply'
+ignore-whitespace! passed to 'git apply'
+C=! passed to 'git apply'
+ Actions:
+continue! continue rebasing process
+abort! abort rebasing process and restore original branch
+skip! skip current patch and continue rebasing process
+"
. git-sh-setup
set_reflog_action rebase
require_work_tree
@@ -175,7 +207,7 @@ do
ok_to_skip_pre_rebase=
;;
--continue|--skip|--abort)
- test $total_argc -eq 1 || usage
+ test $total_argc -eq 2 || usage
action=${1##--}
;;
--onto)
@@ -183,10 +215,10 @@ do
onto="$2"
shift
;;
- -i|--interactive)
+ -i)
interactive_rebase=explicit
;;
- -p|--preserve-merges)
+ -p)
preserve_merges=t
test -z "$interactive_rebase" && interactive_rebase=implied
;;
@@ -196,62 +228,42 @@ do
--no-autosquash)
autosquash=
;;
- -M|-m|--m|--me|--mer|--merg|--merge)
+ -M|-m)
do_merge=t
;;
- -X*|--strategy-option*)
- case "$#,$1" in
- 1,-X|1,--strategy-option)
- usage ;;
- *,-X|*,--strategy-option)
- newopt="$2"
- shift ;;
- *,--strategy-option=*)
- newopt="$(expr " $1" : ' --strategy-option=\(.*\)')" ;;
- *,-X*)
- newopt="$(expr " $1" : ' -X\(.*\)')" ;;
- 1,*)
- usage ;;
- esac
- strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$newopt")"
+ -X)
+ shift
+ strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$1")"
do_merge=t
test -z "$strategy" && strategy=recursive
;;
- -s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
- --strateg=*|--strategy=*|\
- -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
- case "$#,$1" in
- *,*=*)
- strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
- 1,*)
- usage ;;
- *)
- strategy="$2"
- shift ;;
- esac
+ -s)
+ shift
+ strategy="$1"
do_merge=t
;;
- -n|--no-stat)
+ -n)
diffstat=
;;
--stat)
diffstat=t
;;
- -v|--verbose)
+ -v)
verbose=t
diffstat=t
GIT_QUIET=
;;
- -q|--quiet)
+ -q)
GIT_QUIET=t
git_am_opt="$git_am_opt -q"
verbose=
diffstat=
;;
- --whitespace=*)
- git_am_opt="$git_am_opt $1"
+ --whitespace)
+ shift
+ git_am_opt="$git_am_opt --whitespace=$1"
case "$1" in
- --whitespace=fix|--whitespace=strip)
+ fix|strip)
force_rebase=t
;;
esac
@@ -263,22 +275,21 @@ do
git_am_opt="$git_am_opt $1"
force_rebase=t
;;
- -C*)
- git_am_opt="$git_am_opt $1"
+ -C)
+ shift
+ git_am_opt="$git_am_opt -C$1"
;;
--root)
rebase_root=t
;;
- -f|--f|--fo|--for|--forc|--force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase|--no-ff)
+ -f|--no-ff)
force_rebase=t
;;
--rerere-autoupdate|--no-rerere-autoupdate)
allow_rerere_autoupdate="$1"
;;
- -*)
- usage
- ;;
- *)
+ --)
+ shift
break
;;
esac
--
1.7.4.79.gcbe20
prev parent reply other threads:[~2011-03-01 1:59 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-28 9:30 [PATCH 00/31] Refactor rebase Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 01/31] rebase: clearer names for directory variables Martin von Zweigbergk
2010-12-28 23:08 ` Junio C Hamano
2010-12-28 20:53 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 02/31] rebase: refactor reading of state Martin von Zweigbergk
2010-12-28 23:08 ` Junio C Hamano
2010-12-29 8:09 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 03/31] rebase: read state outside loop Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 04/31] rebase: remove unused rebase state 'prev_head' Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 05/31] rebase: improve detection of rebase in progress Martin von Zweigbergk
2010-12-28 23:08 ` Junio C Hamano
2010-12-28 20:35 ` Martin von Zweigbergk
2011-01-12 10:20 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 06/31] rebase: act on command line outside parsing loop Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 07/31] rebase: stricter check of standalone sub command Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 08/31] rebase: align variable names Martin von Zweigbergk
2011-01-04 19:12 ` Thomas Rast
2011-01-05 2:25 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 09/31] rebase: align variable content Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 10/31] rebase: factor out command line option processing Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 11/31] rebase -i: remove now unnecessary directory checks Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 12/31] rebase: reorder validation steps Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 13/31] rebase: factor out reference parsing Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 14/31] rebase: factor out clean work tree check Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 15/31] rebase: factor out call to pre-rebase hook Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 16/31] rebase -i: support --stat Martin von Zweigbergk
2010-12-28 17:59 ` Johannes Schindelin
2010-12-28 13:24 ` Martin von Zweigbergk
2010-12-28 23:36 ` Junio C Hamano
2010-12-28 23:44 ` Johannes Schindelin
2010-12-28 9:30 ` [PATCH 17/31] rebase: remove $branch as synonym for $orig_head Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 18/31] rebase: extract merge code to new source file Martin von Zweigbergk
2010-12-29 21:31 ` Johannes Sixt
2010-12-29 22:24 ` Martin von Zweigbergk
2010-12-31 12:23 ` Thomas Rast
2010-12-31 14:05 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 19/31] rebase: extract am " Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 20/31] rebase: show consistent conflict resolution hint Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 21/31] rebase -i: align variable names Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 22/31] rebase: make -v a tiny bit more verbose Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 23/31] rebase: factor out sub command handling Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 24/31] rebase: extract code for writing basic state Martin von Zweigbergk
2011-01-04 19:19 ` Thomas Rast
2011-01-05 2:40 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 25/31] rebase: remember verbose option Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 26/31] rebase: remember strategy and strategy options Martin von Zweigbergk
2011-01-04 19:27 ` Thomas Rast
2011-01-05 3:33 ` Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 27/31] rebase -m: remember allow_rerere_autoupdate option Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 28/31] rebase -m: don't print exit code 2 when merge fails Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 29/31] git-rebase--am: remove unnecessary --3way option Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 30/31] rebase -i: don't read unused variable preserve_merges Martin von Zweigbergk
2010-12-28 9:30 ` [PATCH 31/31] rebase -i: remove unnecessary state rebase-root Martin von Zweigbergk
2010-12-28 16:40 ` Thomas Rast
2010-12-29 22:31 ` Martin von Zweigbergk
2010-12-31 5:41 ` Christian Couder
2011-01-04 19:57 ` [PATCH 00/31] Refactor rebase Thomas Rast
2011-01-05 3:39 ` Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 00/31] refactor rebase Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 01/31] rebase: clearer names for directory variables Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 02/31] rebase: refactor reading of state Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 03/31] rebase: read state outside loop Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 04/31] rebase: remove unused rebase state 'prev_head' Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 05/31] rebase: improve detection of rebase in progress Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 06/31] rebase: act on command line outside parsing loop Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 07/31] rebase: stricter check of standalone sub command Martin von Zweigbergk
2011-07-01 3:55 ` Jonathan Nieder
2011-07-01 13:16 ` Martin von Zweigbergk
2011-07-01 22:29 ` Jonathan Nieder
2011-07-06 1:48 ` Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 08/31] rebase: align variable names Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 09/31] rebase: align variable content Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 10/31] rebase: factor out command line option processing Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 11/31] rebase -i: remove now unnecessary directory checks Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 12/31] rebase: reorder validation steps Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 13/31] rebase: factor out reference parsing Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 14/31] rebase: factor out clean work tree check Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 15/31] rebase: factor out call to pre-rebase hook Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 16/31] rebase -i: support --stat Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 17/31] rebase: remove $branch as synonym for $orig_head Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 18/31] rebase: extract merge code to new source file Martin von Zweigbergk
2011-02-14 8:02 ` Johannes Sixt
2011-02-14 13:56 ` Martin von Zweigbergk
2011-02-24 3:27 ` Martin von Zweigbergk
2011-02-24 8:07 ` Jeff King
2011-02-24 8:09 ` Jeff King
2011-02-25 3:32 ` Martin von Zweigbergk
2011-02-25 9:02 ` Jeff King
2011-02-25 20:24 ` Junio C Hamano
2011-02-25 20:27 ` Jakub Narebski
2011-03-01 22:04 ` Jeff King
2011-03-01 22:43 ` Jakub Narebski
2011-02-06 18:43 ` [PATCH v2 19/31] rebase: extract am " Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 20/31] rebase: show consistent conflict resolution hint Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 21/31] rebase -i: align variable names Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 22/31] rebase: make -v a tiny bit more verbose Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 23/31] rebase: factor out sub command handling Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 24/31] rebase: extract code for writing basic state Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 25/31] rebase: remember verbose option Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 26/31] rebase: remember strategy and strategy options Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 27/31] rebase -m: remember allow_rerere_autoupdate option Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 28/31] rebase -m: don't print exit code 2 when merge fails Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 29/31] git-rebase--am: remove unnecessary --3way option Martin von Zweigbergk
2011-02-06 18:43 ` [PATCH v2 30/31] rebase -i: don't read unused variable preserve_merges Martin von Zweigbergk
2011-02-06 18:44 ` [PATCH v2 31/31] rebase -i: remove unnecessary state rebase-root Martin von Zweigbergk
2011-02-10 22:44 ` [PATCH v2 00/31] refactor rebase Junio C Hamano
2011-02-12 0:55 ` Martin von Zweigbergk
2011-02-14 1:54 ` Martin von Zweigbergk
2011-02-14 3:15 ` Martin von Zweigbergk
2011-02-15 0:36 ` Junio C Hamano
2011-02-22 13:58 ` Martin von Zweigbergk
2011-02-22 19:21 ` Junio C Hamano
2011-02-23 11:26 ` Martin von Zweigbergk
2011-02-16 14:52 ` Johannes Sixt
2011-02-17 3:41 ` Martin von Zweigbergk
2011-02-24 3:07 ` [PATCH] rebase: define options in OPTIONS_SPEC Martin von Zweigbergk
2011-02-27 10:59 ` Junio C Hamano
2011-03-01 1:59 ` Martin von Zweigbergk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.00.1102272055320.5025@debian \
--to=martin.von.zweigbergk@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox