git-format-patch -3
PATCH 1/1 git-format-patch -3
This teaches "git-format-patch" to honor the --max-count parameter revision traversal machinery takes, so that you can say "git-format-patch -3" to process the three topmost commits from the current HEAD (or "git-format-patch -2 topic" to name a specific branch).
---
* I think this is incompatible with --ignore-if-upstream, which I haven't bothered to look into yet.
Likes, dislikes?
builtin-log.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
builtin-log.c +7 -2
@@ -482,8 +482,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) }if (rev.pending.nr ==1 ) { - rev.pending.objects[0 ].item->flags |=UNINTERESTING ; -add_head (&rev); +if (rev.max_count <0 ) { + rev.pending.objects[0 ].item->flags |=UNINTERESTING ; +add_head (&rev); + } +/* Otherwise, it is "format-patch -22 HEAD", and +* get_revision() would return only the specified count. +*/ }if (ignore_if_in_upstream)
PATCH 1/1 Add --summary to git-format-patch by default
This adds --summary output in addition to the --stat to the output from git-format-patch by default.
I think additions, removals and filemode changes are rare but notable events and always showing it makes sense.
---
* An alternative would be to give --summary whenever --stat is asked for _any_ diff family of commands, which might make sense but I suspect is going too far. At least format-patch is a good place to add this since it allows accidental mode changes to be caught at the last minute before sending the message out to the public.
Opinions?
builtin-log.c +1 -1
@@ -468,7 +468,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)die ("unrecognized argument: %s" , argv[1 ]);if (!rev.diffopt.output_format) - rev.diffopt.output_format =DIFF_FORMAT_DIFFSTAT |DIFF_FORMAT_PATCH ; + rev.diffopt.output_format =DIFF_FORMAT_DIFFSTAT |DIFF_FORMAT_SUMMARY |DIFF_FORMAT_PATCH ;if (!output_directory) output_directory = prefix;
t/t4013/diff.format-patch_--attach_--stdout_initial..master +3 -0
@@ -19,6 +19,7 @@ This is the second commit. file0 | 3 +++ file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
@@ -77,6 +78,7 @@ Content-Transfer-Encoding: 8bit dir/sub | 2 ++ file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
@@ -126,6 +128,7 @@ Content-Transfer-Encoding: 8bit file0 | 3 +++ file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
t/t4013/diff.format-patch_--attach_--stdout_initial..master^ +2 -0
@@ -19,6 +19,7 @@ This is the second commit. file0 | 3 +++ file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
@@ -77,6 +78,7 @@ Content-Transfer-Encoding: 8bit dir/sub | 2 ++ file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
t/t4013/diff.format-patch_--attach_--stdout_initial..side +1 -0
@@ -17,6 +17,7 @@ Content-Transfer-Encoding: 8bit file0 | 3 +++ file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
t/t4013/diff.format-patch_--stdout_initial..master +3 -0
@@ -10,6 +10,7 @@ This is the second commit. file0 | 3 +++ file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -53,6 +54,7 @@ Subject: [PATCH] Third dir/sub | 2 ++ file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 file1 diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
@@ -87,6 +89,7 @@ Subject: [PATCH] Side file0 | 3 +++ file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 file3 diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--stdout_initial..master^ +2 -0
@@ -10,6 +10,7 @@ This is the second commit. file0 | 3 +++ file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -53,6 +54,7 @@ Subject: [PATCH] Third dir/sub | 2 ++ file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 file1 diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
t/t4013/diff.format-patch_--stdout_initial..side +1 -0
@@ -9,6 +9,7 @@ Subject: [PATCH] Side file0 | 3 +++ file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 file3 diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
Re: [PATCH] Add --summary to git-format-patch by default
Quoted 3 lines · Junio C Hamano
This adds --summary output in addition to the --stat to the output from git-format-patch by default.
Opinions?
This is the right thing to do. format-patch should default to both --summary and --stat.
Signature · 1 line
Shawn.
PATCH 1/1 git-format-patch: make --binary on by default
In reply to Junio C HamanoIt does not make much sense to generate a patch that cannot be applied. If --text is specified on the command line it still takes precedence.
---
* I would opt not to make "git am --binary" the default for now. Even with this change, sending binary patch over e-mail is unusual as it is harder to review --- I think it makes sense to error out by default and draw attention from the person who is applying the patch rather than accepting binary patch automatically as if nothing unusual happened.
builtin-log.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
builtin-log.c +3 -0
@@ -470,6 +470,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_DIFFSTAT |DIFF_FORMAT_SUMMARY |DIFF_FORMAT_PATCH ; +if (!rev.diffopt.text) + rev.diffopt.binary =1 ; +if (!output_directory) output_directory = prefix;
Signature · 1 line
1.5.0.rc1.gde38
PATCH 1/1 Changes to e-mailed patch handling in v1.5.0
This applies to the draft v1.5.0 release notes in 'todo' branch and summarizes the changes my patches to format-patch bring in.
I am neutral about changing the default suffix from .txt to .patch; comments?
v1.5.0.txt +15 -0
@@ -268,6 +268,21 @@ Updates in v1.5.0 since v1.4.4 series excuse us for this very minor one-time inconvenience. +* e-mailed patches + + - See the above I18n section. + + - git-format-patch now enables --binary without being asked. + git-am does _not_ default to it, as sending binary patch via + e-mail is unusual and is harder to review than textual + patches and it is prudent to require the person who is + applying the patch to explicitly ask for it. + + - The default suffix for git-format-patch output is now ".patch", + not ".txt". This can be changed with --suffix=.txt option, + or "format.suffix = .txt" in the configuration. + + * Foreign SCM interfaces - git-svn now requires the Perl SVN:: libraries, the
Re: [PATCH - todo] Changes to e-mailed patch handling in v1.5.0
Quoted 2 lines · Junio C Hamano
I am neutral about changing the default suffix from .txt to .patch; comments?
I'm in favour. The extension indicates file type, and gives guidance on the tool that can read it. Though .patch is stored in text it's more than that (c.f. .html) - the text inside it has meaning beyond just the text.
To me, .txt would implies that the file format is in human-language format (i.e. words, sentences, and paragraphs).
Andy
Signature · 2 lines
Dr Andy Parkins, M Eng (hons), MIEE [email protected]
Re: [PATCH - todo] Changes to e-mailed patch handling in v1.5.0
Quoted 11 lines · Andy Parkins
Quoted 2 lines · Junio C Hamano
I am neutral about changing the default suffix from .txt to .patch; comments?
I'm in favour. The extension indicates file type, and gives guidance on the tool that can read it. Though .patch is stored in text it's more than that (c.f. .html) - the text inside it has meaning beyond just the text.
To me, .txt would implies that the file format is in human-language format (i.e. words, sentences, and paragraphs).
Ditto.
Also, Vim nicely detects the From <SHA1> line at the top and thinks that it's an mbox file. With the patch extension it ignores that and gives me my diff coloring again.
~~ Brian
Hi,
Quoted 2 lines · Junio C Hamano
* I think this is incompatible with --ignore-if-upstream, which I haven't bothered to look into yet.
Uhm. What exactly _would_ be upstream?
At the moment, for "--ignore-if-in-upstream" we handle _only_ ranges (a..b), where we treat the left part as the upstream, so we first parse all the diffs in b..a, and then ignore all commits in a..b which have an already-seen diff hash.
However, if we want to do the logical analogue with "-22 HEAD", the equivalent to b..a would trivially contain no commits at all.
Quoted 1 line
Likes, dislikes?
It sure is supported by the principle of least surprise.
Ciao,
Dscho