<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t4018-diff-funcname.sh, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-04-01T16:19:42Z</updated>
<entry>
<title>Merge branch 'rr/tests-dedup-test-config' into maint</title>
<updated>2013-04-01T16:19:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-01T16:19:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5753e1709e181c5fbf96ae114481adbaa3129782'/>
<id>urn:sha1:5753e1709e181c5fbf96ae114481adbaa3129782</id>
<content type='text'>
* rr/tests-dedup-test-config:
  t4018,7810,7811: remove test_config() redefinition
</content>
</entry>
<entry>
<title>t4018,7810,7811: remove test_config() redefinition</title>
<updated>2013-03-19T16:10:15Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2013-03-19T10:43:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3f21fb99ab5335146617f21b885dc41afc7943d6'/>
<id>urn:sha1:3f21fb99ab5335146617f21b885dc41afc7943d6</id>
<content type='text'>
test_config() is already a well-defined function in
test-lib-functions.sh.  Don't duplicate it unnecessarily.

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add userdiff patterns for Ada</title>
<updated>2012-09-17T04:54:47Z</updated>
<author>
<name>Adrian Johnson</name>
<email>ajohnson@redneon.com</email>
</author>
<published>2012-09-16T03:54:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e90d065e64702d09fbdfc7cfd1c97456c7faa74c'/>
<id>urn:sha1:e90d065e64702d09fbdfc7cfd1c97456c7faa74c</id>
<content type='text'>
Add Ada xfuncname and wordRegex patterns to the list of builtin
patterns.

Signed-off-by: Adrian Johnson &lt;ajohnson@redneon.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add built-in diff patterns for MATLAB code</title>
<updated>2011-11-16T00:11:52Z</updated>
<author>
<name>Gustaf Hendeby</name>
<email>hendeby@isy.liu.se</email>
</author>
<published>2011-11-15T20:15:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=53b10a140527253f61cfc209a4e85e132c0bc4ee'/>
<id>urn:sha1:53b10a140527253f61cfc209a4e85e132c0bc4ee</id>
<content type='text'>
MATLAB is often used in industry and academia for scientific
computations motivating it being included as a built-in pattern.

Signed-off-by: Gustaf Hendeby &lt;hendeby@isy.liu.se&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters</title>
<updated>2011-05-23T18:39:13Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-22T17:29:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f143d9c695cd4c3e86069c536fa0dff04fc93e93'/>
<id>urn:sha1:f143d9c695cd4c3e86069c536fa0dff04fc93e93</id>
<content type='text'>
A naive method of treating BEGIN/END blocks with a brace on the second
line as diff/grep funcname context involves also matching unrelated
lines that consist of all-caps letters:

	sub foo {
		print &lt;&lt;'EOF'
	text goes here
	...
	EOF
		... rest of foo ...
	}

That's not so great, because it means that "git diff" and "git grep
--show-function" would write "=EOF" or "@@ EOF" as context instead of
a more useful reminder like "@@ sub foo {".

To avoid this, tighten the pattern to only match the special block
names that perl accepts (namely BEGIN, END, INIT, CHECK, UNITCHECK,
AUTOLOAD, and DESTROY).  The list is taken from perl's toke.c.

Suggested-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff/perl: catch sub with brace on second line</title>
<updated>2011-05-22T05:29:32Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-21T19:38:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ea2ca4497bdb716977a3e2526780635cb6bac513'/>
<id>urn:sha1:ea2ca4497bdb716977a3e2526780635cb6bac513</id>
<content type='text'>
Accept

	sub foo
	{
	}

as an alternative to a more common style that introduces perl
functions with a brace on the first line (and likewise for BEGIN/END
blocks).  The new regex is a little hairy to avoid matching

	# forward declaration
	sub foo;

