{"thread":{"id":"60719","subject":"[PATCH] branch: error description when deleting a not fully merged branch","startedAt":"2024-01-10T14:55:38Z","lastAt":"2024-01-12T21:19:12Z","messageCount":12,"participants":["Rubén Justo","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"486532","messageId":"04c3556f-0242-4ac3-b94a-be824cd2004a@gmail.com","threadId":"60719","inReplyTo":null,"subject":"[PATCH] branch: error description when deleting a not fully merged branch","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-10T14:55:28Z","receivedAt":"2024-01-10T14:55:38Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"The error message we show when the user tries to delete a not fully\nmerged branch describes the error and gives a hint to the user:\n\n\terror: the branch 'foo' is not fully merged.\n\tIf you are sure you want to delete it, run 'git branch -D foo'.\n\nLet's move the hint part so that it takes advantage of the advice\nmachinery:\n\n\terror: the branch 'foo' is not fully merged\n\thint: If you are sure you want to delete it, run 'git branch -D foo'\n\thint: Disable this message with \"git config advice.forceDeleteBranch false\"\n\nSigned-off-by: Rubén Justo <rjusto@gmail.com>\n---\n\nThis change is a pending NEEDSWORK from a recent series about adjusting\nthe error messages in branch.c\n\nUnfortunately the full message now becomes a three line message.\n\nHopefully we can find a way in the near future to keep it at two.\n\n Documentation/config/advice.txt | 3 +++\n advice.c                        | 1 +\n advice.h                        | 3 ++-\n builtin/branch.c                | 9 ++++++---\n 4 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt\nindex 4d7e5d8759..5814d659b9 100644\n--- a/Documentation/config/advice.txt\n+++ b/Documentation/config/advice.txt\n@@ -142,4 +142,7 @@ advice.*::\n \t\tAdvice shown when a user tries to create a worktree from an\n \t\tinvalid reference, to instruct how to create a new unborn\n \t\tbranch instead.\n+\tforceDeleteBranch::\n+\t\tAdvice shown when a user tries to delete a not fully merged\n+\t\tbranch without the force option set.\n --\ndiff --git a/advice.c b/advice.c\nindex 50c79443ba..e91f5d7ab8 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -79,6 +79,7 @@ static struct {\n \t[ADVICE_UPDATE_SPARSE_PATH]\t\t\t= { \"updateSparsePath\", 1 },\n \t[ADVICE_WAITING_FOR_EDITOR]\t\t\t= { \"waitingForEditor\", 1 },\n \t[ADVICE_WORKTREE_ADD_ORPHAN]\t\t\t= { \"worktreeAddOrphan\", 1 },\n+\t[ADVICE_FORCE_DELETE_BRANCH]\t\t\t= { \"forceDeleteBranch\", 1 },\n };\n \n static const char turn_off_instructions[] =\ndiff --git a/advice.h b/advice.h\nindex 2affbe1426..5bef900142 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -10,7 +10,7 @@ struct string_list;\n  * Add the new config variable to Documentation/config/advice.txt.\n  * Call advise_if_enabled to print your advice.\n  */\n- enum advice_type {\n+enum advice_type {\n \tADVICE_ADD_EMBEDDED_REPO,\n \tADVICE_ADD_EMPTY_PATHSPEC,\n \tADVICE_ADD_IGNORED_FILE,\n@@ -50,6 +50,7 @@ struct string_list;\n \tADVICE_WAITING_FOR_EDITOR,\n \tADVICE_SKIPPED_CHERRY_PICKS,\n \tADVICE_WORKTREE_ADD_ORPHAN,\n+\tADVICE_FORCE_DELETE_BRANCH,\n };\n \n int git_default_advice_config(const char *var, const char *value);\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 0a32d1b6c8..2240433bc8 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -24,6 +24,7 @@\n #include \"ref-filter.h\"\n #include \"worktree.h\"\n #include \"help.h\"\n+#include \"advice.h\"\n #include \"commit-reach.h\"\n \n static const char * const builtin_branch_usage[] = {\n@@ -190,9 +191,11 @@ static int check_branch_commit(const char *branchname, const char *refname,\n \t\treturn -1;\n \t}\n \tif (!force && !branch_merged(kinds, branchname, rev, head_rev)) {\n-\t\terror(_(\"the branch '%s' is not fully merged.\\n\"\n-\t\t      \"If you are sure you want to delete it, \"\n-\t\t      \"run 'git branch -D %s'\"), branchname, branchname);\n+\t\terror(_(\"the branch '%s' is not fully merged\"),\n+\t\t      branchname);\n+\t\tadvise_if_enabled(ADVICE_FORCE_DELETE_BRANCH,\n+\t\t\t\t  _(\"If you are sure you want to delete it, \"\n+\t\t\t\t  \"run 'git branch -D %s'\"), branchname);\n \t\treturn -1;\n \t}\n \treturn 0;\n-- \n2.42.0\n"},{"id":"486546","messageId":"xmqqbk9tcc57.fsf@gitster.g","threadId":"60719","inReplyTo":"04c3556f-0242-4ac3-b94a-be824cd2004a@gmail.com","subject":"Re: [PATCH] branch: error description when deleting a not fully merged branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-10T17:48:52Z","receivedAt":"2024-01-10T17:48:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rubén Justo <rjusto@gmail.com> writes:\n\n> The error message we show when the user tries to delete a not fully\n> merged branch describes the error and gives a hint to the user:\n>\n> \terror: the branch 'foo' is not fully merged.\n> \tIf you are sure you want to delete it, run 'git branch -D foo'.\n>\n> Let's move the hint part so that it takes advantage of the advice\n> machinery:\n>\n> \terror: the branch 'foo' is not fully merged\n> \thint: If you are sure you want to delete it, run 'git branch -D foo'\n> \thint: Disable this message with \"git config advice.forceDeleteBranch false\"\n\nThis is probably one sensible step forward, so let's queue it as-is.\n\nBut with reservations for longer-term future direction.  Stepping\nback a bit, when 'foo' is not fully merged and the user used \"branch\n-d\" on it, is it sensible for us to suggest use of \"branch -D\"?\n\nEspecially now this is a \"hint\" to help less experienced folks, it\nmay be helpful to suggest how the user can answer \"If you are sure\nyou want to delete\" part.  As this knows what unique commits on the\nbranch being deleted are about to be lost, one way to do so may be\nto tell the user about them (\"you are about to lose 'branch: error\ndescription when deleting a not fully merged branch' and other 47\ncommits that are not merged the target branch 'main'\", for example).\n\nAnother possibility is to suggest merging the branch into the\ntarget, instead of suggesting a destructive \"deletion\", but I\nsuspect that it goes too far second-guessing the end-user intention.\n\nThanks.\n\n> Signed-off-by: Rubén Justo <rjusto@gmail.com>\n> ---\n>\n> This change is a pending NEEDSWORK from a recent series about adjusting\n> the error messages in branch.c\n>\n> Unfortunately the full message now becomes a three line message.\n>\n> Hopefully we can find a way in the near future to keep it at two.\n>\n>  Documentation/config/advice.txt | 3 +++\n>  advice.c                        | 1 +\n>  advice.h                        | 3 ++-\n>  builtin/branch.c                | 9 ++++++---\n>  4 files changed, 12 insertions(+), 4 deletions(-)\n>\n> diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt\n> index 4d7e5d8759..5814d659b9 100644\n> --- a/Documentation/config/advice.txt\n> +++ b/Documentation/config/advice.txt\n> @@ -142,4 +142,7 @@ advice.*::\n>  \t\tAdvice shown when a user tries to create a worktree from an\n>  \t\tinvalid reference, to instruct how to create a new unborn\n>  \t\tbranch instead.\n> +\tforceDeleteBranch::\n> +\t\tAdvice shown when a user tries to delete a not fully merged\n> +\t\tbranch without the force option set.\n>  --\n> diff --git a/advice.c b/advice.c\n> index 50c79443ba..e91f5d7ab8 100644\n> --- a/advice.c\n> +++ b/advice.c\n> @@ -79,6 +79,7 @@ static struct {\n>  \t[ADVICE_UPDATE_SPARSE_PATH]\t\t\t= { \"updateSparsePath\", 1 },\n>  \t[ADVICE_WAITING_FOR_EDITOR]\t\t\t= { \"waitingForEditor\", 1 },\n>  \t[ADVICE_WORKTREE_ADD_ORPHAN]\t\t\t= { \"worktreeAddOrphan\", 1 },\n> +\t[ADVICE_FORCE_DELETE_BRANCH]\t\t\t= { \"forceDeleteBranch\", 1 },\n>  };\n>  \n>  static const char turn_off_instructions[] =\n> diff --git a/advice.h b/advice.h\n> index 2affbe1426..5bef900142 100644\n> --- a/advice.h\n> +++ b/advice.h\n> @@ -10,7 +10,7 @@ struct string_list;\n>   * Add the new config variable to Documentation/config/advice.txt.\n>   * Call advise_if_enabled to print your advice.\n>   */\n> - enum advice_type {\n> +enum advice_type {\n>  \tADVICE_ADD_EMBEDDED_REPO,\n>  \tADVICE_ADD_EMPTY_PATHSPEC,\n>  \tADVICE_ADD_IGNORED_FILE,\n> @@ -50,6 +50,7 @@ struct string_list;\n>  \tADVICE_WAITING_FOR_EDITOR,\n>  \tADVICE_SKIPPED_CHERRY_PICKS,\n>  \tADVICE_WORKTREE_ADD_ORPHAN,\n> +\tADVICE_FORCE_DELETE_BRANCH,\n>  };\n>  \n>  int git_default_advice_config(const char *var, const char *value);\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index 0a32d1b6c8..2240433bc8 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -24,6 +24,7 @@\n>  #include \"ref-filter.h\"\n>  #include \"worktree.h\"\n>  #include \"help.h\"\n> +#include \"advice.h\"\n>  #include \"commit-reach.h\"\n>  \n>  static const char * const builtin_branch_usage[] = {\n> @@ -190,9 +191,11 @@ static int check_branch_commit(const char *branchname, const char *refname,\n>  \t\treturn -1;\n>  \t}\n>  \tif (!force && !branch_merged(kinds, branchname, rev, head_rev)) {\n> -\t\terror(_(\"the branch '%s' is not fully merged.\\n\"\n> -\t\t      \"If you are sure you want to delete it, \"\n> -\t\t      \"run 'git branch -D %s'\"), branchname, branchname);\n> +\t\terror(_(\"the branch '%s' is not fully merged\"),\n> +\t\t      branchname);\n> +\t\tadvise_if_enabled(ADVICE_FORCE_DELETE_BRANCH,\n> +\t\t\t\t  _(\"If you are sure you want to delete it, \"\n> +\t\t\t\t  \"run 'git branch -D %s'\"), branchname);\n>  \t\treturn -1;\n>  \t}\n>  \treturn 0;\n"},{"id":"486566","messageId":"xmqqr0io980h.fsf@gitster.g","threadId":"60719","inReplyTo":"xmqqbk9tcc57.fsf@gitster.g","subject":"Re: [PATCH] branch: error description when deleting a not fully merged branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-10T21:46:22Z","receivedAt":"2024-01-10T21:46:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> This is probably one sensible step forward, so let's queue it as-is.\n>\n> But with reservations for longer-term future direction.  Stepping\n> back a bit, when 'foo' is not fully merged and the user used \"branch\n> -d\" on it, is it sensible for us to suggest use of \"branch -D\"?\n>\n> Especially now this is a \"hint\" to help less experienced folks, it\n> may be helpful to suggest how the user can answer \"If you are sure\n> you want to delete\" part.  As this knows what unique commits on the\n> branch being deleted are about to be lost, one way to do so may be\n> to tell the user about them (\"you are about to lose 'branch: error\n> description when deleting a not fully merged branch' and other 47\n> commits that are not merged the target branch 'main'\", for example).\n>\n> Another possibility is to suggest merging the branch into the\n> target, instead of suggesting a destructive \"deletion\", but I\n> suspect that it goes too far second-guessing the end-user intention.\n\nThe longer-term concerns aside, if you are inclined, we might want\nto have this as a two step series, where [1/2] does a clean-up of\nexisting source file, i.e. losing the unwanted leading space from \"\nenum advice_type {\" in advice.h and sort the advice.*:: list in\nDocumentation/config/advice.txt.  It is optional to sort the\nadvice_setting[] list in advice.c and \"enum advice_type\" in\nadvice.h, as they are not end-user facing, and we should be using\nthe defined constant without relying on their exact values.  But\nkeeping the config/advice.txt sorted would help readers more easily\nlocate which configuration variable to use to squelch a message.\n\nAnd [2/2] does the rest.\n\nAlso I forgot that in the version I queued, I fixed the title to\n\n    branch: make the advice to force-deleting a conditional one\n\nThanks.\n\n"},{"id":"486622","messageId":"4aedc15c-4b3f-4f5e-abea-581b501600f8@gmail.com","threadId":"60719","inReplyTo":"04c3556f-0242-4ac3-b94a-be824cd2004a@gmail.com","subject":"[PATCH v2 0/3] branch: error description when deleting a not fully merged branch","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-11T12:20:55Z","receivedAt":"2024-01-11T12:21:02Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"The error message we show when the user tries to delete a not fully\nmerged branch describes the error and gives a hint to the user:\n\n\terror: the branch 'foo' is not fully merged.\n\tIf you are sure you want to delete it, run 'git branch -D foo'.\n\nLet's move the hint part so that it is displayed using the advice\nmachinery:\n\n\terror: the branch 'foo' is not fully merged\n\thint: If you are sure you want to delete it, run 'git branch -D foo'\n\thint: Disable this message with \"git config advice.forceDeleteBranch false\"\n\nRubén Justo (3):\n  advice: sort the advice related lists\n  advice: fix an unexpected leading space\n  branch: make the advice to force-deleting a conditional one\n\n Documentation/config/advice.txt | 157 ++++++++++++++++----------------\n advice.c                        |  14 ++-\n advice.h                        |  15 +--\n builtin/branch.c                |   8 +-\n 4 files changed, 99 insertions(+), 95 deletions(-)\n\n-- \n2.42.0\n\n"},{"id":"486623","messageId":"17d0287d-ffe6-4682-9a01-ce70ea94a593@gmail.com","threadId":"60719","inReplyTo":"4aedc15c-4b3f-4f5e-abea-581b501600f8@gmail.com","subject":"[PATCH v2 1/3] advice: sort the advice related lists","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-11T12:40:01Z","receivedAt":"2024-01-11T12:40:12Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"Let's keep the advice related lists sorted to make them more\ndigestible.\n\nA multi-line comment has also been changed; that produces the unexpected\n'insertion != deletion' in this supposedly 'only sort lines' commit.\n\nSigned-off-by: Rubén Justo <rjusto@gmail.com>\n---\n Documentation/config/advice.txt | 154 ++++++++++++++++----------------\n advice.c                        |  13 ++-\n advice.h                        |  12 +--\n 3 files changed, 88 insertions(+), 91 deletions(-)\n\ndiff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt\nindex 4d7e5d8759..e0deaf3144 100644\n--- a/Documentation/config/advice.txt\n+++ b/Documentation/config/advice.txt\n@@ -4,27 +4,56 @@ advice.*::\n \tcan tell Git that you do not need help by setting these to 'false':\n +\n --\n+\taddEmbeddedRepo::\n+\t\tAdvice on what to do when you've accidentally added one\n+\t\tgit repo inside of another.\n+\taddEmptyPathspec::\n+\t\tAdvice shown if a user runs the add command without providing\n+\t\tthe pathspec parameter.\n+\taddIgnoredFile::\n+\t\tAdvice shown if a user attempts to add an ignored file to\n+\t\tthe index.\n+\tamWorkDir::\n+\t\tAdvice that shows the location of the patch file when\n+\t\tlinkgit:git-am[1] fails to apply it.\n \tambiguousFetchRefspec::\n \t\tAdvice shown when a fetch refspec for multiple remotes maps to\n \t\tthe same remote-tracking branch namespace and causes branch\n \t\ttracking set-up to fail.\n+\tcheckoutAmbiguousRemoteBranchName::\n+\t\tAdvice shown when the argument to\n+\t\tlinkgit:git-checkout[1] and linkgit:git-switch[1]\n+\t\tambiguously resolves to a\n+\t\tremote tracking branch on more than one remote in\n+\t\tsituations where an unambiguous argument would have\n+\t\totherwise caused a remote-tracking branch to be\n+\t\tchecked out. See the `checkout.defaultRemote`\n+\t\tconfiguration variable for how to set a given remote\n+\t\tto be used by default in some situations where this\n+\t\tadvice would be printed.\n+\tcommitBeforeMerge::\n+\t\tAdvice shown when linkgit:git-merge[1] refuses to\n+\t\tmerge to avoid overwriting local changes.\n+\tdetachedHead::\n+\t\tAdvice shown when you used\n+\t\tlinkgit:git-switch[1] or linkgit:git-checkout[1]\n+\t\tto move to the detached HEAD state, to instruct how to\n+\t\tcreate a local branch after the fact.\n+\tdiverging::\n+\t\tAdvice shown when a fast-forward is not possible.\n \tfetchShowForcedUpdates::\n \t\tAdvice shown when linkgit:git-fetch[1] takes a long time\n \t\tto calculate forced updates after ref updates, or to warn\n \t\tthat the check is disabled.\n-\tpushUpdateRejected::\n-\t\tSet this variable to 'false' if you want to disable\n-\t\t'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists',\n-\t\t'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate'\n-\t\tsimultaneously.\n-\tpushNonFFCurrent::\n-\t\tAdvice shown when linkgit:git-push[1] fails due to a\n-\t\tnon-fast-forward update to the current branch.\n-\tpushNonFFMatching::\n-\t\tAdvice shown when you ran linkgit:git-push[1] and pushed\n-\t\t'matching refs' explicitly (i.e. you used ':', or\n-\t\tspecified a refspec that isn't your current branch) and\n-\t\tit resulted in a non-fast-forward error.\n+\tignoredHook::\n+\t\tAdvice shown if a hook is ignored because the hook is not\n+\t\tset as executable.\n+\timplicitIdentity::\n+\t\tAdvice on how to set your identity configuration when\n+\t\tyour information is guessed from the system username and\n+\t\tdomain name.\n+\tnestedTag::\n+\t\tAdvice shown if a user attempts to recursively tag a tag object.\n \tpushAlreadyExists::\n \t\tShown when linkgit:git-push[1] rejects an update that\n \t\tdoes not qualify for fast-forwarding (e.g., a tag.)\n@@ -37,6 +66,18 @@ advice.*::\n \t\ttries to overwrite a remote ref that points at an\n \t\tobject that is not a commit-ish, or make the remote\n \t\tref point at an object that is not a commit-ish.\n+\tpushNonFFCurrent::\n+\t\tAdvice shown when linkgit:git-push[1] fails due to a\n+\t\tnon-fast-forward update to the current branch.\n+\tpushNonFFMatching::\n+\t\tAdvice shown when you ran linkgit:git-push[1] and pushed\n+\t\t'matching refs' explicitly (i.e. you used ':', or\n+\t\tspecified a refspec that isn't your current branch) and\n+\t\tit resulted in a non-fast-forward error.\n+\tpushRefNeedsUpdate::\n+\t\tShown when linkgit:git-push[1] rejects a forced update of\n+\t\ta branch when its remote-tracking ref has updates that we\n+\t\tdo not have locally.\n \tpushUnqualifiedRefname::\n \t\tShown when linkgit:git-push[1] gives up trying to\n \t\tguess based on the source and destination refs what\n@@ -44,10 +85,23 @@ advice.*::\n \t\twe can still suggest that the user push to either\n \t\trefs/heads/* or refs/tags/* based on the type of the\n \t\tsource object.\n-\tpushRefNeedsUpdate::\n-\t\tShown when linkgit:git-push[1] rejects a forced update of\n-\t\ta branch when its remote-tracking ref has updates that we\n-\t\tdo not have locally.\n+\tpushUpdateRejected::\n+\t\tSet this variable to 'false' if you want to disable\n+\t\t'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists',\n+\t\t'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate'\n+\t\tsimultaneously.\n+\tresetNoRefresh::\n+\t\tAdvice to consider using the `--no-refresh` option to\n+\t\tlinkgit:git-reset[1] when the command takes more than 2 seconds\n+\t\tto refresh the index after reset.\n+\tresolveConflict::\n+\t\tAdvice shown by various commands when conflicts\n+\t\tprevent the operation from being performed.\n+\trmHints::\n+\t\tIn case of failure in the output of linkgit:git-rm[1],\n+\t\tshow directions on how to proceed from the current state.\n+\tsequencerInUse::\n+\t\tAdvice shown when a sequencer command is already in progress.\n \tskippedCherryPicks::\n \t\tShown when linkgit:git-rebase[1] skips a commit that has already\n \t\tbeen cherry-picked onto the upstream branch.\n@@ -68,76 +122,22 @@ advice.*::\n \t\tAdvise to consider using the `-u` option to linkgit:git-status[1]\n \t\twhen the command takes more than 2 seconds to enumerate untracked\n \t\tfiles.\n-\tcommitBeforeMerge::\n-\t\tAdvice shown when linkgit:git-merge[1] refuses to\n-\t\tmerge to avoid overwriting local changes.\n-\tresetNoRefresh::\n-\t\tAdvice to consider using the `--no-refresh` option to\n-\t\tlinkgit:git-reset[1] when the command takes more than 2 seconds\n-\t\tto refresh the index after reset.\n-\tresolveConflict::\n-\t\tAdvice shown by various commands when conflicts\n-\t\tprevent the operation from being performed.\n-\tsequencerInUse::\n-\t\tAdvice shown when a sequencer command is already in progress.\n-\timplicitIdentity::\n-\t\tAdvice on how to set your identity configuration when\n-\t\tyour information is guessed from the system username and\n-\t\tdomain name.\n-\tdetachedHead::\n-\t\tAdvice shown when you used\n-\t\tlinkgit:git-switch[1] or linkgit:git-checkout[1]\n-\t\tto move to the detached HEAD state, to instruct how to\n-\t\tcreate a local branch after the fact.\n-\tsuggestDetachingHead::\n-\t\tAdvice shown when linkgit:git-switch[1] refuses to detach HEAD\n-\t\twithout the explicit `--detach` option.\n-\tcheckoutAmbiguousRemoteBranchName::\n-\t\tAdvice shown when the argument to\n-\t\tlinkgit:git-checkout[1] and linkgit:git-switch[1]\n-\t\tambiguously resolves to a\n-\t\tremote tracking branch on more than one remote in\n-\t\tsituations where an unambiguous argument would have\n-\t\totherwise caused a remote-tracking branch to be\n-\t\tchecked out. See the `checkout.defaultRemote`\n-\t\tconfiguration variable for how to set a given remote\n-\t\tto be used by default in some situations where this\n-\t\tadvice would be printed.\n-\tamWorkDir::\n-\t\tAdvice that shows the location of the patch file when\n-\t\tlinkgit:git-am[1] fails to apply it.\n-\trmHints::\n-\t\tIn case of failure in the output of linkgit:git-rm[1],\n-\t\tshow directions on how to proceed from the current state.\n-\taddEmbeddedRepo::\n-\t\tAdvice on what to do when you've accidentally added one\n-\t\tgit repo inside of another.\n-\tignoredHook::\n-\t\tAdvice shown if a hook is ignored because the hook is not\n-\t\tset as executable.\n-\twaitingForEditor::\n-\t\tPrint a message to the terminal whenever Git is waiting for\n-\t\teditor input from the user.\n-\tnestedTag::\n-\t\tAdvice shown if a user attempts to recursively tag a tag object.\n \tsubmoduleAlternateErrorStrategyDie::\n \t\tAdvice shown when a submodule.alternateErrorStrategy option\n \t\tconfigured to \"die\" causes a fatal error.\n \tsubmodulesNotUpdated::\n \t\tAdvice shown when a user runs a submodule command that fails\n \t\tbecause `git submodule update --init` was not run.\n-\taddIgnoredFile::\n-\t\tAdvice shown if a user attempts to add an ignored file to\n-\t\tthe index.\n-\taddEmptyPathspec::\n-\t\tAdvice shown if a user runs the add command without providing\n-\t\tthe pathspec parameter.\n+\tsuggestDetachingHead::\n+\t\tAdvice shown when linkgit:git-switch[1] refuses to detach HEAD\n+\t\twithout the explicit `--detach` option.\n \tupdateSparsePath::\n \t\tAdvice shown when either linkgit:git-add[1] or linkgit:git-rm[1]\n \t\tis asked to update index entries outside the current sparse\n \t\tcheckout.\n-\tdiverging::\n-\t\tAdvice shown when a fast-forward is not possible.\n+\twaitingForEditor::\n+\t\tPrint a message to the terminal whenever Git is waiting for\n+\t\teditor input from the user.\n \tworktreeAddOrphan::\n \t\tAdvice shown when a user tries to create a worktree from an\n \t\tinvalid reference, to instruct how to create a new unborn\ndiff --git a/advice.c b/advice.c\nindex 50c79443ba..03322caba0 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -40,12 +40,11 @@ static struct {\n \t[ADVICE_ADD_EMBEDDED_REPO]\t\t\t= { \"addEmbeddedRepo\", 1 },\n \t[ADVICE_ADD_EMPTY_PATHSPEC]\t\t\t= { \"addEmptyPathspec\", 1 },\n \t[ADVICE_ADD_IGNORED_FILE]\t\t\t= { \"addIgnoredFile\", 1 },\n-\t[ADVICE_AM_WORK_DIR] \t\t\t\t= { \"amWorkDir\", 1 },\n \t[ADVICE_AMBIGUOUS_FETCH_REFSPEC]\t\t= { \"ambiguousFetchRefspec\", 1 },\n+\t[ADVICE_AM_WORK_DIR] \t\t\t\t= { \"amWorkDir\", 1 },\n \t[ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME] \t= { \"checkoutAmbiguousRemoteBranchName\", 1 },\n \t[ADVICE_COMMIT_BEFORE_MERGE]\t\t\t= { \"commitBeforeMerge\", 1 },\n \t[ADVICE_DETACHED_HEAD]\t\t\t\t= { \"detachedHead\", 1 },\n-\t[ADVICE_SUGGEST_DETACHING_HEAD]\t\t\t= { \"suggestDetachingHead\", 1 },\n \t[ADVICE_DIVERGING]\t\t\t\t= { \"diverging\", 1 },\n \t[ADVICE_FETCH_SHOW_FORCED_UPDATES]\t\t= { \"fetchShowForcedUpdates\", 1 },\n \t[ADVICE_GRAFT_FILE_DEPRECATED]\t\t\t= { \"graftFileDeprecated\", 1 },\n@@ -56,15 +55,12 @@ static struct {\n \t[ADVICE_PUSH_ALREADY_EXISTS]\t\t\t= { \"pushAlreadyExists\", 1 },\n \t[ADVICE_PUSH_FETCH_FIRST]\t\t\t= { \"pushFetchFirst\", 1 },\n \t[ADVICE_PUSH_NEEDS_FORCE]\t\t\t= { \"pushNeedsForce\", 1 },\n-\t[ADVICE_PUSH_REF_NEEDS_UPDATE]\t\t\t= { \"pushRefNeedsUpdate\", 1 },\n-\n-\t/* make this an alias for backward compatibility */\n-\t[ADVICE_PUSH_UPDATE_REJECTED_ALIAS]\t\t= { \"pushNonFastForward\", 1 },\n-\n \t[ADVICE_PUSH_NON_FF_CURRENT]\t\t\t= { \"pushNonFFCurrent\", 1 },\n \t[ADVICE_PUSH_NON_FF_MATCHING]\t\t\t= { \"pushNonFFMatching\", 1 },\n+\t[ADVICE_PUSH_REF_NEEDS_UPDATE]\t\t\t= { \"pushRefNeedsUpdate\", 1 },\n \t[ADVICE_PUSH_UNQUALIFIED_REF_NAME]\t\t= { \"pushUnqualifiedRefName\", 1 },\n \t[ADVICE_PUSH_UPDATE_REJECTED]\t\t\t= { \"pushUpdateRejected\", 1 },\n+\t[ADVICE_PUSH_UPDATE_REJECTED_ALIAS]\t\t= { \"pushNonFastForward\", 1 }, /* backwards compatibility */\n \t[ADVICE_RESET_NO_REFRESH_WARNING]\t\t= { \"resetNoRefresh\", 1 },\n \t[ADVICE_RESOLVE_CONFLICT]\t\t\t= { \"resolveConflict\", 1 },\n \t[ADVICE_RM_HINTS]\t\t\t\t= { \"rmHints\", 1 },\n@@ -74,8 +70,9 @@ static struct {\n \t[ADVICE_STATUS_AHEAD_BEHIND_WARNING]\t\t= { \"statusAheadBehindWarning\", 1 },\n \t[ADVICE_STATUS_HINTS]\t\t\t\t= { \"statusHints\", 1 },\n \t[ADVICE_STATUS_U_OPTION]\t\t\t= { \"statusUoption\", 1 },\n-\t[ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE] = { \"submoduleAlternateErrorStrategyDie\", 1 },\n \t[ADVICE_SUBMODULES_NOT_UPDATED] \t\t= { \"submodulesNotUpdated\", 1 },\n+\t[ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE] = { \"submoduleAlternateErrorStrategyDie\", 1 },\n+\t[ADVICE_SUGGEST_DETACHING_HEAD]\t\t\t= { \"suggestDetachingHead\", 1 },\n \t[ADVICE_UPDATE_SPARSE_PATH]\t\t\t= { \"updateSparsePath\", 1 },\n \t[ADVICE_WAITING_FOR_EDITOR]\t\t\t= { \"waitingForEditor\", 1 },\n \t[ADVICE_WORKTREE_ADD_ORPHAN]\t\t\t= { \"worktreeAddOrphan\", 1 },\ndiff --git a/advice.h b/advice.h\nindex 2affbe1426..9396bcdcf1 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -14,13 +14,12 @@ struct string_list;\n \tADVICE_ADD_EMBEDDED_REPO,\n \tADVICE_ADD_EMPTY_PATHSPEC,\n \tADVICE_ADD_IGNORED_FILE,\n-\tADVICE_AM_WORK_DIR,\n \tADVICE_AMBIGUOUS_FETCH_REFSPEC,\n+\tADVICE_AM_WORK_DIR,\n \tADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,\n \tADVICE_COMMIT_BEFORE_MERGE,\n \tADVICE_DETACHED_HEAD,\n \tADVICE_DIVERGING,\n-\tADVICE_SUGGEST_DETACHING_HEAD,\n \tADVICE_FETCH_SHOW_FORCED_UPDATES,\n \tADVICE_GRAFT_FILE_DEPRECATED,\n \tADVICE_IGNORED_HOOK,\n@@ -32,23 +31,24 @@ struct string_list;\n \tADVICE_PUSH_NEEDS_FORCE,\n \tADVICE_PUSH_NON_FF_CURRENT,\n \tADVICE_PUSH_NON_FF_MATCHING,\n+\tADVICE_PUSH_REF_NEEDS_UPDATE,\n \tADVICE_PUSH_UNQUALIFIED_REF_NAME,\n-\tADVICE_PUSH_UPDATE_REJECTED_ALIAS,\n \tADVICE_PUSH_UPDATE_REJECTED,\n-\tADVICE_PUSH_REF_NEEDS_UPDATE,\n+\tADVICE_PUSH_UPDATE_REJECTED_ALIAS,\n \tADVICE_RESET_NO_REFRESH_WARNING,\n \tADVICE_RESOLVE_CONFLICT,\n \tADVICE_RM_HINTS,\n \tADVICE_SEQUENCER_IN_USE,\n \tADVICE_SET_UPSTREAM_FAILURE,\n+\tADVICE_SKIPPED_CHERRY_PICKS,\n \tADVICE_STATUS_AHEAD_BEHIND_WARNING,\n \tADVICE_STATUS_HINTS,\n \tADVICE_STATUS_U_OPTION,\n-\tADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,\n \tADVICE_SUBMODULES_NOT_UPDATED,\n+\tADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,\n+\tADVICE_SUGGEST_DETACHING_HEAD,\n \tADVICE_UPDATE_SPARSE_PATH,\n \tADVICE_WAITING_FOR_EDITOR,\n-\tADVICE_SKIPPED_CHERRY_PICKS,\n \tADVICE_WORKTREE_ADD_ORPHAN,\n };\n \n-- \n2.42.0\n"},{"id":"486624","messageId":"d5fbdb05-d16a-4390-946e-22a5a7a1b56a@gmail.com","threadId":"60719","inReplyTo":"4aedc15c-4b3f-4f5e-abea-581b501600f8@gmail.com","subject":"[PATCH v2 2/3] advice: fix an unexpected leading space","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-11T12:40:17Z","receivedAt":"2024-01-11T12:40:26Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"This space was introduced, presumably unintentionally, in b3b18d1621\n(advice: revamp advise API, 2020-03-02)\n\nI notice this space due to confuse diff outputs while doing some\nchanges to enum advice_type.\n\nAs a reference, a recent change we have to that enum is:\n\n    $ git show 35f0383\n\n[ ... ]\ndiff --git a/advice.h b/advice.h\nindex 0f584163f5..2affbe1426 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -49,6 +49,7 @@ struct string_list;\n        ADVICE_UPDATE_SPARSE_PATH,\n        ADVICE_WAITING_FOR_EDITOR,\n        ADVICE_SKIPPED_CHERRY_PICKS,\n+       ADVICE_WORKTREE_ADD_ORPHAN,\n };\n\nNote the hunk header, instead of a much more expected:\n\n@@ -49,6 +49,7 @@ enum advice_type\n\nSigned-off-by: Rubén Justo <rjusto@gmail.com>\n---\n advice.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/advice.h b/advice.h\nindex 9396bcdcf1..74d44d1156 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -10,7 +10,7 @@ struct string_list;\n  * Add the new config variable to Documentation/config/advice.txt.\n  * Call advise_if_enabled to print your advice.\n  */\n- enum advice_type {\n+enum advice_type {\n \tADVICE_ADD_EMBEDDED_REPO,\n \tADVICE_ADD_EMPTY_PATHSPEC,\n \tADVICE_ADD_IGNORED_FILE,\n-- \n2.42.0\n"},{"id":"486625","messageId":"6c86e8b8-92eb-44d8-875c-27c92aa02266@gmail.com","threadId":"60719","inReplyTo":"4aedc15c-4b3f-4f5e-abea-581b501600f8@gmail.com","subject":"[PATCH v2 3/3] branch: make the advice to force-deleting a conditional one","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-11T12:40:34Z","receivedAt":"2024-01-11T12:40:40Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"The error message we show when the user tries to delete a not fully\nmerged branch describes the error and gives a hint to the user:\n\n\terror: the branch 'foo' is not fully merged.\n\tIf you are sure you want to delete it, run 'git branch -D foo'.\n\nLet's move the hint part so that it is displayed using the advice\nmachinery:\n\n\terror: the branch 'foo' is not fully merged\n\thint: If you are sure you want to delete it, run 'git branch -D foo'\n\thint: Disable this message with \"git config advice.forceDeleteBranch false\"\n\nSigned-off-by: Rubén Justo <rjusto@gmail.com>\n---\n Documentation/config/advice.txt | 3 +++\n advice.c                        | 1 +\n advice.h                        | 1 +\n builtin/branch.c                | 8 +++++---\n 4 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt\nindex e0deaf3144..25c0917524 100644\n--- a/Documentation/config/advice.txt\n+++ b/Documentation/config/advice.txt\n@@ -45,6 +45,9 @@ advice.*::\n \t\tAdvice shown when linkgit:git-fetch[1] takes a long time\n \t\tto calculate forced updates after ref updates, or to warn\n \t\tthat the check is disabled.\n+\tforceDeleteBranch::\n+\t\tAdvice shown when a user tries to delete a not fully merged\n+\t\tbranch without the force option set.\n \tignoredHook::\n \t\tAdvice shown if a hook is ignored because the hook is not\n \t\tset as executable.\ndiff --git a/advice.c b/advice.c\nindex 03322caba0..f6e4c2f302 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -47,6 +47,7 @@ static struct {\n \t[ADVICE_DETACHED_HEAD]\t\t\t\t= { \"detachedHead\", 1 },\n \t[ADVICE_DIVERGING]\t\t\t\t= { \"diverging\", 1 },\n \t[ADVICE_FETCH_SHOW_FORCED_UPDATES]\t\t= { \"fetchShowForcedUpdates\", 1 },\n+\t[ADVICE_FORCE_DELETE_BRANCH]\t\t\t= { \"forceDeleteBranch\", 1 },\n \t[ADVICE_GRAFT_FILE_DEPRECATED]\t\t\t= { \"graftFileDeprecated\", 1 },\n \t[ADVICE_IGNORED_HOOK]\t\t\t\t= { \"ignoredHook\", 1 },\n \t[ADVICE_IMPLICIT_IDENTITY]\t\t\t= { \"implicitIdentity\", 1 },\ndiff --git a/advice.h b/advice.h\nindex 74d44d1156..9d4f49ae38 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -21,6 +21,7 @@ enum advice_type {\n \tADVICE_DETACHED_HEAD,\n \tADVICE_DIVERGING,\n \tADVICE_FETCH_SHOW_FORCED_UPDATES,\n+\tADVICE_FORCE_DELETE_BRANCH,\n \tADVICE_GRAFT_FILE_DEPRECATED,\n \tADVICE_IGNORED_HOOK,\n \tADVICE_IMPLICIT_IDENTITY,\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 0a32d1b6c8..cfb63cce5f 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -24,6 +24,7 @@\n #include \"ref-filter.h\"\n #include \"worktree.h\"\n #include \"help.h\"\n+#include \"advice.h\"\n #include \"commit-reach.h\"\n \n static const char * const builtin_branch_usage[] = {\n@@ -190,9 +191,10 @@ static int check_branch_commit(const char *branchname, const char *refname,\n \t\treturn -1;\n \t}\n \tif (!force && !branch_merged(kinds, branchname, rev, head_rev)) {\n-\t\terror(_(\"the branch '%s' is not fully merged.\\n\"\n-\t\t      \"If you are sure you want to delete it, \"\n-\t\t      \"run 'git branch -D %s'\"), branchname, branchname);\n+\t\terror(_(\"the branch '%s' is not fully merged\"), branchname);\n+\t\tadvise_if_enabled(ADVICE_FORCE_DELETE_BRANCH,\n+\t\t\t\t  _(\"If you are sure you want to delete it, \"\n+\t\t\t\t  \"run 'git branch -D %s'\"), branchname);\n \t\treturn -1;\n \t}\n \treturn 0;\n-- \n2.42.0\n"},{"id":"486628","messageId":"764ff26e-0dd2-4372-9323-a21164e16944@gmail.com","threadId":"60719","inReplyTo":"xmqqbk9tcc57.fsf@gitster.g","subject":"Re: [PATCH] branch: error description when deleting a not fully merged branch","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-11T13:39:48Z","receivedAt":"2024-01-11T13:39:54Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"On 10-ene-2024 09:48:52, Junio C Hamano wrote:\n> Rubén Justo <rjusto@gmail.com> writes:\n> \n> > The error message we show when the user tries to delete a not fully\n> > merged branch describes the error and gives a hint to the user:\n> >\n> > \terror: the branch 'foo' is not fully merged.\n> > \tIf you are sure you want to delete it, run 'git branch -D foo'.\n> >\n> > Let's move the hint part so that it takes advantage of the advice\n> > machinery:\n> >\n> > \terror: the branch 'foo' is not fully merged\n> > \thint: If you are sure you want to delete it, run 'git branch -D foo'\n> > \thint: Disable this message with \"git config advice.forceDeleteBranch false\"\n> \n> This is probably one sensible step forward, so let's queue it as-is.\n\nThanks.\n\n> But with reservations for longer-term future direction.  Stepping\n> back a bit, when 'foo' is not fully merged and the user used \"branch\n> -d\" on it, is it sensible for us to suggest use of \"branch -D\"\n\nMaybe the user hits here because he's doing \"branch -d\" and so I would\nfind a more clear suggestion: \"branch -d foo -f\".\n\nOr to be more generic, not suggesting a command line but a description\nthat explains how to use \"the force\" ... :) sorry for the joke\n\nAnyway, I think you mean to suggest a less destructive approach.  Which\nis fine by me.\n\n> Especially now this is a \"hint\" to help less experienced folks, it\n> may be helpful to suggest how the user can answer \"If you are sure\n> you want to delete\" part.  As this knows what unique commits on the\n> branch being deleted are about to be lost, one way to do so may be\n> to tell the user about them (\"you are about to lose 'branch: error\n> description when deleting a not fully merged branch' and other 47\n> commits that are not merged the target branch 'main'\", for example).\n\nThat's an interesting idea.  Maybe the hint becomes more informative\nthan a simple advice ...  maybe a more-verbose error is needed ...  just\nthinking out loud ...\n\n> \n> Another possibility is to suggest merging the branch into the\n> target, instead of suggesting a destructive \"deletion\", but I\n> suspect that it goes too far second-guessing the end-user intention.\n> \n> Thanks.\n\nThank you.\n"},{"id":"486679","messageId":"xmqqa5pbcpnx.fsf@gitster.g","threadId":"60719","inReplyTo":"d5fbdb05-d16a-4390-946e-22a5a7a1b56a@gmail.com","subject":"Re: [PATCH v2 2/3] advice: fix an unexpected leading space","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-12T01:21:22Z","receivedAt":"2024-01-12T01:21:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rubén Justo <rjusto@gmail.com> writes:\n\n> [ ... ]\n> diff --git a/advice.h b/advice.h\n> index 0f584163f5..2affbe1426 100644\n> --- a/advice.h\n> +++ b/advice.h\n> @@ -49,6 +49,7 @@ struct string_list;\n>         ADVICE_UPDATE_SPARSE_PATH,\n>         ADVICE_WAITING_FOR_EDITOR,\n>         ADVICE_SKIPPED_CHERRY_PICKS,\n> +       ADVICE_WORKTREE_ADD_ORPHAN,\n>  };\n>\n> Note the hunk header, instead of a much more expected:\n>\n> @@ -49,6 +49,7 @@ enum advice_type\n\nNext time, don't include \"diff\" output in the proposed log message\nwithout indenting.  It makes it hard to read and parse.\n\nThe attached is what I queued in my tree.\n\nThanks.\n\n------- >8 ------------- >8 ------------- >8 ------------- >8 -------\nFrom: Rubén Justo <rjusto@gmail.com>\nSubject: [PATCH] advice: fix an unexpected leading space\n\nThis space was introduced, presumably unintentionally, in b3b18d1621\n(advice: revamp advise API, 2020-03-02)\n\nI notice this space due to confuse diff outputs while doing some\nchanges to enum advice_type.\n\nAs a reference, a recent change we have to that enum is:\n\n    $ git show 35f0383\n\n    ...\n    diff --git a/advice.h b/advice.h\n    index 0f584163f5..2affbe1426 100644\n    --- a/advice.h\n    +++ b/advice.h\n    @@ -49,6 +49,7 @@ struct string_list;\n\t    ADVICE_UPDATE_SPARSE_PATH,\n\t    ADVICE_WAITING_FOR_EDITOR,\n\t    ADVICE_SKIPPED_CHERRY_PICKS,\n    +       ADVICE_WORKTREE_ADD_ORPHAN,\n     };\n\nNote the hunk header, instead of a much more expected:\n\n    @@ -49,6 +49,7 @@ enum advice_type\n\nSigned-off-by: Rubén Justo <rjusto@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n advice.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/advice.h b/advice.h\nindex 9396bcdcf1..74d44d1156 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -10,7 +10,7 @@ struct string_list;\n  * Add the new config variable to Documentation/config/advice.txt.\n  * Call advise_if_enabled to print your advice.\n  */\n- enum advice_type {\n+enum advice_type {\n \tADVICE_ADD_EMBEDDED_REPO,\n \tADVICE_ADD_EMPTY_PATHSPEC,\n \tADVICE_ADD_IGNORED_FILE,\n-- \n2.43.0-283-ga54a84b333\n\n"},{"id":"486701","messageId":"60a90f4e-b22c-46cb-a79f-a0e01e711732@gmail.com","threadId":"60719","inReplyTo":"xmqqa5pbcpnx.fsf@gitster.g","subject":"Re: [PATCH v2 2/3] advice: fix an unexpected leading space","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2024-01-12T09:10:01Z","receivedAt":"2024-01-12T09:10:12Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"On 11-ene-2024 17:21:22, Junio C Hamano wrote:\n> Rubén Justo <rjusto@gmail.com> writes:\n> \n> > [ ... ]\n> > diff --git a/advice.h b/advice.h\n> > index 0f584163f5..2affbe1426 100644\n> > --- a/advice.h\n> > +++ b/advice.h\n> > @@ -49,6 +49,7 @@ struct string_list;\n> >         ADVICE_UPDATE_SPARSE_PATH,\n> >         ADVICE_WAITING_FOR_EDITOR,\n> >         ADVICE_SKIPPED_CHERRY_PICKS,\n> > +       ADVICE_WORKTREE_ADD_ORPHAN,\n> >  };\n> >\n> > Note the hunk header, instead of a much more expected:\n> >\n> > @@ -49,6 +49,7 @@ enum advice_type\n> \n> Next time, don't include \"diff\" output in the proposed log message\n> without indenting.  It makes it hard to read and parse.\n\nMy fault.  Sorry.\n\nIs there any way to make git-format-patch issue a warning or refuse to\ncontinue when the resulting patch is not going to be accepted by git-am?\n\n> \n> The attached is what I queued in my tree.\n\nThanks.\n"},{"id":"486717","messageId":"xmqqsf32bfsn.fsf@gitster.g","threadId":"60719","inReplyTo":"60a90f4e-b22c-46cb-a79f-a0e01e711732@gmail.com","subject":"Re: [PATCH v2 2/3] advice: fix an unexpected leading space","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-12T17:52:08Z","receivedAt":"2024-01-12T17:52:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rubén Justo <rjusto@gmail.com> writes:\n\n> On 11-ene-2024 17:21:22, Junio C Hamano wrote:\n>> Rubén Justo <rjusto@gmail.com> writes:\n>> \n>> > [ ... ]\n>> > diff --git a/advice.h b/advice.h\n>> > index 0f584163f5..2affbe1426 100644\n>> > --- a/advice.h\n>> > +++ b/advice.h\n>> > @@ -49,6 +49,7 @@ struct string_list;\n>> >         ADVICE_UPDATE_SPARSE_PATH,\n>> >         ADVICE_WAITING_FOR_EDITOR,\n>> >         ADVICE_SKIPPED_CHERRY_PICKS,\n>> > +       ADVICE_WORKTREE_ADD_ORPHAN,\n>> >  };\n>> >\n>> > Note the hunk header, instead of a much more expected:\n>> >\n>> > @@ -49,6 +49,7 @@ enum advice_type\n>> \n>> Next time, don't include \"diff\" output in the proposed log message\n>> without indenting.  It makes it hard to read and parse.\n>\n> My fault.  Sorry.\n>\n> Is there any way to make git-format-patch issue a warning or refuse to\n> continue when the resulting patch is not going to be accepted by git-am?\n\nI meant it as primarily to help human readers, but you are right, it\nwill break \"am\".  How about doing it in the pre-commit hook?\n"},{"id":"486733","messageId":"xmqqcyu69rn9.fsf@gitster.g","threadId":"60719","inReplyTo":"xmqqsf32bfsn.fsf@gitster.g","subject":"Re: [PATCH v2 2/3] advice: fix an unexpected leading space","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-01-12T21:19:06Z","receivedAt":"2024-01-12T21:19:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> ...  How about doing it in the pre-commit hook?\n\nSorry, as it runs before obtaining the proposed commit log message\nand making a commit, pre-commit is a wrong one to use.  I meant to\nsay commit-msg hook that is used to verify the contents of the\nproposed commit log message.\n\n\n"}]}