From patchwork Sat Mar 23 03:45:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10866745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E179922 for ; Sat, 23 Mar 2019 03:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA3BB2A834 for ; Sat, 23 Mar 2019 03:45:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D99602A840; Sat, 23 Mar 2019 03:45:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E5162A834 for ; Sat, 23 Mar 2019 03:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726022AbfCWDpq (ORCPT ); Fri, 22 Mar 2019 23:45:46 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45862 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbfCWDpq (ORCPT ); Fri, 22 Mar 2019 23:45:46 -0400 Received: by mail-pg1-f196.google.com with SMTP id y3so2757895pgk.12 for ; Fri, 22 Mar 2019 20:45:46 -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=/IkhLOTIIFgkix+Abr3ezU98zJMAN5EA3c1FeijEbp0=; b=jL41dJRZ2B6cU+JkMbP09zU9VYbiQL86gSdpbyUifzMJBVgbEbIGLkcQIy1LtjlehB xgShGx4063J4WhJOVJbSn1v7n+Y0g3h/UT/Umu8xwtL32q2bVu4v0JLddY975fTOaCJu 9Dzhf4eGrPjlKMgcc5Hx3pW6Z9MGjBg54vqtUscK0cCx4Av9xMjRAPelwZ54BSWKKfMj vHtaNLA24VgIiYAFYO7TdKmiSLdtCrjyDlLiCMU4aYmOBRFbnx0O+GZDYmrnJG8ZnaPJ MMGKbckX9CkEv1SdntDLNFmNLr/8xy3+Xx12KmRjlZYlwOXvubm8KjPpQeL0HA9Hal9Q zqng== 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=/IkhLOTIIFgkix+Abr3ezU98zJMAN5EA3c1FeijEbp0=; b=KIhwkX2rJbIprYEocFwVwV4rwIZDbRwYsretjkd+3QcE7EXnw3YkbM846xU4nNREzC YYf6+Jw7S0m1XJnlzlisjrNZIjp8yRQ0mLrMDU6MDYoa6rhqOK9G5miVnfkkvfikf/Rd hldzKajmnUrr47k3jvzAkpWGPpOeZQdHyNTdS6qIlTsR5n27Vbwb5baXep+TJNSrGxz5 C5xGZHm2vtllsyO3QKGErFeeKmNnljvkANh96ekJ0CikJUQJK66Hjyy9Rpmn8xtGcsiV d9P6Cb+UyYKvUoBrko3Fu+4Am4i/bnVnr5Y3ZlPAN2eSPE0oniHby3NMIfgxWOXo1I2r SuPw== X-Gm-Message-State: APjAAAWNDinghvHutdqzkWBaBgWfTTfrqoLEKsOxWu+zX8n3Yv3GfPRO UfAZ7NkU0FbpK/hpzQwE2tM= X-Google-Smtp-Source: APXvYqwdzu8XggPcmwSn6jPF+YucfZBwoIu/zWrjC7fwYvKuYr86x/Pmt1A8ntpFbKG2Yugy+ZSqsQ== X-Received: by 2002:a65:4542:: with SMTP id x2mr12110246pgr.65.1553312745767; Fri, 22 Mar 2019 20:45:45 -0700 (PDT) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id h3sm17422550pfb.31.2019.03.22.20.45.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 20:45:45 -0700 (PDT) Received: by ash (sSMTP sendmail emulation); Sat, 23 Mar 2019 10:45:40 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: jason.karns@gmail.com Cc: git@vger.kernel.org, Taylor Blau , Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= =?utf-8?b?IER1eQ==?= Subject: [PATCH] config: correct '**' matching in includeIf patterns Date: Sat, 23 Mar 2019 10:45:35 +0700 Message-Id: <20190323034535.23364-1-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.548.gd3c7d92dc2 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current wildmatch() call for includeIf's gitdir pattern does not pass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_ the same as '**' (because '*' also matches slashes) with one exception: '/**/' can match a single slash. The pattern 'foo/**/bar' matches 'foo/bar'. But '/*/', which is essentially what wildmatch engine sees without WM_PATHNAME, has to match two slashes (and '*' matches nothing). Which means 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'. The result of this is the current wildmatch() call works most of the time until the user depends on '/**/' matching no path component. The fix is straightforward. Reported-by: Jason Karns Signed-off-by: Nguyễn Thái Ngọc Duy --- Sorry I didn't notice this until Taylor's reply. Not sure how to explain git-lfs behavior though. config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.c b/config.c index 0f0cdd8c0f..c2846df3f1 100644 --- a/config.c +++ b/config.c @@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts, } ret = !wildmatch(pattern.buf + prefix, text.buf + prefix, - icase ? WM_CASEFOLD : 0); + WM_PATHNAME | (icase ? WM_CASEFOLD : 0)); if (!ret && !already_tried_absolute) { /*