Skip to content

Commit 09188ed

Browse files
JDeepDgitster
authored andcommitted
userdiff: add builtin diff driver for kotlin language.
The xfuncname pattern finds func/class declarations in diffs to display as a hunk header. The word_regex pattern finds individual tokens in Kotlin code to generate appropriate diffs. This patch adds xfuncname regex and word_regex for Kotlin language. Signed-off-by: Jaydeep P Das <[email protected]> Acked-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 715d08a commit 09188ed

15 files changed

+167
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ patterns are available:
829829

830830
- `java` suitable for source code in the Java language.
831831

832+
- `kotlin` suitable for source code in the Kotlin language.
833+
832834
- `markdown` suitable for Markdown documents.
833835

834836
- `matlab` suitable for source code in the MATLAB and Octave languages.

t/t4018/kotlin-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class RIGHT {
2+
//comment
3+
//comment
4+
return ChangeMe
5+
}

t/t4018/kotlin-enum-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum class RIGHT{
2+
// Left
3+
// a comment
4+
ChangeMe
5+
}

t/t4018/kotlin-fun

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fun RIGHT(){
2+
//a comment
3+
//b comment
4+
return ChangeMe()
5+
}

t/t4018/kotlin-inheritace-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
open class RIGHT{
2+
// a comment
3+
// b comment
4+
// ChangeMe
5+
}

t/t4018/kotlin-inline-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
value class RIGHT(Args){
2+
// a comment
3+
// b comment
4+
ChangeMe
5+
}

t/t4018/kotlin-interface

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface RIGHT{
2+
//another comment
3+
//another comment
4+
//ChangeMe
5+
}

t/t4018/kotlin-nested-fun

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class LEFT{
2+
class CENTER{
3+
fun RIGHT( a:Int){
4+
//comment
5+
//comment
6+
ChangeMe
7+
}
8+
}
9+
}

t/t4018/kotlin-public-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class RIGHT{
2+
//comment1
3+
//comment2
4+
ChangeMe
5+
}

t/t4018/kotlin-sealed-class

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sealed class RIGHT {
2+
// a comment
3+
// b comment
4+
ChangeMe
5+
}

0 commit comments

Comments
 (0)