summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-06-25 17:56:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-06-27 01:58:45 (GMT)
commitc54b7817f4f6bf422ea532d81217c28f63c259c5 (patch)
treefac8ec8c43606f72e921f2560abe3d4cce222e68 /git-rebase--interactive.sh
parentad562a817256adff4faadc17900b4aba67ca471a (diff)
downloadgit-c54b7817f4f6bf422ea532d81217c28f63c259c5.zip
git-c54b7817f4f6bf422ea532d81217c28f63c259c5.tar.gz
git-c54b7817f4f6bf422ea532d81217c28f63c259c5.tar.bz2
rebase -i: several cleanups
Support "--verbose" in addition to "-v", show short names in the list comment, clean up if there is nothing to do, and add several "test_ticks" in the test script. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index ab36572..a81432c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -60,6 +60,11 @@ die_with_patch () {
die "$2"
}
+die_abort () {
+ rm -rf "$DOTEST"
+ die "$1"
+}
+
pick_one () {
case "$1" in -n) sha1=$2 ;; *) sha1=$1 ;; esac
git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
@@ -212,7 +217,7 @@ do
-C*)
die "Interactive rebase uses merge, so $1 does not make sense"
;;
- -v)
+ -v|--verbose)
VERBOSE=t
;;
-i|--interactive)
@@ -264,8 +269,11 @@ do
echo $ONTO > "$DOTEST"/onto
test t = "$VERBOSE" && : > "$DOTEST"/verbose
+ SHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)
+ SHORTHEAD=$(git rev-parse --short $HEAD)
+ SHORTONTO=$(git rev-parse --short $ONTO)
cat > "$TODO" << EOF
-# Rebasing $UPSTREAM..$HEAD onto $ONTO
+# Rebasing $SHORTUPSTREAM..$SHORTHEAD onto $SHORTONTO
#
# Commands:
# pick = use commit
@@ -277,13 +285,16 @@ EOF
sed "s/^/pick /" >> "$TODO"
test -z "$(grep -ve '^$' -e '^#' < $TODO)" &&
- die "Nothing to do"
+ die_abort "Nothing to do"
cp "$TODO" "$TODO".backup
${VISUAL:-${EDITOR:-vi}} "$TODO" ||
die "Could not execute editor"
- git reset --hard $ONTO && do_rest
+ test -z "$(grep -ve '^$' -e '^#' < $TODO)" &&
+ die_abort "Nothing to do"
+
+ git checkout $ONTO && do_rest
esac
shift
done