<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/line-range.c, branch v2.41.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.41.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.41.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-12-20T01:00:43Z</updated>
<entry>
<title>line-range: fix infinite loop bug with '$' regex</title>
<updated>2022-12-20T01:00:43Z</updated>
<author>
<name>Lars Kellogg-Stedman</name>
<email>lars@oddbit.com</email>
</author>
<published>2022-12-19T22:48:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4e57c88e028c25ee9428b51ff829299bbb88a80c'/>
<id>urn:sha1:4e57c88e028c25ee9428b51ff829299bbb88a80c</id>
<content type='text'>
When the -L argument to "git log" is passed the zero-width regular
expression "$" (as in "-L :$:line-range.c"), this results in an
infinite loop in find_funcname_matching_regexp().

Modify find_funcname_matching_regexp to correctly match the entire line
instead of the zero-width match at eol and update the loop condition to
prevent an infinite loop in the event of other undiscovered corner cases.

The primary change is that we pre-decrement the beginning-of-line marker
('bol') before comparing it to '\n'. In the case of '$', where we match the
'\n' at the end of the line and start the loop with bol == eol, this
ensures that bol will find the beginning of the line on which the match
occurred.

Originally reported in &lt;https://stackoverflow.com/q/74690545/147356&gt;.

Signed-off-by: Lars Kellogg-Stedman &lt;lars@oddbit.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use CALLOC_ARRAY</title>
<updated>2021-03-14T00:00:09Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2021-03-13T16:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca56dadb4b65ccaeab809d80db80a312dc00941a'/>
<id>urn:sha1:ca56dadb4b65ccaeab809d80db80a312dc00941a</id>
<content type='text'>
Add and apply a semantic patch for converting code that open-codes
CALLOC_ARRAY to use it instead.  It shortens the code and infers the
element size automatically.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>line-range.c: remove implicit dependency on the_index</title>
<updated>2018-09-21T16:51:18Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-09-21T15:57:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=80e03855413c7ac3727df572d44131656e467426'/>
<id>urn:sha1:80e03855413c7ac3727df572d44131656e467426</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff.c: remove implicit dependency on the_index</title>
<updated>2018-09-21T16:50:58Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-09-21T15:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=acd00ea04998ce469d1775c658134b097e18f5a3'/>
<id>urn:sha1:acd00ea04998ce469d1775c658134b097e18f5a3</id>
<content type='text'>
[jc: squashed in missing forward decl in userdiff.h found by Ramsay]

Helped-by: Ramsay Jones &lt;ramsay@ramsayjones.plus.com&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>blame: prevent error if range ends past end of file</title>
<updated>2018-06-15T17:29:13Z</updated>
<author>
<name>Isabella Stephens</name>
<email>istephens@atlassian.com</email>
</author>
<published>2018-06-15T06:29:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=96cfa94e68cfbe9942e230ae18b35eaf1ca30f99'/>
<id>urn:sha1:96cfa94e68cfbe9942e230ae18b35eaf1ca30f99</id>
<content type='text'>
If the -L option is used to specify a line range in git blame, and the
end of the range is past the end of the file, git will fail with a fatal
error. This commit prevents such behavior - instead we display the blame
for existing lines within the specified range. Tests are amended
accordingly.

This commit also fixes two corner cases. Blaming -L n,-(n+1) now blames
the first n lines of a file rather than from n to the end of the file.
Blaming -L ,-n will be treated as -L 1,-n and blame the first line of
the file, rather than blaming the whole file.

Signed-off-by: Isabella Stephens &lt;istephens@atlassian.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use SWAP macro</title>
<updated>2017-01-30T22:17:00Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-28T21:40:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=35d803bc9a0d21c36b1381f6e42455beeb73b715'/>
<id>urn:sha1:35d803bc9a0d21c36b1381f6e42455beeb73b715</id>
<content type='text'>
Apply the semantic patch swap.cocci to convert hand-rolled swaps to use
the macro SWAP.  The resulting code is shorter and easier to read, the
object code is effectively unchanged.

The patch for object.c had to be hand-edited in order to preserve the
comment before the change; Coccinelle tried to eat it for some reason.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>line-range: reject -L line numbers less than 1</title>
<updated>2013-08-06T21:48:55Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-08-06T13:59:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5ce922a014f78684a96c3d03a51decf0d21fa58d'/>
<id>urn:sha1:5ce922a014f78684a96c3d03a51decf0d21fa58d</id>
<content type='text'>
Since inception, git-blame -L has been documented as accepting 1-based
line numbers. When handed a line number less than 1, -L's behavior is
undocumented and undefined; it's also nonsensical and should be
diagnosed as an error. Do so.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>line-range: teach -L^:RE to search from start of file</title>
<updated>2013-08-06T21:48:02Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-08-06T13:59:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=215e76c7ff8be46b8206c45aed3b6ec29069d4fc'/>
<id>urn:sha1:215e76c7ff8be46b8206c45aed3b6ec29069d4fc</id>
<content type='text'>
The -L:RE option of blame/log searches from the end of the previous -L
range, if any. Add new notation -L^:RE to override this behavior and
search from start of file.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>line-range: teach -L:RE to search from end of previous -L range</title>
<updated>2013-08-06T21:47:34Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-08-06T13:59:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1ce761a524e34f2d629759cb57c67d13acbe4a7a'/>
<id>urn:sha1:1ce761a524e34f2d629759cb57c67d13acbe4a7a</id>
<content type='text'>
For consistency with -L/RE/, teach -L:RE to search relative to the end
of the previous -L range, if any.

The new behavior invalidates one test in t4211 which assumes that -L:RE
begins searching at start of file. This test will be resurrected in a
follow-up patch which teaches -L:RE how to override the default relative
search behavior.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>line-range: teach -L^/RE/ to search from start of file</title>
<updated>2013-08-06T21:47:04Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2013-08-06T13:59:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6ac5f9864958f65269d8d58a049324403b039fd'/>
<id>urn:sha1:a6ac5f9864958f65269d8d58a049324403b039fd</id>
<content type='text'>
The -L/RE/ option of blame/log searches from the end of the previous -L
range, if any. Add new notation -L^/RE/ to override this behavior and
search from start of file.

The new ^/RE/ syntax is valid only as the &lt;start&gt; argument of
-L&lt;start&gt;,&lt;end&gt;. The &lt;end&gt; argument, as usual, is relative to &lt;start&gt;.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
