* [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date
@ 2009-02-13 22:48 Sverre Rabbelier
2009-02-14 6:07 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Sverre Rabbelier @ 2009-02-13 22:48 UTC (permalink / raw)
To: Git Mailinglist, Johannes Schindelin, Junio C Hamano; +Cc: Sverre Rabbelier
Normally, if the current branch is up to date, the rebase is aborted.
However, it may be desirable to allow rebasing even if the current
branch is up to date. When using the '--whitespace=fix' option -f is
implied.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
Only added the 'case "$1" in...' bit since the RFC v1. I'm not sure
how to do the test-cases. Should they go into t3400-rebase.sh, and if
so, any suggesions on how to write these test cases?
git-rebase.sh | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 6d3eddb..ccfd2b9 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2005 Junio C Hamano.
#
-USAGE='[--interactive | -i] [-v] [--onto <newbase>] [<upstream>|--root] [<branch>]'
+USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto <newbase>] [<upstream>|--root] [<branch>]'
LONG_USAGE='git-rebase replaces <branch> with a new branch of the
same name. When the --onto option is provided the new branch starts
out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -48,6 +48,7 @@ prec=4
verbose=
git_am_opt=
rebase_root=
+force_rebase=
continue_merge () {
test -n "$prev_head" || die "prev_head must be defined"
@@ -294,12 +295,21 @@ do
;;
--whitespace=*)
git_am_opt="$git_am_opt $1"
+
+ case "$1" in
+ --whitespace=fix|--whitespace=strip)
+ force_rebase=t
+ ;;
+ esac
;;
-C*)
git_am_opt="$git_am_opt $1"
;;
--root)
rebase_root=t
+ ;;
+ -f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force_rebas|--force-rebase)
+ force_rebase=t
;;
-*)
usage
@@ -419,10 +429,15 @@ if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
# linear history?
! (git rev-list --parents "$onto".."$branch" | grep " .* ") > /dev/null
then
- # Lazily switch to the target branch if needed...
- test -z "$switch_to" || git checkout "$switch_to"
- echo >&2 "Current branch $branch_name is up to date."
- exit 0
+ if test -z "$force_rebase"
+ then
+ # Lazily switch to the target branch if needed...
+ test -z "$switch_to" || git checkout "$switch_to"
+ echo >&2 "Current branch $branch_name is up to date."
+ exit 0
+ else
+ echo "Current branch $branch_name is up to date, rebase forced."
+ fi
fi
if test -n "$verbose"
--
1.6.2.rc0.206.g681e7.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date
2009-02-13 22:48 [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date Sverre Rabbelier
@ 2009-02-14 6:07 ` Johannes Schindelin
2009-02-14 17:57 ` Sverre Rabbelier
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-02-14 6:07 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Git Mailinglist, Junio C Hamano
On Fri, 13 Feb 2009, Sverre Rabbelier wrote:
> + case "$1" in
> + --whitespace=fix|--whitespace=strip)
--whitespace=*?
I know that you can turn it off with --whitespace=nowarn, but that's
such an outlier that we do not have to care about it, right?
Or if we really want to:
--whitespace=nowarn) ;;
--whitespace=*) force_rebase=t ;;
Hm?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date
2009-02-14 6:07 ` Johannes Schindelin
@ 2009-02-14 17:57 ` Sverre Rabbelier
2009-02-14 19:56 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Sverre Rabbelier @ 2009-02-14 17:57 UTC (permalink / raw)
To: Johannes Schindelin, Junio C Hamano; +Cc: Git Mailinglist
On Sat, Feb 14, 2009 at 07:07, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> I know that you can turn it off with --whitespace=nowarn, but that's
> such an outlier that we do not have to care about it, right?
Well, actually, in the v1 thread Junio mentioned that it should not
imply -f for --whitespace=nowarn.
> Or if we really want to:
>
> --whitespace=nowarn) ;;
> --whitespace=*) force_rebase=t ;;
>
> Hm?
No strong opinion on my side, what does the gitster have to say about it?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date
2009-02-14 17:57 ` Sverre Rabbelier
@ 2009-02-14 19:56 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2009-02-14 19:56 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Johannes Schindelin, Git Mailinglist
Sverre Rabbelier <srabbelier@gmail.com> writes:
> On Sat, Feb 14, 2009 at 07:07, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> I know that you can turn it off with --whitespace=nowarn, but that's
>> such an outlier that we do not have to care about it, right?
>
> Well, actually, in the v1 thread Junio mentioned that it should not
> imply -f for --whitespace=nowarn.
>
>> Or if we really want to:
>>
>> --whitespace=nowarn) ;;
>> --whitespace=*) force_rebase=t ;;
>>
>> Hm?
>
> No strong opinion on my side, what does the gitster have to say about it?
"Fix" is obviously a request to "fix" things. On the other hand, at least
to me, "warn" is more about "*if you were to* rewrite and find issues,
please notify me". So I prefer what is queued already.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-14 19:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-13 22:48 [RFC PATCH v2] Teach rebase to rebase even if upstream is up to date Sverre Rabbelier
2009-02-14 6:07 ` Johannes Schindelin
2009-02-14 17:57 ` Sverre Rabbelier
2009-02-14 19:56 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).