index 495f554b6576cfb1f32d94f319b325a4de9d648d..c8b0861c085035c85002f6e2fe969369ea32016f 100755 (executable)
continue continue rebasing process
abort abort rebasing process and restore original branch
skip skip current patch and continue rebasing process
continue continue rebasing process
abort abort rebasing process and restore original branch
skip skip current patch and continue rebasing process
+no-verify override pre-rebase hook from stopping the operation
"
. git-sh-setup
"
. git-sh-setup
STRATEGY=
ONTO=
VERBOSE=
STRATEGY=
ONTO=
VERBOSE=
+OK_TO_SKIP_PRE_REBASE=
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
mark the corrected paths with 'git add <paths>', and
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
mark the corrected paths with 'git add <paths>', and
}
run_pre_rebase_hook () {
}
run_pre_rebase_hook () {
- if test -x "$GIT_DIR/hooks/pre-rebase"
+ if test -z "$OK_TO_SKIP_PRE_REBASE" &&
+ test -x "$GIT_DIR/hooks/pre-rebase"
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
echo >&2 "The pre-rebase hook refused to rebase."
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
echo >&2 "The pre-rebase hook refused to rebase."
}
make_patch () {
}
make_patch () {
- parent_sha1=$(git rev-parse --verify "$1"^) ||
- die "Cannot get patch for $1^"
- git diff-tree -p "$parent_sha1".."$1" > "$DOTEST"/patch
+ sha1_and_parents="$(git rev-list --parents -1 "$1")"
+ case "$sha1_and_parents" in
+ ?*' '?*' '?*)
+ git diff --cc $sha1_and_parents
+ ;;
+ ?*' '?*)
+ git diff-tree -p "$1^!"
+ ;;
+ *)
+ echo "Root commit"
+ ;;
+ esac > "$DOTEST"/patch
test -f "$DOTEST"/message ||
git cat-file commit "$1" | sed "1,/^$/d" > "$DOTEST"/message
test -f "$DOTEST"/author-script ||
test -f "$DOTEST"/message ||
git cat-file commit "$1" | sed "1,/^$/d" > "$DOTEST"/message
test -f "$DOTEST"/author-script ||
if test -f "$DOTEST"/current-commit
then
if test -f "$DOTEST"/current-commit
then
- if [ "$fast_forward" == "t" ]
+ if test "$fast_forward" = t
then
cat "$DOTEST"/current-commit | while read current_commit
do
then
cat "$DOTEST"/current-commit | while read current_commit
do
if test -f "$REWRITTEN"/$p
then
new_p=$(cat "$REWRITTEN"/$p)
if test -f "$REWRITTEN"/$p
then
new_p=$(cat "$REWRITTEN"/$p)
+
+ # If the todo reordered commits, and our parent is marked for
+ # rewriting, but hasn't been gotten to yet, assume the user meant to
+ # drop it on top of the current HEAD
+ if test -z "$new_p"
+ then
+ new_p=$(git rev-parse HEAD)
+ fi
+
test $p != $new_p && fast_forward=f
case "$new_parents" in
*$new_p*)
test $p != $new_p && fast_forward=f
case "$new_parents" in
*$new_p*)
output git merge $STRATEGY -m "$msg" \
$new_parents
then
output git merge $STRATEGY -m "$msg" \
$new_parents
then
- git rerere
printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG
printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG
- die Error redoing merge $sha1
+ die_with_patch $sha1 "Error redoing merge $sha1"
fi
;;
*)
fi
;;
*)
while test $# != 0
do
case "$1" in
while test $# != 0
do
case "$1" in
+ --no-verify)
+ OK_TO_SKIP_PRE_REBASE=yes
+ ;;
+ --verify)
+ ;;
--continue)
is_standalone "$@" || usage
get_saved_options
--continue)
is_standalone "$@" || usage
get_saved_options
sed -n "s/^>//p" > "$DOTEST"/not-cherry-picks
# Now all commits and note which ones are missing in
# not-cherry-picks and hence being dropped
sed -n "s/^>//p" > "$DOTEST"/not-cherry-picks
# Now all commits and note which ones are missing in
# not-cherry-picks and hence being dropped
- git rev-list $UPSTREAM...$HEAD --left-right | \
- sed -n "s/^>//p" | while read rev
+ git rev-list $UPSTREAM..$HEAD |
+ while read rev
do
if test -f "$REWRITTEN"/$rev -a "$(grep "$rev" "$DOTEST"/not-cherry-picks)" = ""
then
do
if test -f "$REWRITTEN"/$rev -a "$(grep "$rev" "$DOTEST"/not-cherry-picks)" = ""
then
# just the history of its first-parent for others that will
# be rebasing on top of it
git rev-list --parents -1 $rev | cut -d' ' -f2 > "$DROPPED"/$rev
# just the history of its first-parent for others that will
# be rebasing on top of it
git rev-list --parents -1 $rev | cut -d' ' -f2 > "$DROPPED"/$rev
- cat "$TODO" | grep -v "${rev:0:7}" > "${TODO}2" ; mv "${TODO}2" "$TODO"
+ short=$(git rev-list -1 --abbrev-commit --abbrev=7 $rev)
+ grep -v "^[a-z][a-z]* $short" <"$TODO" > "${TODO}2" ; mv "${TODO}2" "$TODO"
rm "$REWRITTEN"/$rev
fi
done
rm "$REWRITTEN"/$rev
fi
done