Subject: Re: git log history simplification problem

From: Jonathan Nieder <[email-masked]>
Date: Tue, 4 Feb 2014 11:48:42 -0800

Hi,

Miklos Vajna wrote:

> git clone git://anongit.freedesktop.org/libreoffice/core
> cd core
> git log --full-history -p -S'mnTitleBarHeight =' sd/source/ui/dlg/PaneDockingWindow.cxx
>
> Here the first output I get from git-log is
> b390fae1706b9c511158a03e4fd61f263be4e511, where you can see that the
> commit *added* that string. So it should be there on master, I would
> assume.

df76bfb0695d19d201936df80192108e7ce51b8c (a merge) removed it.

Plain 'git log' doesn't notice because in the default mode it skips
merges.

Since the culprit commit is not in the first-parent history of HEAD,
my usual approach doesn't help, either:

	$ git log -m --first-parent -S'mnTitleBarHeight =' \
		-- sd/source/ui/dlg/PaneDockingWindow.cxx
	$ 

Using -c or --cc produces too many hits.

Luckily '-m -p' without --first-parent worked and the first commit it
showed was the right one.  It produces more hits than I'd like, too,
though.

The -L option doesn't interact well enough with --reverse to handle
this case:

	$ git grep -p -e'mnTitleBarHeight =' b390fae1 -- sd/source/ui/dlg/PaneDockingWindow.cxx
	b390fae1:sd/source/ui/dlg/PaneDockingWindow.cxx=void PaneDockingWindow::Layout (void)
	b390fae1:sd/source/ui/dlg/PaneDockingWindow.cxx:    mnTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
	b390fae1:sd/source/ui/dlg/PaneDockingWindow.cxx:            mnTitleBarHeight = aToolBoxSize.Height();
	b390fae1:sd/source/ui/dlg/PaneDockingWindow.cxx:        mnTitleBarHeight = aToolBoxSize.Height();
	$ git log --reverse b390fae1..HEAD \
		-L:Layout:sd/source/ui/dlg/PaneDockingWindow.cxx
	fatal: -L parameter 'Layout' starting at line 1: no match

Thanks for a useful example.
Jonathan