[PATCH 3/3] rebase: refuse to rebase with -s ours
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Nov 15, 2009, 18:25 UTC
- Message-ID
- <efd7770d166a97481e8e31e407b9c2da02a341e5.1258309432.git.trast@student.ethz.ch>
- In-Reply-To
- <cover.1258309432.git.trast@student.ethz.ch>
Using the "ours" strategy with rebase just discards all changes, turning <branch> into <upstream> (or <newbase> if given). This is unlikely to be what the user wants, so simply refuse to do it.
Also document what would happen near the -s option, and point the user at it with the error message.
Signed-off-by: Thomas Rast <trast@student.ethz.ch> --- Documentation/git-rebase.txt | 3 ++- git-rebase--interactive.sh | 4 ++++ git-rebase.sh | 4 ++++ 3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 5fa9100..2203e63 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -241,7 +241,8 @@ rebased series, starting with <upstream>. + Due to the peculiarities of 'git-rebase' (see \--merge above), using the 'ours' strategy simply discards all patches from the <branch>, -which makes little sense. +which makes little sense. Thus 'git-rebase' does not accept this +strategy. -q:: --quiet:: diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 53ad248..c6bc156 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -584,6 +584,10 @@ first and then run 'git rebase --continue' again." STRATEGY="-s $2" shift ;; esac + if test "$STRATEGY" = "-s ours" + then + die "Refusing to rebase with 'ours' strategy; see git help rebase." + fi ;; -m) # we use merge anyway diff --git a/git-rebase.sh b/git-rebase.sh index 6ec155c..2d7d566 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -306,6 +306,10 @@ do strategy="$2" shift ;; esac + if test $strategy = ours + then + die "Refusing to rebase with 'ours' strategy; see git help rebase." + fi do_merge=t ;; -n|--no-stat)
-- 1.6.5.2.420.gf6c057.dirty