git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git log history simplification problem

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 4, 2014, 19:48 UTC
Message-ID
<20140204194842.GM30398@google.com>
In-Reply-To
<20140204173713.GC17861@collabora.co.uk>
Hi,
Miklos Vajna wrote:
Show 8 quoted lines
> 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

Previous: Miklos VajnaNext: Miklos Vajna
Message 3 of 5 in “git log history simplification problem”
  1. Miklos VajnaFeb 4, 2014
  2. Miklos VajnaFeb 4, 2014
  3. Jonathan NiederFeb 4, 2014
  4. Miklos VajnaFeb 4, 2014
  5. Junio C HamanoFeb 4, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.