Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: git log -S not finding all commits?

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:47:29

On 10/08/2009 10:21 AM, Daniel wrote:
Hi,

I did:

$ git version
git version 1.6.4.4
$ mkdir a&&  cd a&&  git init
$ echo "Free data">  a
$ git add a
$ git commit -m1
$ echo "Free data allocated by other function">  a
$ git commit -a -m2
$ PAGER=cat git log -S'Free' --oneline
2f34241 1

I would expect "git log" to show both 1 and 2 commit, but it prints only 1.

Is it the correct behavior?
Yes, it's the correct behaviour. -S finds only lines where what you search
for was added or deleted. It counts the number of occurrences of what you
specify in each resulting tree and only shows the commits where that number
changed. In your case, searching for "Free data " would have printed both
commits, since you first introduce that entire string and then remove it.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help