From 077a1fda82b237c16eb10bd988650468683a94b5 Mon Sep 17 00:00:00 2001 From: Josh Holland Date: Tue, 19 Nov 2019 15:08:10 +0000 Subject: userdiff: support Python async functions Python's async functions (declared with "async def" rather than "def") were not being displayed in hunk headers. This commit teaches git about the async function syntax, and adds tests for the Python userdiff regex. Signed-off-by: Josh Holland Acked-by: Johannes Sixt Signed-off-by: Junio C Hamano --- userdiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'userdiff.c') diff --git a/userdiff.c b/userdiff.c index e74a6d4022..057fdcc55c 100644 --- a/userdiff.c +++ b/userdiff.c @@ -124,7 +124,7 @@ PATTERNS("php", "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+" "|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"), -PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$", +PATTERNS("python", "^[ \t]*((class|(async[ \t]+)?def)[ \t].*)$", /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?" -- cgit v1.2.3