" a way to find the newly added *strings* in the commit diff, " A thought from three steps back: Maybe a variant of the Word-diff (e.g. word moved display, etc) could be used.
That is, if we redefine how the 'word' is detected, from the regular IFS split to being one that splits on paired single or double quotes, then it should be easy to use the existing machinery. Obviously (in a line oriented diff) a "string" can't start a line without a quote mark, while regular word diff could start a line, but a string can end on an EOL, just like a word. -- Philip On Monday, August 16, 2021 at 6:09:06 AM UTC+1 Tassilo Horn wrote: > Konstantin Khomoutov <kos...@bswap.ru> writes: > > >> I am trying to figure a way to find the newly added *strings* in the > >> commit diff,. > >> > >> If I do a "git diff" I get all the changes which included newly added > >> strings, modified strings as-well made in the commit, I only want the > >> newly added strings(not files) in that commit,is there a way this can > >> be achieved? > > > > I doubt it's possible simply because the very question - which strings > > are new as opposed to changed - is unanswerable in general; at least > > not without specifying a very narrow (and, I think, quite arbitrary) > > set of restrictions to do such classification. > > There is the git pickaxe, i.e., > > git log -S FOOBAR > > shows only those commits where the number of FOOBAR occurrences changed. > That will include additions of FOOBAR, where the first found commit will > probably be the initial introduction of FOOBAR. > > --8<---------------cut here---------------start------------->8--- > -S<string> > Look for differences that change the number of occurrences of the > specified string (i.e. addition/deletion) in a file. Intended for > the scripter’s use. > > It is useful when you’re looking for an exact block of code (like a > struct), and want to know the history of that block since it first > came into being: use the feature iteratively to feed the > interesting block in the preimage back into -S, and keep going > until you get the very first version of the block. > > Binary files are searched as well. > --8<---------------cut here---------------end--------------->8--- > > HTH, > Tassilo > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/9c842962-cd26-483d-813c-16bb489c438an%40googlegroups.com.