while continuing to match "sub foo($;@) {" and

	sub foo { # This routine is interesting;
		# in fact, the lines below explain how...

While at it, pay attention to Perl 5.14's "package foo {" syntax as an
alternative to the traditional "package foo;".

Requested-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff/perl: match full line of POD headers</title>
<updated>2011-05-22T05:29:32Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-21T19:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12f0967a8a1e3c11c678de181f77d1c7883b37cf'/>
<id>urn:sha1:12f0967a8a1e3c11c678de181f77d1c7883b37cf</id>
<content type='text'>
The builtin perl userdiff driver is not greedy enough about catching
POD header lines.  Capture the whole line, so instead of just
declaring that we are in some "@@ =head1" section, diff/grep output
can explain that the enclosing section is about "@@ =head1 OPTIONS".

Reported-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff/perl: anchor "sub" and "package" patterns on the left</title>
<updated>2011-05-22T05:29:31Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-21T19:29:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f12c66b9bb851aa7350d40370e6adf78535c5930'/>
<id>urn:sha1:f12c66b9bb851aa7350d40370e6adf78535c5930</id>
<content type='text'>
The userdiff funcname mechanism has no concept of nested scopes ---
instead, "git diff" and "git grep --show-function" simply label the
diff header with the most recent matching line.  Unfortunately that
means text following a subroutine in a POD section:

	=head1 DESCRIPTION

	You might use this facility like so:

		sub example {
			foo;
		}

	Now, having said that, let's say more about the facility.
	Blah blah blah ... etc etc.

gets the subroutine name instead of the POD header in its diff/grep
funcname header, making it harder to get oriented when reading a
diff without enough context.

The fix is simple: anchor the funcname syntax to the left margin so
nested subroutines and packages like this won't get picked up.  (The
builtin C++ funcname pattern already does the same thing.)  This means
the userdiff driver will misparse the idiom

	{
		my $static;
		sub foo {
			... use $static ...
		}
	}

but I think that's worth it; we can revisit this later if the userdiff
mechanism learns to keep track of the beginning and end of nested
scopes.

Reported-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4018 (funcname patterns): minor cleanups</title>
<updated>2011-05-22T05:29:31Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-21T19:25:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d64d6cdc2071d1eb7f6a45118edc42627e6fc692'/>
<id>urn:sha1:d64d6cdc2071d1eb7f6a45118edc42627e6fc692</id>
<content type='text'>
Introduce a test_expect_funcname function to make a diff and apply a
regexp anchored on the left to the function name it writes, avoiding
some repetition.

Omit the space after &gt;, &lt;&lt;, and &lt; operators for consistency with
other scripts.  Quote the &lt;&lt;here document delimiter and $ signs in
quotes so readers don't have to worry about the effect of shell
metacharacters.

Remove some unnecessary blank lines.

Run "git diff" as a separate command instead of as upstream of a pipe
that checks its output, so the exit status can be tested.  In
particular, this way if "git diff" starts segfaulting the test harness
will notice.

Allow "error:" as a synonym for "fatal:" when checking error messages,
since whether a command uses die() or "return error()" is a small
implementation detail.

Anchor some more regexes on the right.

None of the above is very important on its own; the point is just to
make the script a little easier to read and the code less scary to
modify.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4018 (funcname patterns): make configuration easier to track</title>
<updated>2011-05-22T05:29:30Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2011-05-21T19:22:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f792a0b88ec24dd20c29282b4e022c7b48abd59b'/>
<id>urn:sha1:f792a0b88ec24dd20c29282b4e022c7b48abd59b</id>
<content type='text'>
Introduce a "test_config" function to set a configuration variable
for use by a single test (automatically unsetting it when the
assertion finishes).  If this function is used consistently, the
configuration used in a test_expect_success block can be read at the
beginning of that block instead of requiring reading all the tests
that come before.  So it becomes a little easier to add new tests or
rearrange existing ones without fear of breaking configuration.

In particular, the test of alternation in xfuncname patterns also
checks that xfuncname takes precedence over funcname variable as a
sort of side-effect, since the latter leaks in from previous tests.
In the new syntax, the test has to say explicitly what variables it is
using, making the test clearer and a future regression in coverage
from carelessly editing the script less likely.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
