{"thread":{"id":"18373","subject":"[PATCH] format-patch: Respect --quiet option","startedAt":"2009-03-18T17:00:45Z","lastAt":"2009-03-18T17:00:45Z","messageCount":1,"participants":["Nate Case"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"108392","messageId":"1237395645-22085-1-git-send-email-ncase@xes-inc.com","threadId":"18373","inReplyTo":null,"subject":"[PATCH] format-patch: Respect --quiet option","fromName":"Nate Case","fromEmail":"ncase@xes-inc.com","sentAt":"2009-03-18T17:00:45Z","receivedAt":"2009-03-18T17:00:45Z","isPatch":true,"sender":{"key":"ncase@xes-inc.com","avatar":null},"body":"Hide the patch filename output from 'git format-patch' when --quiet\nis used.  The man pages suggested that this should have already worked.\n\nSigned-off-by: Nate Case <ncase@xes-inc.com>\n---\n builtin-log.c |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 8684fcd..8af55d2 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -573,7 +573,7 @@ static FILE *realstdout = NULL;\n static const char *output_directory = NULL;\n static int outdir_offset;\n \n-static int reopen_stdout(const char *oneline, int nr, int total)\n+static int reopen_stdout(const char *oneline, int nr, struct rev_info *rev)\n {\n \tchar filename[PATH_MAX];\n \tint len = 0;\n@@ -598,7 +598,9 @@ static int reopen_stdout(const char *oneline, int nr, int total)\n \t\tstrcpy(filename + len, fmt_patch_suffix);\n \t}\n \n-\tfprintf(realstdout, \"%s\\n\", filename + outdir_offset);\n+\tif (!DIFF_OPT_TST(&rev->diffopt, QUIET))\n+\t\tfprintf(realstdout, \"%s\\n\", filename + outdir_offset);\n+\n \tif (freopen(filename, \"w\", stdout) == NULL)\n \t\treturn error(\"Cannot open patch file %s\",filename);\n \n@@ -687,7 +689,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \t\tdie(\"Cover letter needs email format\");\n \n \tif (!use_stdout && reopen_stdout(numbered_files ?\n-\t\t\t\tNULL : \"cover-letter\", 0, rev->total))\n+\t\t\t\tNULL : \"cover-letter\", 0, rev))\n \t\treturn;\n \n \thead_sha1 = sha1_to_hex(head->object.sha1);\n@@ -1106,7 +1108,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t}\n \t\tif (!use_stdout && reopen_stdout(numbered_files ? NULL :\n \t\t\t\tget_oneline_for_filename(commit, keep_subject),\n-\t\t\t\trev.nr, rev.total))\n+\t\t\t\trev.nr, &rev))\n \t\t\tdie(\"Failed to create output files\");\n \t\tshown = log_tree_commit(&rev, commit);\n \t\tfree(commit->buffer);\n-- \n1.6.0.2\n"}]}