threads / discuss / 55749

Formatting options are ignored when tracking functions

Subject: Formatting options are ignored when tracking functions

## tl;dr

2 messages between May 21, 2021 and May 23, 2021.

replies: 1people: 2as markdown or json

Aidan· May 21, 2021, 21:18 UTC · lore
Git log with formatting options do not work when using -L:<funcname>:<file>

Works as intended for path --------------------------- aidan@AidanLaptop:~/Repos/git$ git log --oneline -- advice.c a20f70478f add: warn when asked to update SKIP_WORKTREE entries 3b990aa645 push: parse and set flag for "--force-if-includes" c4a09cc9cc Merge branch 'hw/advise-ng' ---------------------------

Works as intended for revision range --------------------------- aidan@AidanLaptop:~/Repos/git$ git log 91e70e00ac..HEAD --oneline 107691cb07 (HEAD -> master, origin/master, origin/HEAD) Merge branch 'ds/sparse-index-protections' 2b8b1aa6ad Merge branch 'tz/c-locale-output-is-no-more' c69f2f8c86 Merge branch 'cs/http-use-basic-after-failed-negotiate' ---------------------------

Does not work tracking a function --------------------------- aidan@AidanLaptop:~/Repos/git$ git log -L:vadvise:advice.c --oneline b3b18d1621 advice: revamp advise API

diff --git a/advice.c b/advice.c
--- a/advice.c
+++ b/advice.c
@@ -99,19 +141,23 @@
-static void vadvise(const char *advice, va_list params)
+static void vadvise(const char *advice, int display_instructions,
+                   const char *key, va_list params)
  {
         struct strbuf buf = STRBUF_INIT;
         const char *cp, *np;

         strbuf_vaddf(&buf, advice, params);

---------------------------

Is this a bug or am I invoking the command incorrectly?

Kind regards,
Aidan
Felipe Contreras· May 23, 2021, 02:28 UTC · re: Aidan · lore

RE: Formatting options are ignored when tracking functions

Aidan wrote:
Show 20 quoted lines
> Does not work tracking a function
> ---------------------------
> aidan@AidanLaptop:~/Repos/git$ git log -L:vadvise:advice.c --oneline
> b3b18d1621 advice: revamp advise API
> diff --git a/advice.c b/advice.c
> --- a/advice.c
> +++ b/advice.c
> @@ -99,19 +141,23 @@
> -static void vadvise(const char *advice, va_list params)
> +static void vadvise(const char *advice, int display_instructions,
> +                   const char *key, va_list params)
>   {
>          struct strbuf buf = STRBUF_INIT;
>          const char *cp, *np;
> 
>          strbuf_vaddf(&buf, advice, params);
> 
> ---------------------------
> 
> Is this a bug or am I invoking the command incorrectly?
According to the documentation -L implies --patch, so you need to do:
  git log -L:vadvise:advice.c --oneline --no-patch
I would not expect such behavior so to me that's a bug.
-- 
Felipe Contreras

← back to recent threads