Merge branch 'rr/format-patch-count-without-merges'

* rr/format-patch-count-without-merges:
  format-patch: Don't go over merge commits
  t4014-format-patch: Call test_tick before committing
This commit is contained in:
Junio C Hamano 2010-09-29 13:49:09 -07:00
Родитель b3c16ee454 2c642ed866
Коммит 7fd739cd57
3 изменённых файлов: 23 добавлений и 7 удалений

Просмотреть файл

@ -74,7 +74,7 @@ OPTIONS
include::diff-options.txt[] include::diff-options.txt[]
-<n>:: -<n>::
Limits the number of patches to prepare. Prepare patches from the topmost <n> commits.
-o <dir>:: -o <dir>::
--output-directory <dir>:: --output-directory <dir>::

Просмотреть файл

@ -1056,8 +1056,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.commit_format = CMIT_FMT_EMAIL; rev.commit_format = CMIT_FMT_EMAIL;
rev.verbose_header = 1; rev.verbose_header = 1;
rev.diff = 1; rev.diff = 1;
rev.combine_merges = 0; rev.no_merges = 1;
rev.ignore_merges = 1;
DIFF_OPT_SET(&rev.diffopt, RECURSIVE); DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
rev.subject_prefix = fmt_patch_subject_prefix; rev.subject_prefix = fmt_patch_subject_prefix;
memset(&s_r_opt, 0, sizeof(s_r_opt)); memset(&s_r_opt, 0, sizeof(s_r_opt));
@ -1228,10 +1227,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
continue; continue;
} }
/* ignore merges */
if (commit->parents && commit->parents->next)
continue;
if (ignore_if_in_upstream && if (ignore_if_in_upstream &&
has_commit_patch_id(commit, &ids)) has_commit_patch_id(commit, &ids))
continue; continue;

Просмотреть файл

@ -12,24 +12,29 @@ test_expect_success setup '
for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file &&
cat file >elif && cat file >elif &&
git add file elif && git add file elif &&
test_tick &&
git commit -m Initial && git commit -m Initial &&
git checkout -b side && git checkout -b side &&
for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file && for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
test_chmod +x elif && test_chmod +x elif &&
test_tick &&
git commit -m "Side changes #1" && git commit -m "Side changes #1" &&
for i in D E F; do echo "$i"; done >>file && for i in D E F; do echo "$i"; done >>file &&
git update-index file && git update-index file &&
test_tick &&
git commit -m "Side changes #2" && git commit -m "Side changes #2" &&
git tag C2 && git tag C2 &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file && for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
git update-index file && git update-index file &&
test_tick &&
git commit -m "Side changes #3 with \\n backslash-n in it." && git commit -m "Side changes #3 with \\n backslash-n in it." &&
git checkout master && git checkout master &&
git diff-tree -p C2 | git apply --index && git diff-tree -p C2 | git apply --index &&
test_tick &&
git commit -m "Master accepts moral equivalent of #2" git commit -m "Master accepts moral equivalent of #2"
' '
@ -51,6 +56,22 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
' '
test_expect_success "format-patch doesn't consider merge commits" '
git checkout -b slave master &&
echo "Another line" >>file &&
test_tick &&
git commit -am "Slave change #1" &&
echo "Yet another line" >>file &&
test_tick &&
git commit -am "Slave change #2" &&
git checkout -b merger master &&
test_tick &&
git merge --no-ff slave &&
cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
test $cnt = 3
'
test_expect_success "format-patch result applies" ' test_expect_success "format-patch result applies" '
git checkout -b rebuild-0 master && git checkout -b rebuild-0 master &&