From patchwork Thu Apr 8 15:04:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6039CC43461 for ; Thu, 8 Apr 2021 15:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3748B6105A for ; Thu, 8 Apr 2021 15:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232023AbhDHPEu (ORCPT ); Thu, 8 Apr 2021 11:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231945AbhDHPEr (ORCPT ); Thu, 8 Apr 2021 11:04:47 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D661AC061761 for ; Thu, 8 Apr 2021 08:04:35 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a7so3640198eju.1 for ; Thu, 08 Apr 2021 08:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gpq308t+h17CsQKKzze7TVCCrvUv5ln1zLVamrI/oSU=; b=P9J8bRMubSBmGiOynh54uddXQNtmaLjnmSThhS3mQ0zJTV1Al4Ur61yiXzQvFyWep4 cA/90ItTiETK7XPib6r/it+EENhlZYvt7G3l4OR9X/W2RQJCwEFARjyqPgIcO2q+ZkMm pY1E7MHaou9DI/xbUzIEdlbbH1aAdEvU3rozZqmQmEHXlC1N9J0Ehvq85o4BcqO+YNow IIOKfsX/BMLWpNjKARfJbzEVcAuP33Tm3vDQqfwqxB6NtieqeGOsdhd5YDnrasGR7PiW +oRs99j5aLTKTT/06yraF58QvACAJDwjvkeJXfnCgM8OshqW5zQ8uy+dMAp2zdgk9LcY INLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gpq308t+h17CsQKKzze7TVCCrvUv5ln1zLVamrI/oSU=; b=f7FUyMbYUs6d55bMVWunioxTigbiiJUs/1df4mRPhGpqcUbxaGDJUDVe/bkJ8n5IZG b89m752VnKmf2GHODJ4mPPbZW+YeBzBIkeBkkJtMdaruNzJ3isicbqXu1ZfXrJfmwz2w e7ItLa5uYUvi3UX7YoF6LMUNQD8MGziYyA6d7kRUiRd+XXPfJN4LAS3VcDGVGvzzx/ua Btx2+wQOkG5/jqaoBriqrdOfgIOnAmtz++F2cAtbdwxvHv7zcLFo2vnhg1UwspQVubWe zovz8O7wY337j6N5QGTAPS5uyJFnivFxO5ITGGX6GJX0agEbyTjomHY26Btw9Ne1WMsC VQcw== X-Gm-Message-State: AOAM531XkFb83EIoAbbo+hEggrdnEmND28CmT/BYgsWm921Kt0QEqJIF 98wFcLqZ/bOGNvchSrgGyvfJizk4gz7Taw== X-Google-Smtp-Source: ABdhPJw2OXs+Gso2ilMik8VHmuJ4vTqaXy4zOijfEYrXi4j+xh7m04t12+L+l6lB82NocOY9Dmuo1A== X-Received: by 2002:a17:906:360c:: with SMTP id q12mr10930351ejb.519.1617894274083; Thu, 08 Apr 2021 08:04:34 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:33 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 2/9] userdiff style: declare patterns with consistent style Date: Thu, 8 Apr 2021 17:04:17 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change those patterns which were declared with a regex on the same line as the "PATTERNS()" line to put that regex on the next line, and add missing "/* -- */" separator comments between the pattern and word_regex. Signed-off-by: Ævar Arnfjörð Bjarmason --- userdiff.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/userdiff.c b/userdiff.c index 650f421d63..33b0ce4020 100644 --- a/userdiff.c +++ b/userdiff.c @@ -44,7 +44,9 @@ PATTERNS("bash", /* -- */ /* Characters not in the default $IFS value */ "[^ \t]+"), -PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$", +PATTERNS("bibtex", + "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$", + /* -- */ "[={}\"]|[^={}\" \t]+"), PATTERNS("cpp", /* Jump targets or access declarations */ @@ -121,7 +123,9 @@ IPATTERN("fortran", * they would have been matched above as a variable anyway. */ "|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?" "|//|\\*\\*|::|[/<>=]="), -IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$", +IPATTERN("fountain", + "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$", + /* -- */ "[^ \t-]+"), PATTERNS("golang", /* Functions */ @@ -132,7 +136,9 @@ PATTERNS("golang", "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.eE]+i?|0[xX]?[0-9a-fA-F]+i?" "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&\\^=?|&&|\\|\\||<-|\\.{3}"), -PATTERNS("html", "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$", +PATTERNS("html", + "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$", + /* -- */ "[^<>= \t]+"), PATTERNS("java", "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n" @@ -144,6 +150,7 @@ PATTERNS("java", "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"), PATTERNS("markdown", "^ {0,3}#{1,6}[ \t].*", + /* -- */ "[^<>= \t]+"), PATTERNS("matlab", /* @@ -152,6 +159,7 @@ PATTERNS("matlab", * that is understood by both. */ "^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$", + /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\.[*/\\^']|\\|\\||&&"), PATTERNS("objc", /* Negate C statements that can look like functions */ @@ -212,13 +220,15 @@ PATTERNS("php", "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+" "|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"), -PATTERNS("python", "^[ \t]*((class|(async[ \t]+)?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]?" "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"), /* -- */ -PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$", +PATTERNS("ruby", + "^[ \t]*((class|module|def)[ \t].*)$", /* -- */ "(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?." From patchwork Thu Apr 8 15:04:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFCC1C433ED for ; Thu, 8 Apr 2021 15:04:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9974E61103 for ; Thu, 8 Apr 2021 15:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232047AbhDHPEx (ORCPT ); Thu, 8 Apr 2021 11:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232021AbhDHPEt (ORCPT ); Thu, 8 Apr 2021 11:04:49 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A52C061762 for ; Thu, 8 Apr 2021 08:04:36 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id e7so2809470edu.10 for ; Thu, 08 Apr 2021 08:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+d6pXeEC9cH26a7N+5HnU/jqtHaZtHFehcFwlOwOd4c=; b=OU4PvnY3X5MI6hNM7fhrdwnvRoyVeVFbcYQRFjjr7D+YOPy3Tl8awPYTHY6cIIOgUI UlXb4D3fRTVh/7yaXkc1E3LWtt/rdi0KirH9NCdmFd/vfvbJAt2qFQV0lVhtu9osG6gK bfLzMJJN4p+w0T16T4mjEWItPxwvHhlsIp7EaPnUrz1OsV4pDit5VQ9oSPdcZV++txRp VEk0kv22kAc2xHaFp0WD+WUHHNWRjXhqvcjGzPmXJ8hiVMcZQic+TvtX/AeJ2J/xvZQc 8jK0nb9N51GaOec+nk4qW5CKW64LT5iL9PtcuXW2inZm62zzDuF9gHl1u0tM2Cak223O Qt0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+d6pXeEC9cH26a7N+5HnU/jqtHaZtHFehcFwlOwOd4c=; b=Kl4VexHr3sP6M6HnedYEVnwymdJZAY5W9YLDyc1p+e/t/orN7FG+zG5v/d0/WK9kAk oKf9hQUvak4sw7pbfTbiLK3QUQ0iWavoGrVklQu6glijSYqmT5g4LE7rd2DZ149eB0Ut jUuibdmlVrdI7b6MVeHfpjSa6LJ4+VZRWDNryaIH9RNGeN1s9Ym4GOYYWsfF6yioK7DY 5zd27Atr8/Av/eivTRwLM1b/adsXqMA1Cr3afTvyUM89p04BgC93UG4YfttuIWW2iOIO rG+6HnbBjo0eR/f0TyENffjTZpevEAxY2w0W2/ay947mhqzBOOPVp3SlPMmCi7Iu5qWp EzqQ== X-Gm-Message-State: AOAM532StOB55SQJvxpa9m5V4ASScXjjX/1VOHWddO+rQXOs4M2bbOad k/ifKvJQi4AHbN3qZRcZgyuKWP1N1atGKQ== X-Google-Smtp-Source: ABdhPJzELFyzuO//r/4IZf9pOVz57h8jZJF0cqKNOU5yvI9gVi+UYmSxF/KEA8k8W73K3rTv0GRBtw== X-Received: by 2002:a50:f0da:: with SMTP id a26mr5974450edm.342.1617894275080; Thu, 08 Apr 2021 08:04:35 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:34 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 3/9] userdiff style: normalize pascal regex declaration Date: Thu, 8 Apr 2021 17:04:18 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Declare the pascal pattern consistently with how we declare the others, not having "\n" on one line by itself, but as part of the pattern, and when there are alterations have the "|" at the start, not end of the line. Signed-off-by: Ævar Arnfjörð Bjarmason --- userdiff.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/userdiff.c b/userdiff.c index 33b0ce4020..978ae64155 100644 --- a/userdiff.c +++ b/userdiff.c @@ -175,9 +175,8 @@ PATTERNS("objc", "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), PATTERNS("pascal", - "^(((class[ \t]+)?(procedure|function)|constructor|destructor|interface|" - "implementation|initialization|finalization)[ \t]*.*)$" - "\n" + "^(((class[ \t]+)?(procedure|function)|constructor|destructor|interface" + "|implementation|initialization|finalization)[ \t]*.*)$\n" "^(.*=[ \t]*(class|record).*)$", /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" From patchwork Thu Apr 8 15:04:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E1B9C43461 for ; Thu, 8 Apr 2021 15:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BE40610F9 for ; Thu, 8 Apr 2021 15:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbhDHPEy (ORCPT ); Thu, 8 Apr 2021 11:04:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbhDHPEt (ORCPT ); Thu, 8 Apr 2021 11:04:49 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 792F7C061760 for ; Thu, 8 Apr 2021 08:04:37 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id f8so2812328edd.11 for ; Thu, 08 Apr 2021 08:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b70j4mGhbot8iZZ6rPdNtmO2HbpTClAX/seAv5d3a28=; b=XTzyoEVdA+ROIY7NzeRn8BBJ3qGUf9P5T4VdqGTZ94KzsRCtXLaeHk4RoYvlErt5lf AxL+rCbG3RAZTZ2E8NR/661uhut+UU7ZmN87f8k1fGCCsYY7pqLsuN/EREU3ZoEQ79Ny 3G0jJcT2sVtqPs5bKGqSUtgK0ZXvJ9wDDpbTa6hXuwXmMmDSmrDxRYDJIq4d/ewn3kIF lTv2v/EUJ+xaV60uu2FJ8ns46shEzQpAul+S3MtIYVY4cHn5fTFh24YYIhc73CbZGh7G 4lrqjEqon4mlkvj+xT8S8jB7EWkRqxeQ/JfEqe0duyXjcA2/xP4jFJxukswqD17r3CZ4 lC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b70j4mGhbot8iZZ6rPdNtmO2HbpTClAX/seAv5d3a28=; b=PJo3b4s0q5PGRH9nNt6RhnJvmaRkpF5/H5n+/V0MFKLsiEJs3t4wxa49DpZLtpOyJF WEvnniW8GIGe3wWnMmXAJEZFtqYJzdRjH/eTKb///pCE7Xha7w26V4wgEjN52toH/otL bXCnRfQ5NOBD4R5PQRXA7iORNvvaopnJOKMig2CHvBIeYVTsJR/ZsTO45YoJWdq9lXFz r8Jls/AGs/axQVUj1jLXlr1gVfX5px2pFIlbFpnncf8HcWFExUxNGAAWDWuyOulv5qLr iS11kXvR75uV/fP/wRndMVbu2JueKilXRAaV+C2m7D4AyLjwd2RRkPY/LI7jBAQ+tMN6 IpyA== X-Gm-Message-State: AOAM532CiSCTPWz37mR2uKkqn/lXVyTvPhjNcebPmZxDBtvypu1Nprwy gBe4GLPUY2ETGdTySUuqnFNQyf5DeKMz1A== X-Google-Smtp-Source: ABdhPJz1yJjoCLXoByCv5NX1WCiY6BnK5AiK1zYsf+NPCUXxTWFECHwN9H1tZIzNQk3WqzDDGmQ6ww== X-Received: by 2002:a05:6402:2787:: with SMTP id b7mr11961814ede.225.1617894275882; Thu, 08 Apr 2021 08:04:35 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:35 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 4/9] userdiff: add and use for_each_userdiff_driver() Date: Thu, 8 Apr 2021 17:04:19 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor the userdiff_find_by_namelen() function so that a new for_each_userdiff_driver() API function does most of the work. This will be useful for the same reason we've got other for_each_*() API functions as part of various APIs, and will be used in a follow-up commit. Signed-off-by: Ævar Arnfjörð Bjarmason --- userdiff.c | 70 ++++++++++++++++++++++++++++++++++++++++++++---------- userdiff.h | 13 ++++++++++ 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/userdiff.c b/userdiff.c index 978ae64155..a667ccaa8c 100644 --- a/userdiff.c +++ b/userdiff.c @@ -259,20 +259,33 @@ static struct userdiff_driver driver_false = { { NULL, 0 } }; -static struct userdiff_driver *userdiff_find_by_namelen(const char *k, size_t len) +struct find_by_namelen_data { + const char *name; + size_t len; + struct userdiff_driver *driver; +}; + +static int userdiff_find_by_namelen_cb(struct userdiff_driver *driver, + enum userdiff_driver_type type, void *priv) { - int i; - for (i = 0; i < ndrivers; i++) { - struct userdiff_driver *drv = drivers + i; - if (!strncmp(drv->name, k, len) && !drv->name[len]) - return drv; - } - for (i = 0; i < ARRAY_SIZE(builtin_drivers); i++) { - struct userdiff_driver *drv = builtin_drivers + i; - if (!strncmp(drv->name, k, len) && !drv->name[len]) - return drv; + struct find_by_namelen_data *cb_data = priv; + + if (!strncmp(driver->name, cb_data->name, cb_data->len) && + !driver->name[cb_data->len]) { + cb_data->driver = driver; + return 1; /* tell the caller to stop iterating */ } - return NULL; + return 0; +} + +static struct userdiff_driver *userdiff_find_by_namelen(const char *name, size_t len) +{ + struct find_by_namelen_data udcbdata = { + .name = name, + .len = len, + }; + for_each_userdiff_driver(userdiff_find_by_namelen_cb, &udcbdata); + return udcbdata.driver; } static int parse_funcname(struct userdiff_funcname *f, const char *k, @@ -379,3 +392,36 @@ struct userdiff_driver *userdiff_get_textconv(struct repository *r, return driver; } + +static int for_each_userdiff_driver_list(each_userdiff_driver_fn fn, + enum userdiff_driver_type type, void *cb_data, + struct userdiff_driver *drv, + int drv_size) +{ + int i; + int ret; + for (i = 0; i < drv_size; i++) { + struct userdiff_driver *item = drv + i; + if ((ret = fn(item, type, cb_data))) + return ret; + } + return 0; +} + +int for_each_userdiff_driver(each_userdiff_driver_fn fn, void *cb_data) +{ + int ret; + + ret = for_each_userdiff_driver_list(fn, USERDIFF_DRIVER_TYPE_CUSTOM, + cb_data, drivers, ndrivers); + if (ret) + return ret; + + ret = for_each_userdiff_driver_list(fn, USERDIFF_DRIVER_TYPE_BUILTIN, + cb_data, builtin_drivers, + ARRAY_SIZE(builtin_drivers)); + if (ret) + return ret; + + return 0; +} diff --git a/userdiff.h b/userdiff.h index 203057e13e..aee91bc77e 100644 --- a/userdiff.h +++ b/userdiff.h @@ -21,6 +21,12 @@ struct userdiff_driver { struct notes_cache *textconv_cache; int textconv_want_cache; }; +enum userdiff_driver_type { + USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0, + USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1, +}; +typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *, + enum userdiff_driver_type, void *); int userdiff_config(const char *k, const char *v); struct userdiff_driver *userdiff_find_by_name(const char *name); @@ -34,4 +40,11 @@ struct userdiff_driver *userdiff_find_by_path(struct index_state *istate, struct userdiff_driver *userdiff_get_textconv(struct repository *r, struct userdiff_driver *driver); +/* + * Iterate over all userdiff drivers. The userdiff_driver_type + * argument to each_userdiff_driver_fn indicates their type. Return + * non-zero to exit early from the loop. + */ +int for_each_userdiff_driver(each_userdiff_driver_fn, void *); + #endif /* USERDIFF */ From patchwork Thu Apr 8 15:04:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BB30C433ED for ; Thu, 8 Apr 2021 15:04:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FE5961103 for ; Thu, 8 Apr 2021 15:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232056AbhDHPE4 (ORCPT ); Thu, 8 Apr 2021 11:04:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232027AbhDHPEv (ORCPT ); Thu, 8 Apr 2021 11:04:51 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A956C061761 for ; Thu, 8 Apr 2021 08:04:38 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id g17so2069484edm.6 for ; Thu, 08 Apr 2021 08:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SdUtIdk8Z944TLl9WC+jioSzhOQ0QTapNRoc7do+JeI=; b=defo6R2zdYsJMoljQgoXELRslqTaGi/bmJJSrLEcgMuwKuAXfHmakAdkIjFCpxFDon Cm+BzlpXEVqIWzYhKvrskW4ozsNpnPb+6JoN++wvFaOiuuHAvoONePGyvtV+3+y5/Ani j5ALFkS+y/tA638hjuJJ78PCKaJ3xoEZUCDb5roRIbugQ61AHuZBc7yObiYtjavHBjjY BQaXMyUZWaN+HtXpEOpbzQFbbef9znl27tYhY5ZSfFX2YGuqYrdGHaChx4kqT8La3nQr hW0RmlPMTcog4Z80TgW1tWVU0CHDaD6UqoJLTkMow9rOOWsnVHzZBKqehzITJ2gPX7g7 bRow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SdUtIdk8Z944TLl9WC+jioSzhOQ0QTapNRoc7do+JeI=; b=gwcYQAiO8qXybbmodq2mrT2QhTs28Aew+YVWctFHoXLxCPs6sAulDBzDITio+YE3n9 WaBSnybc+2gEx/r0Z+T6Phf9/X6ZWqNt37YQLzD7Mv5TkPd4ieGJYGB0PhNzSccU3/C4 lZQJwUL+g54zT9x45TovziRyH5TP4jwJ012VQJJbejvfVjd8JyUQRC6icndWnL329PUS RbP9SQeJch4U7VWTK3/ihqHswNeao0wg5K0qQ5Z5G1sFSbT5jRIByL6fKsCrS2qPoznv 4A4avguqRxNi98ciThQ+B7OFgUCwMiep1rMzb7OGkThLkN4PS6iUa/U6DKciE+jq3KSx g1sQ== X-Gm-Message-State: AOAM530U1TxBCaz8i5kco5h/2YI0OkPMlGmR7r2nWn/BjJWaXDwYG6YD EiEvOPOOjcjVH3BQMsY5O15E2RnPPWT+KQ== X-Google-Smtp-Source: ABdhPJxrVPy7o0mNBnCigwj01QzO8mFWEnRVSnTz8F87/P1IvqifpDAMI22uhxxHcV0sILI/VG2zOg== X-Received: by 2002:a05:6402:4301:: with SMTP id m1mr12416539edc.210.1617894276726; Thu, 08 Apr 2021 08:04:36 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:36 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 5/9] userdiff tests: explicitly test "default" pattern Date: Thu, 8 Apr 2021 17:04:20 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since 122aa6f9c0 (diff: introduce diff..binary, 2008-10-05) the internals of the userdiff.c code have understood a "default" name, which is invoked as userdiff_find_by_name("default") and present in the "builtin_drivers" struct. Let's test for this special case. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4018-diff-funcname.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 9675bc17db..cefe329aea 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -49,6 +49,7 @@ diffpatterns=" ruby rust tex + default custom1 custom2 custom3 From patchwork Thu Apr 8 15:04:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65AE6C433B4 for ; Thu, 8 Apr 2021 15:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AC2761130 for ; Thu, 8 Apr 2021 15:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbhDHPEz (ORCPT ); Thu, 8 Apr 2021 11:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232026AbhDHPEu (ORCPT ); Thu, 8 Apr 2021 11:04:50 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2359DC061760 for ; Thu, 8 Apr 2021 08:04:39 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id e7so2809666edu.10 for ; Thu, 08 Apr 2021 08:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ommvJluwKP5YpZ57gYrNfOqyoFWcKLD0RR/b5jTfGWQ=; b=eIHP6aQbjC/Mt1AARgtYlCjbHzgF5PNwzSbebyCN4NYTBC3U/X8IwDPWKX5mz5coiq QbWePsmXmvuou9TWwd9T90QAtUgSlkCfYssLqwCWjVD9XGHTcxHo/3C+QVAtx6EtiIYi tgMMuy+TLug7qu9lU8T9CFEjpdjXxQRYThhuE9A3jRLQk4t91MVzgxARYblOyTSzqWww 8NEsO5cSQ+8/H9owUWKqeR0IaZGMRsIZ+S85Wm+XUhD71XVTE4ujb9eCmXIFio/0MtmU TcBTB77Ch8KN9KmtcqtkUFYj8MzZweV4ZapDkWpjkpUHtxh+GNbf2gyH0+NfTxMjqrTW JcKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ommvJluwKP5YpZ57gYrNfOqyoFWcKLD0RR/b5jTfGWQ=; b=uCna0GX1+Jc9oxuTAOrnr+0lPu0QVgvYIbxIre+NFj5ZiT/khQo0Q4k7VHZiAdu1W0 skNpqOQexcR7Mn+V/NQD0V3e69AQwq3RGcyozox51nvAFDuqcaw0wCYCe2esiwIzsWX4 bOtUPVKKyQPXKxnYPEeh94eUZjppFFJgKlQ+6NC9XVpCDL5QzbfFhZP9DGzi3xPPjmt9 EY2Ef7p/XEoZ3tlcjpmKAGbQ5v3b3OBL30OVI46HA/AYKhEZPNo3pdkPhLKDCfTzSw8y inXuqsOP258mq96jzVbdmV3GvjqZ8Py92GEn7hsmWhAYAWk/3ohKWVwL779Oz7j/Ahze 4wHQ== X-Gm-Message-State: AOAM531q8p6fZbgmWPM5O6nF2hI1FPL6DeWNK0ZREvgJwezvndSCZazu G0ksQmZqKQaqtsfNF9OM2Aq3grlASpwr4Q== X-Google-Smtp-Source: ABdhPJy0l0IqwmrFcVTZSel7gKJyEIpAVSSgmZLQy/bnXpt6Fv1jbxtF7WQGCNepjJSn/g+dvDzjHg== X-Received: by 2002:a05:6402:17af:: with SMTP id j15mr12163563edy.50.1617894277597; Thu, 08 Apr 2021 08:04:37 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:37 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 6/9] userdiff tests: list builtin drivers via test-tool Date: Thu, 8 Apr 2021 17:04:21 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the userdiff test to list the builtin drivers via the test-tool, using the new for_each_userdiff_driver() API function. This gets rid of the need to modify this part of the test every time a new pattern is added, see 2ff6c34612 (userdiff: support Bash, 2020-10-22) and 09dad9256a (userdiff: support Markdown, 2020-05-02) for two recent examples. I only need the "list-builtin-drivers "argument here, but let's add "list-custom-drivers" and "list-drivers" too, just because it's easy. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 1 + t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/helper/test-userdiff.c | 46 ++++++++++++++++++++++++++++++++++++++++ t/t4018-diff-funcname.sh | 46 +++++++++++++++++----------------------- 5 files changed, 68 insertions(+), 27 deletions(-) create mode 100644 t/helper/test-userdiff.c diff --git a/Makefile b/Makefile index a6a73c5741..d2ba9bb402 100644 --- a/Makefile +++ b/Makefile @@ -752,6 +752,7 @@ TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o TEST_BUILTINS_OBJS += test-subprocess.o TEST_BUILTINS_OBJS += test-trace2.o TEST_BUILTINS_OBJS += test-urlmatch-normalization.o +TEST_BUILTINS_OBJS += test-userdiff.o TEST_BUILTINS_OBJS += test-wildmatch.o TEST_BUILTINS_OBJS += test-windows-named-pipe.o TEST_BUILTINS_OBJS += test-write-cache.o diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 287aa60023..bf13b1f8c1 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -72,6 +72,7 @@ static struct test_cmd cmds[] = { { "submodule-nested-repo-config", cmd__submodule_nested_repo_config }, { "subprocess", cmd__subprocess }, { "trace2", cmd__trace2 }, + { "userdiff", cmd__userdiff }, { "urlmatch-normalization", cmd__urlmatch_normalization }, { "xml-encode", cmd__xml_encode }, { "wildmatch", cmd__wildmatch }, diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h index 9ea4b31011..698f95bf46 100644 --- a/t/helper/test-tool.h +++ b/t/helper/test-tool.h @@ -62,6 +62,7 @@ int cmd__submodule_config(int argc, const char **argv); int cmd__submodule_nested_repo_config(int argc, const char **argv); int cmd__subprocess(int argc, const char **argv); int cmd__trace2(int argc, const char **argv); +int cmd__userdiff(int argc, const char **argv); int cmd__urlmatch_normalization(int argc, const char **argv); int cmd__xml_encode(int argc, const char **argv); int cmd__wildmatch(int argc, const char **argv); diff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c new file mode 100644 index 0000000000..f013f8a31e --- /dev/null +++ b/t/helper/test-userdiff.c @@ -0,0 +1,46 @@ +#include "test-tool.h" +#include "cache.h" +#include "userdiff.h" +#include "config.h" + +static int driver_cb(struct userdiff_driver *driver, + enum userdiff_driver_type type, void *priv) +{ + enum userdiff_driver_type *want_type = priv; + if (type & *want_type && driver->funcname.pattern) + puts(driver->name); + return 0; +} + +static int cmd__userdiff_config(const char *var, const char *value, void *cb) +{ + if (userdiff_config(var, value) < 0) + return -1; + return 0; +} + +int cmd__userdiff(int argc, const char **argv) +{ + enum userdiff_driver_type want = 0; + if (argc != 2) + return 1; + + if (!strcmp(argv[1], "list-drivers")) + want = (USERDIFF_DRIVER_TYPE_BUILTIN | + USERDIFF_DRIVER_TYPE_CUSTOM); + else if (!strcmp(argv[1], "list-builtin-drivers")) + want = USERDIFF_DRIVER_TYPE_BUILTIN; + else if (!strcmp(argv[1], "list-custom-drivers")) + want = USERDIFF_DRIVER_TYPE_CUSTOM; + else + return error("unknown argument %s", argv[1]); + + if (want & USERDIFF_DRIVER_TYPE_CUSTOM) { + setup_git_directory(); + git_config(cmd__userdiff_config, NULL); + } + + for_each_userdiff_driver(driver_cb, &want); + + return 0; +} diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index cefe329aea..409372f3a4 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -25,34 +25,26 @@ test_expect_success 'setup' ' echo B >B.java ' +test_expect_success 'setup: test-tool userdiff' ' + # Make sure additions to builtin_drivers are sorted + test_when_finished "rm builtin-drivers.sorted" && + test-tool userdiff list-builtin-drivers >builtin-drivers && + test_file_not_empty builtin-drivers && + sort builtin-drivers.sorted && + test_cmp builtin-drivers.sorted builtin-drivers && + + # Ditto, but "custom" requires the .git directory and config + # to be setup and read. + test_when_finished "rm custom-drivers.sorted" && + test-tool userdiff list-custom-drivers >custom-drivers && + test_file_not_empty custom-drivers && + sort custom-drivers.sorted && + test_cmp custom-drivers.sorted custom-drivers +' + diffpatterns=" - ada - bash - bibtex - cpp - csharp - css - dts - elixir - fortran - fountain - golang - html - java - markdown - matlab - objc - pascal - perl - php - python - ruby - rust - tex - default - custom1 - custom2 - custom3 + $(cat builtin-drivers) + $(cat custom-drivers) " for p in $diffpatterns From patchwork Thu Apr 8 15:04:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19902C433ED for ; Thu, 8 Apr 2021 15:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D203461103 for ; Thu, 8 Apr 2021 15:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231916AbhDHPE5 (ORCPT ); Thu, 8 Apr 2021 11:04:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbhDHPEv (ORCPT ); Thu, 8 Apr 2021 11:04:51 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB997C061760 for ; Thu, 8 Apr 2021 08:04:39 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id r9so3626026ejj.3 for ; Thu, 08 Apr 2021 08:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CAPteERdEhAr6OGxgQx6OOB8R3UU43fTi2ZVYcOHEjE=; b=oJoFQ7JqiN0qYkBBO88nCtQx7zhyUBjdEM4/IS7QBsMH2yiN1V98fC5dXz0I4h1Jh0 G2TnMdoqunxEuo04jH6SdRSPI00bZe/sk358jofLHzHXqFonAZ4gaCIH0iIVk3okCsjh VkX/5mwbso5NVKrJ8s8GOQ7Y6IaHQs+rQMfKrOU5dt8ylaUGdnklyOYXJqBBQdO+VTBH PredaGzimqRTDNu2/DQWzaIWKcvIrnv67yPRHwbDubNbY66gM9PIIZ7btOx2AB/O1/3C ABLrJ7NVJ5dxlMuapXSLd0D4JzL7i+RbOY/En+evgx0E+PvpYFyiEvTOl9Ysaj0KaEcO Mkkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CAPteERdEhAr6OGxgQx6OOB8R3UU43fTi2ZVYcOHEjE=; b=DihWVod1galcXWyBXbAbScIRAkOy90WB5z5WGm3myfWrgc5WpUSuVkGMH0TA4n9HMR EFnslCo0dBYcoNTAPHz8jk/NEeCKUj5qwNmUKIHG3BW0yrbY2xFbMFpEXQtRRX2QZ/m1 6/h3TJjSbTo6xdRhDaPZTjyWkeXPllOyHk6gAxhuqkLh1tC6lhuFJK7jUChtdMjDrCJy cAgtqw5xK7yYn7JRVfGbfDvcJbSNzCeJ+HO2tW7Sv5b3hkjtXU2blyLo+AUDKoxkbEfD AjBUSGDYD3hmxuwKFtVtUCheNIB93FvjJ/nsCXySA2KheetkELrTCZDLfCiM21f6NEC/ 94AQ== X-Gm-Message-State: AOAM531rmtOvke1Bi649rYqtHvaWmL+lXnGQKH8Lrce+TsCt7sWfWAOl s1e0AHVj/Eob6bZInJ0cNL6qzG6fupASjQ== X-Google-Smtp-Source: ABdhPJxY0ej3Rkx84O/nFUhPXN55lIsR9znSMRNCRDWeB88DfR0hk51xdgy7d+pmd0+2P5mMAUVZLA== X-Received: by 2002:a17:906:7947:: with SMTP id l7mr3315593ejo.380.1617894278380; Thu, 08 Apr 2021 08:04:38 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:37 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 7/9] userdiff: remove support for "broken" tests Date: Thu, 8 Apr 2021 17:04:22 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There have been no "broken" tests since 75c3b6b2e8 (userdiff: improve Fortran xfuncname regex, 2020-08-12). Let's remove the test support for them. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4018-diff-funcname.sh | 8 +------- t/t4018/README | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 409372f3a4..740696c8f7 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -94,13 +94,7 @@ test_expect_success 'setup hunk header tests' ' # check each individual file for i in $(git ls-files) do - if grep broken "$i" >/dev/null 2>&1 - then - result=failure - else - result=success - fi - test_expect_$result "hunk header: $i" " + test_expect_success "hunk header: $i" " git diff -U1 $i >actual && grep '@@ .* @@.*RIGHT' actual " diff --git a/t/t4018/README b/t/t4018/README index 283e01cca1..2d25b2b4fc 100644 --- a/t/t4018/README +++ b/t/t4018/README @@ -7,9 +7,6 @@ at least two lines from the line that must appear in the hunk header. The text that must appear in the hunk header must contain the word "right", but in all upper-case, like in the title above. -To mark a test case that highlights a malfunction, insert the word -BROKEN in all lower-case somewhere in the file. - This text is a bit twisted and out of order, but it is itself a test case for the default hunk header pattern. Know what you are doing if you change it. From patchwork Thu Apr 8 15:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A5B6C433B4 for ; Thu, 8 Apr 2021 15:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4582F61104 for ; Thu, 8 Apr 2021 15:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232060AbhDHPFC (ORCPT ); Thu, 8 Apr 2021 11:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbhDHPEx (ORCPT ); Thu, 8 Apr 2021 11:04:53 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF38AC061763 for ; Thu, 8 Apr 2021 08:04:40 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id e14so3587614ejz.11 for ; Thu, 08 Apr 2021 08:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+TgcPChjNYhPVkz49K3frhW3QdyWBAtp4NeeeynEsOQ=; b=rxVX+/Y51GotC/sVTB3EPY3xxoxRPdqb14HxgpLMVYAERpeky/8XfPZW+O6AbASCxx M0hMVOCsJGog2M6H3rnPfWTiTlwAT6qcIDFPicQoVPFFAI09rK+dj8P5dFVofVr00CsE eCcEMB95U+00GdL2V/ILaeZWRIFGP5CeWVj4aNwVsjAvqKHTQhDvnna6cVSctw+6v6be fIkoybyUsx2ZdyzqgrDF2hi/Z0EOxNT7ZQ+tBeAWJis3Qk8AIUk9IuEVLRCa5Xhjb7Ko CFBxUFGtKY8qWJburPOHlVxym4fF+jqdBQ9Zczz7uKNcSqTWgzmb3D4v/fmVmeyF3q1t FNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+TgcPChjNYhPVkz49K3frhW3QdyWBAtp4NeeeynEsOQ=; b=Fco+qyrmird3VA6x72cnF6i5UCcCoMwgm7RmLF+t727LphntSn9LSLBrxvpSFOWHtH f+WLd4ttz10D6QXRtJY7jTis2N0VWm4bOBEVv+wlEJCS8dH8jGe3V0Q5NChXs1z1aVmw PW+GhYGu8yt9j4jph/G1NDePjbWPAU4Y3E+tW6ia9dFTCWs2278Xh18gW+71em5oF3Hk XvB/3Z2H00jcbIFiViTGpx60fv2rTeOfNWgqAWkSClN8su6nvNaEl1q2tfrcJjAvJ8wD KeWzGUHsGtXlf1GSGEkulIqLPKkWo0yRBO61az+VwvuZo5GhAOl4mr7KrkUkyrC5Jege BKog== X-Gm-Message-State: AOAM5305DwoSkWGhOFKHEXY0Mw+9z0PrHHERDKoj9qPL1ZmmOtDKwwvi izaCJ6+ujw9+aWALHFGM5/YmZtOso+hkOg== X-Google-Smtp-Source: ABdhPJw9WhbzyvMbGGGaOaXqvNRFkohj6VF9ubsHFu0sumOgaheX5//uFfr6PJ7ppqFTv1XemTB87Q== X-Received: by 2002:a17:906:af91:: with SMTP id mj17mr10606327ejb.228.1617894279190; Thu, 08 Apr 2021 08:04:39 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:38 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 8/9] blame tests: don't rely on t/t4018/ directory Date: Thu, 8 Apr 2021 17:04:23 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor a test added in 9466e3809d (blame: enable funcname blaming with userdiff driver, 2020-11-01) so that the blame tests don't rely on stealing the contents of "t/t4018/fortran-external-function". I have another patch series that'll possibly (or not) refactor that file, but having this test inter-dependency makes things simple in any case by making this test more readable. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/annotate-tests.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index 29ce89090d..04a2c58594 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -482,12 +482,22 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' test_expect_success 'setup -L :funcname with userdiff driver' ' echo "fortran-* diff=fortran" >.gitattributes && fortran_file=fortran-external-function && - orig_file="$TEST_DIRECTORY/t4018/$fortran_file" && - cp "$orig_file" . && + cat >$fortran_file <<-\EOF && + function RIGHT(a, b) result(c) + + integer, intent(in) :: ChangeMe + integer, intent(in) :: b + integer, intent(out) :: c + + c = a+b + + end function RIGHT + EOF git add "$fortran_file" && GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="A@test.git" \ git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >"$fortran_file" && + sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && + mv "$fortran_file".tmp "$fortran_file" && git add "$fortran_file" && GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="B@test.git" \ git commit -m "change fortran file" From patchwork Thu Apr 8 15:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12191711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC8BDC43460 for ; Thu, 8 Apr 2021 15:04:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C691261158 for ; Thu, 8 Apr 2021 15:04:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232065AbhDHPFA (ORCPT ); Thu, 8 Apr 2021 11:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbhDHPEx (ORCPT ); Thu, 8 Apr 2021 11:04:53 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82DB0C061761 for ; Thu, 8 Apr 2021 08:04:41 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id x4so2850536edd.2 for ; Thu, 08 Apr 2021 08:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KxUNl3TJri5Uh4i5df/Ev8iVqPZgeT9tdZbxgykVsPE=; b=vJuyGNdvw5fqsd6aO3h7ORDK++zdoZvTzvxC4S7USIHLcSI4d8zaOCQZPswYHamVcr ddzfnrx5KSpI8gP85A8OnO5l8sKgKZyFBqrRlPQu0rv8hDysZ7JIBl9lpPwFUTW2YGXd yeZp+OyL/ZB1+xXhtHvPd5Sy8nK4/cxig+/IXJzFcnPO6XDN/Y6thMwQ0dr0y7owkGgl wtATzwWMYfLt/aHvE2+vECghuFCytt92lk51vFiW8gOwhg/K55P0MhTye9OqIQFjY9ug MZ4cG/NrzsuHxLOqqAoot6mh6HJ70UcsPeZOz01iaH9S9inJa9wMrpBBbBeWAzFzKwKN zE7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KxUNl3TJri5Uh4i5df/Ev8iVqPZgeT9tdZbxgykVsPE=; b=CL85MfRIYdqq9N2f0IG7f/XmOemRs+MB6m9fdVJrPdq2YBM2OGZnhciVHzvs7T5yAg FChYT91Fe4a6114uYt6OH9q1Ttz1RDquWoZ5fT3DLhQqvu+6cMWxTmGotvx9lbndk+ud JVBpHw20F98GgVHyf+Dgqb45y47D8tSnqDTWriuVDLHjNjeD/x5Qpz781cCnrnqWCBtj wdROMEkRaQhJqDsLkuVOBFH5RAW1ii60U6CxS+qa68b9cEKr5n1Rvt4WTcBLI4iebpcq ZVR7jBA/MqOUNmbgGmtBv/3imgRf6HUgcybn4FviGmPmTquy3p43duMgTdpl7TgQTxlX AlCg== X-Gm-Message-State: AOAM531/+8fJjsjWB/7ryx2SQFetvEBzlldYNVPlgbExQ8B9D5v29ttJ SBn0xQ7Cg3aFSnjeKKj+Dw9osLhNH+r6ng== X-Google-Smtp-Source: ABdhPJwlw+vIVZVEzBEFdmhsOWHU+IKZuz+xot4E1uWIquG0wePclRZo2/Vv+CfD780GsdxIFvdwMw== X-Received: by 2002:a05:6402:31ad:: with SMTP id dj13mr11693186edb.167.1617894279930; Thu, 08 Apr 2021 08:04:39 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h25sm2479253ejx.105.2021.04.08.08.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 08:04:39 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Jeff King , Jonathan Nieder , Philippe Blain , Adam Spiers , Eric Sunshine , Chris Torek , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v5 9/9] blame tests: simplify userdiff driver test Date: Thu, 8 Apr 2021 17:04:24 +0200 Message-Id: X-Mailer: git-send-email 2.31.1.527.g9b8f7de2547 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Simplify the test added in 9466e3809d (blame: enable funcname blaming with userdiff driver, 2020-11-01) to use the --author support recently added in 999cfc4f45 (test-lib functions: add --author support to test_commit, 2021-01-12). We also did not need the full fortran-external-function content. Let's cut it down to just the important parts. I'm modifying it to demonstrate that the fortran-specific userdiff function is in effect by adding "DO NOT MATCH ..." and "AS THE ..." lines surrounding the "RIGHT" one. This is to check that we're using the userdiff "fortran" driver, as opposed to the default driver which would match on those lines as part of the general heuristic of matching a line that doesn't begin with whitespace. The test had also been leaving behind a .gitattributes file for later tests to possibly trip over, let's clean it up with "test_when_finished". Signed-off-by: Ævar Arnfjörð Bjarmason --- t/annotate-tests.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index 04a2c58594..d3b299e75c 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -479,32 +479,26 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' -test_expect_success 'setup -L :funcname with userdiff driver' ' - echo "fortran-* diff=fortran" >.gitattributes && - fortran_file=fortran-external-function && - cat >$fortran_file <<-\EOF && +test_expect_success 'blame -L :funcname with userdiff driver' ' + cat >file.template <<-\EOF && + DO NOT MATCH THIS LINE function RIGHT(a, b) result(c) + AS THE DEFAULT DRIVER WOULD integer, intent(in) :: ChangeMe - integer, intent(in) :: b - integer, intent(out) :: c - - c = a+b - - end function RIGHT EOF - git add "$fortran_file" && - GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="A@test.git" \ - git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && - mv "$fortran_file".tmp "$fortran_file" && - git add "$fortran_file" && - GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="B@test.git" \ - git commit -m "change fortran file" -' -test_expect_success 'blame -L :funcname with userdiff driver' ' - check_count -f fortran-external-function -L:RIGHT A 7 B 1 + fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && + + test_commit --author "A " \ + "add" "$fortran_file" \ + "$(cat file.template)" && + test_commit --author "B " \ + "change" "$fortran_file" \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f "$fortran_file" -L:RIGHT A 3 B 1 ' test_expect_success 'setup incremental' '