commit - 0ebf8283cd162a594e725ca2a1fd9f16e6ece6e4
commit + 3f9de99f9b4d3da34a06dfce54134ff891684df9
blob - 3dd118c77e4b297b156ed437c7928b5f83cc302b
blob + b5341e17acdb3b81c77d3cce58a2ab5c6c010c6c
--- got/got.c
+++ got/got.c
struct got_histedit_list_entry *prev, *folded = NULL;
prev = TAILQ_PREV(hle, got_histedit_list, entry);
- while (prev && prev->cmd->code == GOT_HISTEDIT_FOLD) {
- folded = prev;
+ while (prev && (prev->cmd->code == GOT_HISTEDIT_FOLD ||
+ prev->cmd->code == GOT_HISTEDIT_DROP)) {
+ if (prev->cmd->code == GOT_HISTEDIT_FOLD)
+ folded = prev;
prev = TAILQ_PREV(prev, got_histedit_list, entry);
}
folded = get_folded_commits(hle);
if (folded) {
while (folded != hle) {
+ if (folded->cmd->code == GOT_HISTEDIT_DROP) {
+ folded = TAILQ_NEXT(folded, entry);
+ continue;
+ }
err = append_folded_commit_msg(&new_msg, folded,
logmsg, repo);
if (err)
blob - 98604e6814628faa295d9b0a155046626d878a18
blob + cafb3a5b88482ebdd45c1512db2a90522d782171
--- regress/cmdline/histedit.sh
+++ regress/cmdline/histedit.sh
echo "modified zeta on master" > $testroot/repo/epsilon/zeta
git_commit $testroot/repo -m "committing to zeta on master"
local old_commit2=`git_show_head $testroot/repo`
+
+ echo "modified delta on master" > $testroot/repo/gamma/delta
+ git_commit $testroot/repo -m "committing to delta on master"
+ local old_commit3=`git_show_head $testroot/repo`
got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
ret="$?"
fi
echo "fold $old_commit1" > $testroot/histedit-script
- echo "pick $old_commit2" >> $testroot/histedit-script
+ echo "drop $old_commit2" >> $testroot/histedit-script
+ echo "pick $old_commit3" >> $testroot/histedit-script
echo "mesg committing folded changes" >> $testroot/histedit-script
(cd $testroot/wt && got histedit -F $testroot/histedit-script \
local short_old_commit1=`trim_obj_id 28 $old_commit1`
local short_old_commit2=`trim_obj_id 28 $old_commit2`
+ local short_old_commit3=`trim_obj_id 28 $old_commit3`
local short_new_commit1=`trim_obj_id 28 $new_commit1`
local short_new_commit2=`trim_obj_id 28 $new_commit2`
echo "A epsilon/new" >> $testroot/stdout.expected
echo "$short_old_commit1 -> fold commit: committing changes" \
>> $testroot/stdout.expected
- echo "G epsilon/zeta" >> $testroot/stdout.expected
- echo -n "$short_old_commit2 -> $short_new_commit2: " \
+ echo -n "$short_old_commit2 -> " >> $testroot/stdout.expected
+ echo "drop commit: committing to zeta on master" \
>> $testroot/stdout.expected
+ echo "G gamma/delta" >> $testroot/stdout.expected
+ echo -n "$short_old_commit3 -> $short_new_commit2: " \
+ >> $testroot/stdout.expected
echo "committing folded changes" >> $testroot/stdout.expected
echo "Switching work tree to refs/heads/master" \
>> $testroot/stdout.expected