{"thread":{"id":"53768","subject":"Listing changed identifiers with git log/diff","startedAt":"2020-06-29T19:15:10Z","lastAt":"2020-06-30T07:00:13Z","messageCount":3,"participants":["Konstantin Kharlamov","Philippe Blain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"400758","messageId":"e37cdda3b73094f4f1a929dd181a64936a649c48.camel@yandex.ru","threadId":"53768","inReplyTo":null,"subject":"Listing changed identifiers with git log/diff","fromName":"Konstantin Kharlamov","fromEmail":"hi-angel@yandex.ru","sentAt":"2020-06-29T10:18:08Z","receivedAt":"2020-06-29T19:15:10Z","isPatch":false,"sender":{"key":"hi-angel@yandex.ru","avatar":null},"body":"Git is able to recognise functions/variables changed, and even allows to see the history of such identifier with `-L` option.\n\nBut I couldn't find: how does one get a list of such identifiers in `git log` or `git diff`? This would be particularly useful for projects with odd requirements to have a list of identifiers changed in the commit message.\n\nFTR, the diff text after the \"@@…@@\" does not cut it because for example if the diff is at the beginning of the function, then it would have a name of the previous function, i.e. not the one modified. As a hack, I tried passing an option `-U0`, but that didn't help, for one-line identifiers it still shows the name of the prev. identifier.\n\n"},{"id":"400759","messageId":"3CA60EC2-13E9-4A1A-9A89-066CFF9CA36E@gmail.com","threadId":"53768","inReplyTo":"e37cdda3b73094f4f1a929dd181a64936a649c48.camel@yandex.ru","subject":"Re: Listing changed identifiers with git log/diff","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-06-29T19:24:47Z","receivedAt":"2020-06-29T19:25:05Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Konstantin,\n\n> Le 29 juin 2020 à 06:18, Konstantin Kharlamov <hi-angel@yandex.ru> a écrit :\n> \n> Git is able to recognise functions/variables changed, and even allows to see the history of such identifier with `-L` option.\n> \n> But I couldn't find: how does one get a list of such identifiers in `git log` or `git diff`? This would be particularly useful for projects with odd requirements to have a list of identifiers changed in the commit message.\n> \n> FTR, the diff text after the \"@@…@@\" does not cut it because for example if the diff is at the beginning of the function, then it would have a name of the previous function, i.e. not the one modified. As a hack, I tried passing an option `-U0`, but that didn't help, for one-line identifiers it still shows the name of the prev. identifier.\n\nAs far as I'm aware this is a limitation of the diff machinery.\nI agree with you that it would be really nice if it could work as you describe...\n\nCheers,\n\nPhilippe."},{"id":"400794","messageId":"3e6b9431b7caa9db0ebbaea292897f8bcdcf8148.camel@yandex.ru","threadId":"53768","inReplyTo":"3CA60EC2-13E9-4A1A-9A89-066CFF9CA36E@gmail.com","subject":"Re: Listing changed identifiers with git log/diff","fromName":"Konstantin Kharlamov","fromEmail":"hi-angel@yandex.ru","sentAt":"2020-06-30T07:00:00Z","receivedAt":"2020-06-30T07:00:13Z","isPatch":false,"sender":{"key":"hi-angel@yandex.ru","avatar":null},"body":"On Mon, 2020-06-29 at 15:24 -0400, Philippe Blain wrote:\n> Hi Konstantin,\n> \n> > Le 29 juin 2020 à 06:18, Konstantin Kharlamov <hi-angel@yandex.ru> a écrit :\n> > \n> > Git is able to recognise functions/variables changed, and even allows to see\n> > the history of such identifier with `-L` option.\n> > \n> > But I couldn't find: how does one get a list of such identifiers in `git\n> > log` or `git diff`? This would be particularly useful for projects with odd\n> > requirements to have a list of identifiers changed in the commit message.\n> > \n> > FTR, the diff text after the \"@@…@@\" does not cut it because for example if\n> > the diff is at the beginning of the function, then it would have a name of\n> > the previous function, i.e. not the one modified. As a hack, I tried passing\n> > an option `-U0`, but that didn't help, for one-line identifiers it still\n> > shows the name of the prev. identifier.\n> \n> As far as I'm aware this is a limitation of the diff machinery.\n> I agree with you that it would be really nice if it could work as you\n> describe...\n\nI agree, the hack I tried might be a limitation of diff. But since git per se\nknows identifiers changed (as it can track changes to them by passing `-L`\noption, like `git log -L :function_foo:src/foo.c`), shouldn't there be some\nother way to achieve that?\n\n"}]}