Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
rebase -i: Change function make_squash_message into update_squash_message
author
Michael Haggerty
<mhagger@alum.mit.edu>
Thu, 14 Jan 2010 05:54:54 +0000
(06:54 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 14 Jan 2010 08:27:56 +0000
(
00:27
-0800)
Alter the file $SQUASH_MSG in place rather than outputting the new
message then juggling it around. Change the function name
accordingly.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7756ecf
)
diff --git
a/git-rebase--interactive.sh
b/git-rebase--interactive.sh
index 7d308295062d07821868d8ff5581edc29b6c3624..d8c3c9aac9ecfcc34aac151760520a961f63ce91 100755
(executable)
--- a/
git-rebase--interactive.sh
+++ b/
git-rebase--interactive.sh
@@
-358,21
+358,26
@@
nth_string () {
esac
}
esac
}
-
mak
e_squash_message () {
+
updat
e_squash_message () {
if test -f "$SQUASH_MSG"; then
if test -f "$SQUASH_MSG"; then
+ mv "$SQUASH_MSG" "$SQUASH_MSG".bak || exit
COUNT=$(($(sed -n \
-e "1s/^# This is a combination of \(.*\) commits\./\1/p" \
COUNT=$(($(sed -n \
-e "1s/^# This is a combination of \(.*\) commits\./\1/p" \
- -e "q" < "$SQUASH_MSG")+1))
- echo "# This is a combination of $COUNT commits."
- sed -e 1d -e '2,/^./{
- /^$/d
- }' <"$SQUASH_MSG"
+ -e "q" < "$SQUASH_MSG".bak)+1))
+ {
+ echo "# This is a combination of $COUNT commits."
+ sed -e 1d -e '2,/^./{
+ /^$/d
+ }' <"$SQUASH_MSG".bak
+ } >$SQUASH_MSG
else
COUNT=2
else
COUNT=2
- echo "# This is a combination of 2 commits."
- echo "# The first commit's message is:"
- echo
- commit_message HEAD
+ {
+ echo "# This is a combination of 2 commits."
+ echo "# The first commit's message is:"
+ echo
+ commit_message HEAD
+ } >$SQUASH_MSG
fi
case $1 in
squash)
fi
case $1 in
squash)
@@
-387,7
+392,7
@@
make_squash_message () {
echo
commit_message $2 | sed -e 's/^/# /'
;;
echo
commit_message $2 | sed -e 's/^/# /'
;;
- esac
+ esac
>>$SQUASH_MSG
}
peek_next_command () {
}
peek_next_command () {
@@
-450,7
+455,7
@@
do_next () {
die "Cannot '$squash_style' without a previous commit"
mark_action_done
die "Cannot '$squash_style' without a previous commit"
mark_action_done
- make_squash_message $squash_style $sha1 > "$MSG"
+ update_squash_message $squash_style $sha1
failed=f
author_script=$(get_author_ident_from_commit HEAD)
echo "$author_script" > "$AUTHOR_SCRIPT"
failed=f
author_script=$(get_author_ident_from_commit HEAD)
echo "$author_script" > "$AUTHOR_SCRIPT"
@@
-460,16
+465,16
@@
do_next () {
case "$(peek_next_command)" in
squash|s|fixup|f)
USE_OUTPUT=output
case "$(peek_next_command)" in
squash|s|fixup|f)
USE_OUTPUT=output
+ cp "$SQUASH_MSG" "$MSG" || exit
MSG_OPT=-F
EDIT_OR_FILE="$MSG"
MSG_OPT=-F
EDIT_OR_FILE="$MSG"
- cp "$MSG" "$SQUASH_MSG"
;;
*)
USE_OUTPUT=
MSG_OPT=
EDIT_OR_FILE=-e
;;
*)
USE_OUTPUT=
MSG_OPT=
EDIT_OR_FILE=-e
-
rm -f "$SQUASH_
MSG" || exit
- cp "$MSG" "$GIT_DIR"/SQUASH_MSG
+
cp "$SQUASH_MSG" "$
MSG" || exit
+ mv "$SQUASH_MSG" "$GIT_DIR"/SQUASH_MSG || exit
rm -f "$GIT_DIR"/MERGE_MSG || exit
;;
esac
rm -f "$GIT_DIR"/MERGE_MSG || exit
;;
esac