summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6426f2d)
raw | patch | inline | side by side (parent: 6426f2d)
author | Ramkumar Ramachandra <artagnon@gmail.com> | |
Fri, 27 Aug 2010 20:28:16 +0000 (01:58 +0530) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 27 Aug 2010 23:47:45 +0000 (16:47 -0700) |
If the topmost three commits in a branch were merge commits, 'git
format-patch -3' used to output nothing. Since Git can't prepare
patches out of merge commits anyway, don't go over them in the first
place. 'git format-patch -3' now prepares three patches from the
topmost three commits without counting merge commits. Also add a
corresponding test in t4014-format-patch and update documentation.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
format-patch -3' used to output nothing. Since Git can't prepare
patches out of merge commits anyway, don't go over them in the first
place. 'git format-patch -3' now prepares three patches from the
topmost three commits without counting merge commits. Also add a
corresponding test in t4014-format-patch and update documentation.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-format-patch.txt | patch | blob | history | |
builtin/log.c | patch | blob | history | |
t/t4014-format-patch.sh | patch | blob | history |
index 835fb7135b9d159281ef8eb81daf699c6aeec57b..95b8bcc49ed04f2d8e9eb49c233a81d8407d095a 100644 (file)
include::diff-options.txt[]
-<n>::
- Limits the number of patches to prepare.
+ Prepare patches from the topmost <n> commits.
-o <dir>::
--output-directory <dir>::
diff --git a/builtin/log.c b/builtin/log.c
index 6208703c061abb868201073795cf516bf81b2602..0093b2d8d8de561512efffe7cc416b1cdfe225dd 100644 (file)
--- a/builtin/log.c
+++ b/builtin/log.c
rev.commit_format = CMIT_FMT_EMAIL;
rev.verbose_header = 1;
rev.diff = 1;
- rev.combine_merges = 0;
- rev.ignore_merges = 1;
+ rev.no_merges = 1;
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
rev.subject_prefix = fmt_patch_subject_prefix;
memset(&s_r_opt, 0, sizeof(s_r_opt));
continue;
}
- /* ignore merges */
- if (commit->parents && commit->parents->next)
- continue;
-
if (ignore_if_in_upstream &&
has_commit_patch_id(commit, &ids))
continue;
index 6321ac88aa65a9c9a9d5b114b01165e687363047..2e78c9e662e8a506802665b97e6b07c22a1b134e 100755 (executable)
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
'
+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" '
git checkout -b rebuild-0 master &&