{"thread":{"id":"22834","subject":"[PATCH 2/4] git-push: squelch advice message if in --porcelain mode","startedAt":"2010-02-26T19:50:06Z","lastAt":"2010-02-26T20:04:27Z","messageCount":6,"participants":["Larry D'Anna","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"135765","messageId":"cover.1267211537.git.larry@elder-gods.org","threadId":"22834","inReplyTo":null,"subject":"[PATCH 0/4] ld/push-porcelain","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-26T19:50:06Z","receivedAt":"2010-02-26T19:50:06Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"\nI'm reposing this series to restart discussion on it. It's currently listed as\nstalled.  The only change versus what's in pu is that this one doesn't mess with\nthe semantics of --quiet.  \n\nSo, what does it need?\n\n\nLarry D'Anna (4):\n  git-push: fix an error message so it goes to stderr\n  git-push: squelch advice message if in --porcelain mode\n  git-push: send \"To <remoteurl>\" messages to the standard output in\n    --porcelain mode\n  git-push: make git push --dry-run --porcelain exit with status 0 even\n    if updates will be rejected\n\n builtin-push.c      |   11 ++++++++---\n builtin-send-pack.c |    4 ++++\n send-pack.h         |    1 +\n transport.c         |    6 ++++--\n 4 files changed, 17 insertions(+), 5 deletions(-)\n"},{"id":"135767","messageId":"06e8e98b7ea63061e59e74c42f7d73cb00e579f6.1267211537.git.larry@elder-gods.org","threadId":"22834","inReplyTo":"cover.1267211537.git.larry@elder-gods.org","subject":"[PATCH 1/4] git-push: fix an error message so it goes to stderr","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-26T19:50:07Z","receivedAt":"2010-02-26T19:50:07Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"These sort of messages typically go to the standard error.\n\nSigned-off-by: Larry D'Anna <larry@elder-gods.org>\n---\n builtin-push.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 5633f0a..0a27072 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -124,9 +124,9 @@ static int push_with_options(struct transport *transport, int flags)\n \t\treturn 0;\n \n \tif (nonfastforward && advice_push_nonfastforward) {\n-\t\tprintf(\"To prevent you from losing history, non-fast-forward updates were rejected\\n\"\n-\t\t       \"Merge the remote changes before pushing again.  See the 'Note about\\n\"\n-\t\t       \"fast-forwards' section of 'git push --help' for details.\\n\");\n+\t\tfprintf(stderr, \"To prevent you from losing history, non-fast-forward updates were rejected\\n\"\n+\t\t\t\t\"Merge the remote changes before pushing again.  See the 'Note about\\n\"\n+\t\t\t\t\"fast-forwards' section of 'git push --help' for details.\\n\");\n \t}\n \n \treturn 1;\n-- \n1.7.0.rc2.40.g7d8aa\n"},{"id":"135764","messageId":"75b6d65f8028407cc1e8244a57823b3d87c520f1.1267211537.git.larry@elder-gods.org","threadId":"22834","inReplyTo":"cover.1267211537.git.larry@elder-gods.org","subject":"[PATCH 2/4] git-push: squelch advice message if in --porcelain mode","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-26T19:50:08Z","receivedAt":"2010-02-26T19:50:08Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"By default, git-push may give the user a verbose advice message if a ref is\nrejected for not being a fast-forward.  This patch squelches that message for\n--porcelain mode.\n\nSigned-off-by: Larry D'Anna <larry@elder-gods.org>\n---\n builtin-push.c |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 0a27072..aacba45 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -226,6 +226,11 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \tgit_config(git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, push_usage, 0);\n \n+\tif (flags & TRANSPORT_PUSH_PORCELAIN) {\n+\t\t/* Do not give advice messages to Porcelain scripts */\n+\t\tadvice_push_nonfastforward = 0;\n+\t}\n+\n \tif (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))\n \t\tdie(\"--delete is incompatible with --all, --mirror and --tags\");\n \tif (deleterefs && argc < 2)\n-- \n1.7.0.rc2.40.g7d8aa\n"},{"id":"135768","messageId":"f500555aab2c44879c159e80e5388e965848bb59.1267211537.git.larry@elder-gods.org","threadId":"22834","inReplyTo":"cover.1267211537.git.larry@elder-gods.org","subject":"[PATCH 3/4] git-push: send \"To <remoteurl>\" messages to the standard output in --porcelain mode","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-26T19:50:09Z","receivedAt":"2010-02-26T19:50:09Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"git-push prints the line \"To <remoteurl>\" before above each of the ref status\nlines.  In --porcelain mode, these \"To <remoteurl>\" lines go to the standard\nerror, but the ref status lines go to the standard output.  This makes it\ndifficult for the process reading standard output to know which ref status lines\ncorrespond to which remote.  This patch sends the \"To <remoteurl>\" lines to the\nthe standard output instead.\n\nSigned-off-by: Larry D'Anna <larry@elder-gods.org>\n---\n transport.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 08e4fa0..32885f7 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -675,7 +675,7 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)\n static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)\n {\n \tif (!count)\n-\t\tfprintf(stderr, \"To %s\\n\", dest);\n+\t\tfprintf(porcelain ? stdout : stderr, \"To %s\\n\", dest);\n \n \tswitch(ref->status) {\n \tcase REF_STATUS_NONE:\n-- \n1.7.0.rc2.40.g7d8aa\n"},{"id":"135766","messageId":"86338fdce80769f0a2d6dddc6436f8168f17d29d.1267211537.git.larry@elder-gods.org","threadId":"22834","inReplyTo":"cover.1267211537.git.larry@elder-gods.org","subject":"[PATCH 4/4] git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejected","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-26T19:50:10Z","receivedAt":"2010-02-26T19:50:10Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"The script calling git push --dry-run --porcelain can see clearly from the\noutput that the updates will be rejected.  However, it will probably need to\ndistinguish this condition from the push failing for other reasons, such as the\nremote not being reachable.\n\nSigned-off-by: Larry D'Anna <larry@elder-gods.org>\n---\n builtin-send-pack.c |    4 ++++\n send-pack.h         |    1 +\n transport.c         |    4 +++-\n 3 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-send-pack.c b/builtin-send-pack.c\nindex 2183a47..2bf3d43 100644\n--- a/builtin-send-pack.c\n+++ b/builtin-send-pack.c\n@@ -510,6 +510,10 @@ int send_pack(struct send_pack_args *args,\n \n \tif (ret < 0)\n \t\treturn ret;\n+\n+\tif (args->porcelain && args->dry_run)\n+\t\treturn 0;\n+\n \tfor (ref = remote_refs; ref; ref = ref->next) {\n \t\tswitch (ref->status) {\n \t\tcase REF_STATUS_NONE:\ndiff --git a/send-pack.h b/send-pack.h\nindex 28141ac..60b4ba6 100644\n--- a/send-pack.h\n+++ b/send-pack.h\n@@ -4,6 +4,7 @@\n struct send_pack_args {\n \tunsigned verbose:1,\n \t\tquiet:1,\n+\t\tporcelain:1,\n \t\tsend_mirror:1,\n \t\tforce_update:1,\n \t\tuse_thin_pack:1,\ndiff --git a/transport.c b/transport.c\nindex 32885f7..8291621 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -791,6 +791,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re\n \targs.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE);\n \targs.quiet = !!(flags & TRANSPORT_PUSH_QUIET);\n \targs.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);\n+\targs.porcelain = !!(flags & TRANSPORT_PUSH_PORCELAIN);\n \n \tret = send_pack(&args, data->fd, data->conn, remote_refs,\n \t\t\t&data->extra_have);\n@@ -1055,7 +1056,8 @@ int transport_push(struct transport *transport,\n \t\tret = transport->push_refs(transport, remote_refs, flags);\n \t\terr = push_had_errors(remote_refs);\n \n-\t\tret |= err;\n+\t\tif ( !(pretend && porcelain) )\n+\t\t\tret |= err;\n \n \t\tif (!quiet || err)\n \t\t\tprint_push_status(transport->url, remote_refs,\n-- \n1.7.0.rc2.40.g7d8aa\n"},{"id":"135769","messageId":"7vtyt3sr04.fsf@alter.siamese.dyndns.org","threadId":"22834","inReplyTo":"75b6d65f8028407cc1e8244a57823b3d87c520f1.1267211537.git.larry@elder-gods.org","subject":"Re: [PATCH 2/4] git-push: squelch advice message if in --porcelain mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-26T20:04:27Z","receivedAt":"2010-02-26T20:04:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I thought that the previous discussion thread establish that [PATCH 2/4]\nis no longer wanted, as long as we send the advice message to the standard\nerror output (which is done by [PATCH 1/4]---by the way, do not call that\n\"an error message\").\n"}]}