{"thread":{"id":"58418","subject":"[PATCH 2/2] blame: Document that --show-name is negatable","startedAt":"2022-09-12T05:52:01Z","lastAt":"2022-09-13T09:08:21Z","messageCount":7,"participants":["Rene Kita","Øystein Walle","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"462925","messageId":"20220912054515.29559-3-mail@rkta.de","threadId":"58418","inReplyTo":"20220912054515.29559-1-mail@rkta.de","subject":"[PATCH 2/2] blame: Document that --show-name is negatable","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2022-09-12T05:45:15Z","receivedAt":"2022-09-12T05:52:01Z","isPatch":true,"sender":{"key":"mail@rkta.de","avatar":null},"body":"Signed-off-by: Rene Kita <mail@rkta.de>\n---\n Documentation/git-blame.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt\nindex d7a46cc674..75e115f97e 100644\n--- a/Documentation/git-blame.txt\n+++ b/Documentation/git-blame.txt\n@@ -63,7 +63,7 @@ include::blame-options.txt[]\n \tof code to have been moved.\n \n -f::\n---show-name::\n+--[no-]show-name::\n \tShow the filename in the original commit.  By default\n \tthe filename is shown if there is any line that came from a\n \tfile with a different name, due to rename detection.\n-- \n2.37.3.544.g5c9b9c0a4e\n\n"},{"id":"462926","messageId":"20220912054515.29559-1-mail@rkta.de","threadId":"58418","inReplyTo":null,"subject":"[PATCH 0/2] blame: Make --show-name negatable","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2022-09-12T05:45:13Z","receivedAt":"2022-09-12T05:52:08Z","isPatch":true,"sender":{"key":"mail@rkta.de","avatar":null},"body":"With -s git blame does not show author and date, but will show the file name\nif the file was renamed some time in the past. With -c git blame will\nnot show the name, even if the file was renamed, but will show author\nand date.\n\nWorking with a code base that already uses long lines and has a deep\nnested directory structure the output of git blame gets hard to read due\nto line wrapping.\n\nWhile looking for a solution on IRC a user was so nice to gave me a\npatch (and permission to submit it) that allows to disable showing of\nthe file name even if the file was renamed. This allows to show only the\ncommit id with `git blame -s --no-show-name`.\n\nThe second patch only adds this informations to the man page.\n\n\nRene Kita (1):\n  blame: Document that --show-name is negatable\n\nØystein Walle (1):\n  blame: Make --show-name negatable\n\n Documentation/git-blame.txt | 2 +-\n builtin/blame.c             | 9 +++++++--\n 2 files changed, 8 insertions(+), 3 deletions(-)\n\n-- \n2.37.3.544.g5c9b9c0a4e\n\n"},{"id":"462927","messageId":"20220912054515.29559-2-mail@rkta.de","threadId":"58418","inReplyTo":"20220912054515.29559-1-mail@rkta.de","subject":"[PATCH 1/2] blame: Make --show-name negatable","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2022-09-12T05:45:14Z","receivedAt":"2022-09-12T05:52:34Z","isPatch":true,"sender":{"key":"mail@rkta.de","avatar":null},"body":"From: Øystein Walle <oystwa@gmail.com>\n\nSigned-off-by: Øystein Walle <oystwa@gmail.com>\n---\n builtin/blame.c | 9 +++++++--\n 1 file changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex a9fe8cf7a6..cbaae91a8f 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -49,6 +49,7 @@ static int blank_boundary;\n static int incremental;\n static int xdl_opts;\n static int abbrev = -1;\n+static int show_name = -1;\n static int no_whole_file_rename;\n static int show_progress;\n static char repeated_meta_color[COLOR_MAXLEN];\n@@ -621,7 +622,8 @@ static void find_alignment(struct blame_scoreboard *sb, int *option)\n \t\tif (compute_auto_abbrev)\n \t\t\tauto_abbrev = update_auto_abbrev(auto_abbrev, suspect);\n \t\tif (strcmp(suspect->path, sb->path))\n-\t\t\t*option |= OUTPUT_SHOW_NAME;\n+\t\t\tif (show_name == -1)\n+\t\t\t\t*option |= OUTPUT_SHOW_NAME;\n \t\tnum = strlen(suspect->path);\n \t\tif (longest_file < num)\n \t\t\tlongest_file = num;\n@@ -867,7 +869,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \t\tOPT_BOOL(0, \"show-stats\", &show_stats, N_(\"show work cost statistics\")),\n \t\tOPT_BOOL(0, \"progress\", &show_progress, N_(\"force progress reporting\")),\n \t\tOPT_BIT(0, \"score-debug\", &output_option, N_(\"show output score for blame entries\"), OUTPUT_SHOW_SCORE),\n-\t\tOPT_BIT('f', \"show-name\", &output_option, N_(\"show original filename (Default: auto)\"), OUTPUT_SHOW_NAME),\n+\t\tOPT_BOOL('f', \"show-name\", &show_name, N_(\"show original filename (Default: auto)\")),\n \t\tOPT_BIT('n', \"show-number\", &output_option, N_(\"show original linenumber (Default: off)\"), OUTPUT_SHOW_NUMBER),\n \t\tOPT_BIT('p', \"porcelain\", &output_option, N_(\"show in a format designed for machine consumption\"), OUTPUT_PORCELAIN),\n \t\tOPT_BIT(0, \"line-porcelain\", &output_option, N_(\"show porcelain format with per-line commit information\"), OUTPUT_PORCELAIN|OUTPUT_LINE_PORCELAIN),\n@@ -943,6 +945,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \trevs.diffopt.flags.follow_renames = 0;\n \targc = parse_options_end(&ctx);\n \n+\tif (show_name == 1)\n+\t\toutput_option |= OUTPUT_SHOW_NAME;\n+\n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\n \n-- \n2.37.3.544.g5c9b9c0a4e\n\n"},{"id":"462931","messageId":"CAFaJEquyFE86VVRy9jZ13xtjFpLbJaseFWf=Vo3CeKdnvScvcg@mail.gmail.com","threadId":"58418","inReplyTo":"20220912054515.29559-2-mail@rkta.de","subject":"Re: [PATCH 1/2] blame: Make --show-name negatable","fromName":"Øystein Walle","fromEmail":"oystwa@gmail.com","sentAt":"2022-09-12T13:25:13Z","receivedAt":"2022-09-12T13:25:55Z","isPatch":true,"sender":{"key":"oystwa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/794585?v=4"},"body":"That was me! :-)\n\nNot long after I sent you a new link with the patch below, but I suppose\nyou missed it. My first rough attempt was incomplete, changing the\nbehavior from on/auto on to auto/off instead of the intended\non/auto/off.\n\nThe docs changes look good to me (but should perhaps be squashed into the impl\npatch?). Not sure how many of the negatable long options that exist are\nactually documented as such, but imho. they should be.\n\nThere are no added tests, but there are no tests for -f/--show-name in the\nfirst place and I just didn't get around to writing one...\n\nØsse\n\n---\n builtin/blame.c | 9 +++++++--\n 1 file changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex a9fe8cf7a6..cbaae91a8f 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -49,6 +49,7 @@ static int blank_boundary;\n static int incremental;\n static int xdl_opts;\n static int abbrev = -1;\n+static int show_name = -1;\n static int no_whole_file_rename;\n static int show_progress;\n static char repeated_meta_color[COLOR_MAXLEN];\n@@ -621,7 +622,8 @@ static void find_alignment(struct blame_scoreboard\n*sb, int *option)\n         if (compute_auto_abbrev)\n             auto_abbrev = update_auto_abbrev(auto_abbrev, suspect);\n         if (strcmp(suspect->path, sb->path))\n-            *option |= OUTPUT_SHOW_NAME;\n+            if (show_name == -1)\n+                *option |= OUTPUT_SHOW_NAME;\n         num = strlen(suspect->path);\n         if (longest_file < num)\n             longest_file = num;\n@@ -867,7 +869,7 @@ int cmd_blame(int argc, const char **argv, const\nchar *prefix)\n         OPT_BOOL(0, \"show-stats\", &show_stats, N_(\"show work cost\nstatistics\")),\n         OPT_BOOL(0, \"progress\", &show_progress, N_(\"force progress\nreporting\")),\n         OPT_BIT(0, \"score-debug\", &output_option, N_(\"show output\nscore for blame entries\"), OUTPUT_SHOW_SCORE),\n-        OPT_BIT('f', \"show-name\", &output_option, N_(\"show original\nfilename (Default: auto)\"), OUTPUT_SHOW_NAME),\n+        OPT_BOOL('f', \"show-name\", &show_name, N_(\"show original\nfilename (Default: auto)\")),\n         OPT_BIT('n', \"show-number\", &output_option, N_(\"show original\nlinenumber (Default: off)\"), OUTPUT_SHOW_NUMBER),\n         OPT_BIT('p', \"porcelain\", &output_option, N_(\"show in a\nformat designed for machine consumption\"), OUTPUT_PORCELAIN),\n         OPT_BIT(0, \"line-porcelain\", &output_option, N_(\"show\nporcelain format with per-line commit information\"),\nOUTPUT_PORCELAIN|OUTPUT_LINE_PORCELAIN),\n@@ -943,6 +945,9 @@ int cmd_blame(int argc, const char **argv, const\nchar *prefix)\n     revs.diffopt.flags.follow_renames = 0;\n     argc = parse_options_end(&ctx);\n\n+    if (show_name == 1)\n+        output_option |= OUTPUT_SHOW_NAME;\n+\n     prepare_repo_settings(the_repository);\n     the_repository->settings.command_requires_full_index = 0;\n\n-- \n2.34.1\n"},{"id":"462938","messageId":"xmqqsfkwftd0.fsf@gitster.g","threadId":"58418","inReplyTo":"CAFaJEquyFE86VVRy9jZ13xtjFpLbJaseFWf=Vo3CeKdnvScvcg@mail.gmail.com","subject":"Re: [PATCH 1/2] blame: Make --show-name negatable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-12T16:30:19Z","receivedAt":"2022-09-12T16:30:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Øystein Walle <oystwa@gmail.com> writes:\n\n> That was me! :-)\n>\n> Not long after I sent you a new link with the patch below, but I suppose\n> you missed it. My first rough attempt was incomplete, changing the\n> behavior from on/auto on to auto/off instead of the intended\n> on/auto/off.\n\nNot clear to this bystander what exactly is going on.  Is the patch\nRene relayed is your rough attempt that was incomplete?\n\n> The docs changes look good to me (but should perhaps be squashed into the impl\n> patch?). Not sure how many of the negatable long options that exist are\n> actually documented as such, but imho. they should be.\n>\n> There are no added tests, but there are no tests for -f/--show-name in the\n> first place and I just didn't get around to writing one...\n\nThanks.  Let's see if we can have an cleaned-up version with tests,\nthen.\n\n\n\n>\n> Øsse\n>\n> ---\n>  builtin/blame.c | 9 +++++++--\n>  1 file changed, 7 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/blame.c b/builtin/blame.c\n> index a9fe8cf7a6..cbaae91a8f 100644\n> --- a/builtin/blame.c\n> +++ b/builtin/blame.c\n> @@ -49,6 +49,7 @@ static int blank_boundary;\n>  static int incremental;\n>  static int xdl_opts;\n>  static int abbrev = -1;\n> +static int show_name = -1;\n>  static int no_whole_file_rename;\n>  static int show_progress;\n>  static char repeated_meta_color[COLOR_MAXLEN];\n> @@ -621,7 +622,8 @@ static void find_alignment(struct blame_scoreboard\n> *sb, int *option)\n>          if (compute_auto_abbrev)\n>              auto_abbrev = update_auto_abbrev(auto_abbrev, suspect);\n>          if (strcmp(suspect->path, sb->path))\n> -            *option |= OUTPUT_SHOW_NAME;\n> +            if (show_name == -1)\n> +                *option |= OUTPUT_SHOW_NAME;\n>          num = strlen(suspect->path);\n>          if (longest_file < num)\n>              longest_file = num;\n> @@ -867,7 +869,7 @@ int cmd_blame(int argc, const char **argv, const\n> char *prefix)\n>          OPT_BOOL(0, \"show-stats\", &show_stats, N_(\"show work cost\n> statistics\")),\n>          OPT_BOOL(0, \"progress\", &show_progress, N_(\"force progress\n> reporting\")),\n>          OPT_BIT(0, \"score-debug\", &output_option, N_(\"show output\n> score for blame entries\"), OUTPUT_SHOW_SCORE),\n> -        OPT_BIT('f', \"show-name\", &output_option, N_(\"show original\n> filename (Default: auto)\"), OUTPUT_SHOW_NAME),\n> +        OPT_BOOL('f', \"show-name\", &show_name, N_(\"show original\n> filename (Default: auto)\")),\n>          OPT_BIT('n', \"show-number\", &output_option, N_(\"show original\n> linenumber (Default: off)\"), OUTPUT_SHOW_NUMBER),\n>          OPT_BIT('p', \"porcelain\", &output_option, N_(\"show in a\n> format designed for machine consumption\"), OUTPUT_PORCELAIN),\n>          OPT_BIT(0, \"line-porcelain\", &output_option, N_(\"show\n> porcelain format with per-line commit information\"),\n> OUTPUT_PORCELAIN|OUTPUT_LINE_PORCELAIN),\n> @@ -943,6 +945,9 @@ int cmd_blame(int argc, const char **argv, const\n> char *prefix)\n>      revs.diffopt.flags.follow_renames = 0;\n>      argc = parse_options_end(&ctx);\n>\n> +    if (show_name == 1)\n> +        output_option |= OUTPUT_SHOW_NAME;\n> +\n>      prepare_repo_settings(the_repository);\n>      the_repository->settings.command_requires_full_index = 0;\n"},{"id":"462966","messageId":"20220913085631.4031-1-walle@fryseskap.localdomain","threadId":"58418","inReplyTo":"xmqqsfkwftd0.fsf@gitster.g","subject":"Re: [PATCH 1/2] blame: Make --show-name negatable","fromName":"Øystein Walle","fromEmail":"oystwa@gmail.com","sentAt":"2022-09-13T08:56:31Z","receivedAt":"2022-09-13T08:56:47Z","isPatch":true,"sender":{"key":"oystwa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/794585?v=4"},"body":"Hi, Junio\n\n> Not clear to this bystander what exactly is going on.  Is the patch\n> Rene relayed is your rough attempt that was incomplete?\n\nCorrect! I am the nice IRC that was mentioned in the cover letter. My\nimproved patch is the one in the e-mail you responded to, apart from\nGMail's text wrapping that was unaware of until now.\n\n> Thanks.  Let's see if we can have an cleaned-up version with tests,\n> then.\n\nI can send a corrected (and correctly formatted patch) for review,\noptionally with the docs squashed in with Rene's permission. Maybe Rene\nwould like to take a stab at writing tests? I am in the process of\nmoving house and my usual workstation is not exactly online, so it'll be\na while.\n\nØsse\n"},{"id":"462967","messageId":"YyBIfg06kBtuZCmL@t480","threadId":"58418","inReplyTo":"20220913085631.4031-1-walle@fryseskap.localdomain","subject":"Re: [PATCH 1/2] blame: Make --show-name negatable","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2022-09-13T09:08:14Z","receivedAt":"2022-09-13T09:08:21Z","isPatch":true,"sender":{"key":"mail@rkta.de","avatar":null},"body":"On Tue, Sep 13, 2022 at 10:56:31AM +0200, Øystein Walle wrote:\n> Hi, Junio\n> \n> > Not clear to this bystander what exactly is going on.  Is the patch\n> > Rene relayed is your rough attempt that was incomplete?\n> \n> Correct! I am the nice IRC that was mentioned in the cover letter. My\n> improved patch is the one in the e-mail you responded to, apart from\n> GMail's text wrapping that was unaware of until now.\n\nThat's my fault. I saw the corrected patch, but somehow used the old\none. Sorry!\n\n\n> > Thanks.  Let's see if we can have an cleaned-up version with tests,\n> > then.\n> \n> I can send a corrected (and correctly formatted patch) for review,\n> optionally with the docs squashed in with Rene's permission.\n\nOf course.\n\n> Maybe Rene would like to take a stab at writing tests? I am in the\n> process of moving house and my usual workstation is not exactly\n> online, so it'll be a while.\n\nYes, I can write a test. Will need to investigate, never worked with the\ncode base.\n"}]}