]> git.ipfire.org Git - thirdparty/git.git/commit - userdiff.c
userdiff: improve java hunk header regex
authorTassilo Horn <tsdh@gnu.org>
Wed, 11 Aug 2021 17:51:04 +0000 (19:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Aug 2021 18:11:30 +0000 (11:11 -0700)
commita8cbc895893f4c244e54374d3bf937819fb6e2e9
treebd64b7138c041098729e792130e4a7a9cb620ac0
parent2d755dfac9aadab25c3e025b849252b8c0a61465
userdiff: improve java hunk header regex

Currently, the git diff hunk headers show the wrong method signature if the
method has a qualified return type, an array return type, or a generic return
type because the regex doesn't allow dots (.), [], or < and > in the return
type.  Also, type parameter declarations couldn't be matched.

Add several t4018 tests asserting the right hunk headers for different cases:

  - enum constant change
  - change in generic method with bounded type parameters
  - change in generic method with wildcard
  - field change in a nested class

Signed-off-by: Tassilo Horn <tsdh@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4018/java-class-member-function
t/t4018/java-enum-constant [new file with mode: 0644]
t/t4018/java-method-return-generic-bounded [new file with mode: 0644]
t/t4018/java-method-return-generic-wildcard [new file with mode: 0644]
t/t4018/java-nested-field [new file with mode: 0644]
userdiff.c