1
0
mirror of https://github.com/git/git.git synced 2024-09-23 01:21:38 +02:00
git/git-rebase.sh
Junio C Hamano ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00

30 lines
573 B
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano.
#
. git-sh-setup
# The other head is given
other=$(git-rev-parse --verify "$1^0") || exit
# The tree must be really really clean.
git-update-index --refresh || exit
diff=$(git-diff-index --cached --name-status -r HEAD)
case "$different" in
?*) echo "$diff"
exit 1
;;
esac
# If the branch to rebase is given, first switch to it.
case "$#" in
2)
git-checkout "$2" || exit
esac
# Rewind the head to "$other"
git-reset --hard "$other"
git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
git am --binary -3 -k