From 0d3aa94e96e09660cb8b207cc044a1e466c0671f Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Thu, 1 Sep 2016 07:43:50 -0700 Subject: [PATCH] format: Don't number a single patch with no cover letter Use "PATCH" rather than "PATCH 1/1" for that case. --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d1c0a2e78a39a143216719092a1c25005b9ff83a..fc6df848cb5db044a6af8cd8e192f26eee9317ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1202,7 +1202,12 @@ fn format(out: &mut Output, repo: &Repository, m: &ArgMatches) -> Result<()> { try!(writeln!(out, "From: {} <{}>", committer_name, committer_email)); } try!(writeln!(out, "Date: {}", date_822(commit_author.when()))); - try!(writeln!(out, "Subject: [{} {}/{}] {}\n", subject_patch, commit_num+1, commits.len(), subject)); + let m_of_n = if commits.len() == 1 && cover_entry.is_none() { + "".to_string() + } else { + format!(" {}/{}", commit_num+1, commits.len()) + }; + try!(writeln!(out, "Subject: [{}{}] {}\n", subject_patch, m_of_n, subject)); if !no_from && (commit_author_name != committer_name || commit_author_email != committer_email) { try!(writeln!(out, "From: {} <{}>\n", commit_author_name, commit_author_email));