X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-rebase--interactive.sh;h=8ed2244819d0950ddf1ffaa151b4d46bdc8b6db4;hb=1c7c1d179e51f163c014353f33b406f5bae13922;hp=1172e47571dfe1d6dd088381d63045fd5eae3db3;hpb=bf31115312aefd36f1571379842eebebf34dcb55;p=git.git diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 1172e4757..8ed224481 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -115,9 +115,18 @@ mark_action_done () { } 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 || @@ -256,9 +265,8 @@ pick_one_preserving_merges () { output git merge $STRATEGY -m "$msg" \ $new_parents then - git rerere printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG - die Error redoing merge $sha1 + die_with_patch $sha1 "Error redoing merge $sha1" fi ;; *) @@ -341,7 +349,7 @@ do_next () { squash|s) comment_for_reflog squash - has_action "$DONE" || + test -f "$DONE" && has_action "$DONE" || die "Cannot 'squash' without a previous commit" mark_action_done