From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id BEA9A1F466 for ; Sun, 2 Feb 2020 20:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726976AbgBBUrs (ORCPT ); Sun, 2 Feb 2020 15:47:48 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36593 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726943AbgBBUrs (ORCPT ); Sun, 2 Feb 2020 15:47:48 -0500 Received: by mail-wr1-f65.google.com with SMTP id z3so15420910wru.3 for ; Sun, 02 Feb 2020 12:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dinwoodie.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hvwAhkhWzLNK2U0mMqeHfoEnrwi5IqWgrjDVWwvL6QQ=; b=Amraix6SSofmZq5hn0M6nDKpcmYHXeTPCXq7WxlWBiofgQYo050smtT16TkG7pp//b KAbd4g4KV/09B5ntdYjMWJsZR5Lj41CaKo0S4Z66EAL1gDrUvTeoI/6nnzkAaapJLNYh f+GlE6e6rTv3oIPpAFaNaDMf65rAgGDhFDcfY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=hvwAhkhWzLNK2U0mMqeHfoEnrwi5IqWgrjDVWwvL6QQ=; b=RDoenABX0bUTXPp89yIxw6OftdFLicujM1v9FLjXMgDMjOGfaG/yMGCTP+uHFiHOUC Fn8YHBuglVsK1hN0ZK8hSV/6HQlY/NDTS8IHugeA2iey+F+0LlJcUkOThzNuJmdzA3Fv bHED4KIzz6kzR+eJTNVRqfJOgnLM4/EDlSatDMwjfNYKo3RdCBS+DG3QXEHNuwqRS7Kj NlR2O0CZEURZPNxdNXsN/zeCvAN3xOQkosTVTttFWWbBgb7HqlPQd8vG8zJ0x7pd85G/ Z3PXSm64mGk1g0UcRBKh3LWS3OkygCmx0Z9TRgvvTekiFjLtcg/rvKJTWyXOrARv8pJo c75A== X-Gm-Message-State: APjAAAUpF+3fGo7uWT9hEeCeGSgaBKQ9ETUi9bPrjiAQ8Sr04wgThPmK 3Tt1PCcL/EKgwXFe6GEFtnMScA== X-Google-Smtp-Source: APXvYqzRAkcpgnabU9cvGPDVH2TZCGoWOPec7lz6OhVu3U8B7hosdGHXSzddrxzdRWsIceeWmfLUng== X-Received: by 2002:adf:ce87:: with SMTP id r7mr11375791wrn.245.1580676466872; Sun, 02 Feb 2020 12:47:46 -0800 (PST) Received: from dinwoodie.org ([2001:ba8:0:1c0::9:1]) by smtp.gmail.com with ESMTPSA id a13sm22638565wrp.93.2020.02.02.12.47.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Feb 2020 12:47:46 -0800 (PST) Date: Sun, 2 Feb 2020 20:47:39 +0000 From: Adam Dinwoodie To: Martin =?iso-8859-1?Q?=C5gren?= Cc: Git Mailing List , Ramkumar Ramachandra , Phil Hord , Junio C Hamano Subject: Re: [PATCH] diff-options.txt: correct command syntax Message-ID: <20200202204739.GA24686@dinwoodie.org> References: <20200202192226.29176-1-adam@dinwoodie.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Sunday 02 February 2020 at 08:45 pm +0100, Martin Ågren wrote: > Hi Adam, > > On Sun, 2 Feb 2020 at 20:24, Adam Dinwoodie wrote: > > > > Change the example arguments in the description of the -G diff argument > > to be consistent throughout the description. > > > > Signed-off-by: Adam Dinwoodie > > --- > > Documentation/diff-options.txt | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt > > index 09faee3b44..84a74cb2da 100644 > > --- a/Documentation/diff-options.txt > > +++ b/Documentation/diff-options.txt > > @@ -561,19 +561,19 @@ Binary files are searched as well. > > -G:: > > Look for differences whose patch text contains added/removed > > lines that match . > > + > > To illustrate the difference between `-S --pickaxe-regex` and > > `-G`, consider a commit with the following diff in the same > > file: > > + > > ---- > > + return !regexec(regexp, two->ptr, 1, ®match, 0); > > ... > > - hit = !regexec(regexp, mf2.ptr, 1, ®match, 0); > > ---- > > + > > -While `git log -G"regexec\(regexp"` will show this commit, `git log > > --S"regexec\(regexp" --pickaxe-regex` will not (because the number of > > +While `git log -G` will show this commit, `git log > > +-S --pickaxe-regex` will not (because the number of > > occurrences of that string did not change). > > I don't think this is correct. "" is a placeholder and this > example wants to use a real-world regex instead of the placeholder. > Maybe this could be made clearer by having an example that does not try > to grep in regex-code using the regex "regexec\(regexp". > > Maybe instead of "regexec", "regexp" and "regmatch", this example could > use words from some other domain? Would something like this be clearer? > > To illustrate the difference between `-S --pickaxe-regex` and > `-G`, consider a commit with the following diff in the same > file: > + > ---- > + return !frotz(nitfol, two->ptr, 1, 0); > ... > - hit = !frotz(nitfol, mf2.ptr, 1, 0); > ---- > + > While `git log -G"frotz\(nitfol"` will show this commit, `git log > -S"frotz\(nitfol" --pickaxe-regex` will not (because the number of > occurrences of that string did not change). Ah, thank you! I had completely misread what these examples were trying to achieve. I think your example (or indeed anything from a different domain) would have avoided me getting confused in the first place. Although I'm much less fussed now I realise the problem here was entirely my understanding rather than an error in the docs. > BTW, I wonder what "in the same file" tries to say -- my hunch is we > could drop those words without any loss of correctness or readability. > Would you agree? I think "in the same file" is meaningful here: as I understand it both forms would find a commit that removed a line from one file and added it back to a _different_ file, but only the -G form would pick it when removed and added lines are in the same file. Adam