{"thread":{"id":"43043","subject":"Re: [PATCH] checkout: do not mention detach advice for explicit --detach option","startedAt":"2016-08-10T18:05:35Z","lastAt":"2016-08-11T18:09:43Z","messageCount":5,"participants":["Junio C Hamano","Jonathan Nieder","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"293560","messageId":"xmqqd1lg5wsq.fsf@gitster.mtv.corp.google.com","threadId":"43043","inReplyTo":"20160810172800.23575-1-sbeller@google.com","subject":"Re: [PATCH] checkout: do not mention detach advice for explicit --detach option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-10T18:00:21Z","receivedAt":"2016-08-10T18:05:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> When a user asked for a detached HEAD specifically with `--detach`,\n> we do not need to give advice on what a detached HEAD state entails as\n> we can assume they know what they're getting into as they asked for it.\n\nMakes sense; I agree that \"Don't be noisy if you did exactly what\nyou were told to do.\" is a very sensible principle.\n\n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n>  builtin/checkout.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/checkout.c b/builtin/checkout.c\n> index 27c1a05..fa2dce5 100644\n> --- a/builtin/checkout.c\n> +++ b/builtin/checkout.c\n> @@ -655,7 +655,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n>  \t\tupdate_ref(msg.buf, \"HEAD\", new->commit->object.oid.hash, NULL,\n>  \t\t\t   REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);\n>  \t\tif (!opts->quiet) {\n> -\t\t\tif (old->path && advice_detached_head)\n> +\t\t\tif (old->path && advice_detached_head && !opts->force_detach)\n>  \t\t\t\tdetach_advice(new->name);\n>  \t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new->commit);\n>  \t\t}\n"},{"id":"293580","messageId":"20160810173218.GB14758@google.com","threadId":"43043","inReplyTo":"20160810172800.23575-1-sbeller@google.com","subject":"Re: [PATCH] checkout: do not mention detach advice for explicit --detach option","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2016-08-10T17:32:18Z","receivedAt":"2016-08-10T18:42:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Stefan Beller wrote:\n\n> When a user asked for a detached HEAD specifically with `--detach`,\n> we do not need to give advice on what a detached HEAD state entails as\n> we can assume they know what they're getting into as they asked for it.\n\nExample? Tests?\n\n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n>  builtin/checkout.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nI like the idea. Thanks for writing it.\n\n> diff --git a/builtin/checkout.c b/builtin/checkout.c\n> index 27c1a05..fa2dce5 100644\n> --- a/builtin/checkout.c\n> +++ b/builtin/checkout.c\n> @@ -655,7 +655,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n>  \t\tupdate_ref(msg.buf, \"HEAD\", new->commit->object.oid.hash, NULL,\n>  \t\t\t   REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);\n>  \t\tif (!opts->quiet) {\n> -\t\t\tif (old->path && advice_detached_head)\n> +\t\t\tif (old->path && advice_detached_head && !opts->force_detach)\n>  \t\t\t\tdetach_advice(new->name);\n>  \t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new->commit);\n>  \t\t}\n> -- \n"},{"id":"293630","messageId":"20160810172800.23575-1-sbeller@google.com","threadId":"43043","inReplyTo":null,"subject":"[PATCH] checkout: do not mention detach advice for explicit --detach option","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-08-10T17:28:00Z","receivedAt":"2016-08-10T19:55:25Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"When a user asked for a detached HEAD specifically with `--detach`,\nwe do not need to give advice on what a detached HEAD state entails as\nwe can assume they know what they're getting into as they asked for it.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n builtin/checkout.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 27c1a05..fa2dce5 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -655,7 +655,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \t\tupdate_ref(msg.buf, \"HEAD\", new->commit->object.oid.hash, NULL,\n \t\t\t   REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);\n \t\tif (!opts->quiet) {\n-\t\t\tif (old->path && advice_detached_head)\n+\t\t\tif (old->path && advice_detached_head && !opts->force_detach)\n \t\t\t\tdetach_advice(new->name);\n \t\t\tdescribe_detached_head(_(\"HEAD is now at\"), new->commit);\n \t\t}\n-- \n2.9.2.665.gdb8bb2f\n\n"},{"id":"293675","messageId":"CAGZ79kb+PvU5yKfr9D0j13JWeo1mqcW=CWvVD88UrEeg1WBTpQ@mail.gmail.com","threadId":"43043","inReplyTo":"20160810173218.GB14758@google.com","subject":"Re: [PATCH] checkout: do not mention detach advice for explicit --detach option","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-08-10T22:46:11Z","receivedAt":"2016-08-10T22:46:16Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Aug 10, 2016 at 10:32 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Stefan Beller wrote:\n>\n>> When a user asked for a detached HEAD specifically with `--detach`,\n>> we do not need to give advice on what a detached HEAD state entails as\n>> we can assume they know what they're getting into as they asked for it.\n>\n> Example? Tests?\n\nThere are no tests for the advice things IIUC.\nWhat do you mean by example?\n\nStefan\n"},{"id":"293773","messageId":"xmqqzioj18kg.fsf@gitster.mtv.corp.google.com","threadId":"43043","inReplyTo":"CAGZ79kb+PvU5yKfr9D0j13JWeo1mqcW=CWvVD88UrEeg1WBTpQ@mail.gmail.com","subject":"Re: [PATCH] checkout: do not mention detach advice for explicit --detach option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-11T18:09:35Z","receivedAt":"2016-08-11T18:09:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> On Wed, Aug 10, 2016 at 10:32 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> Stefan Beller wrote:\n>>\n>>> When a user asked for a detached HEAD specifically with `--detach`,\n>>> we do not need to give advice on what a detached HEAD state entails as\n>>> we can assume they know what they're getting into as they asked for it.\n>>\n>> Example? Tests?\n>\n> There are no tests for the advice things IIUC.\n\nThere seem to already be tests that explicitly sets advice.* to true\nlike in t7201 and t7512, but even if there weren't any existing\nones, it would be appropriate to make sure that an explicit --detach\ndoes not trigger the advice, even when advice.detachedHEAD left\nunconfigured (or set to true), given that doing so is the whole\npurpose of this patch, I would think.\n\n"}]}