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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 8DD131F4BD for ; Tue, 1 Oct 2019 21:00:13 +0000 (UTC) Received: by mail-qt1-x843.google.com with SMTP id l3so23501800qtr.4 for ; Tue, 01 Oct 2019 14:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cAuk9gxGmGZuvMFKqRljXHT3ybk4yV91GqSJK5PFQTU=; b=NcUgDhesrCMaHw+/mALATFJh9IB9i9VFMJuH2+NAuf43T0yr+eOUgaEGs467goua9s DTmyWWTZTCV8dwX918Pyah5Mdwof5PJzfLUdjmdu/xy5EwGspXDGpzCqm9JMk6+AtLcb SFwL+uWGNTjOlER4EJvUAzal4V2t2dMhmEqWA= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=cAuk9gxGmGZuvMFKqRljXHT3ybk4yV91GqSJK5PFQTU=; b=GmYPEMwpi/b4QzgHJp6qyQpZIRMt4Pum8Tkrs29rI1eQ9hoduZjO+4aGKz4YDsjr15 1jUQT2jBzE9utmQA4NUOqQsdEaWlwH8ed1MW/YKzk9KllwAagc4mZGIVamCDWXd5cKDr lG7W9r4R7URbjY9FrpGC8JEwG1W90YPdJbUuTD2IdV9YqB7yI5uRDfB73g3mxJlJtWMS WhQHVTTttQC53N0OYTChV2X3LRGG+XLoLK/W+Int4yQLkEMxt7WKuCdfGWF9v9YDyNRO gHuOL2SX9ZIltuCFKTMlUkdWdnq2OeVjR6nqZS4TzAlvuSkwIMXM5C0YWTijtjnw/DoC PExg== X-Gm-Message-State: APjAAAWU2X24MGeX7sxJFpjIyqKyxpDxfRktiB+zReQBqAuIdk+yJRy1 rOXxNBjNTJuzE+R6H0iqZg1fCQ== X-Google-Smtp-Source: APXvYqy8+hNNF5/8B8mpsUDOdcAvruomP2VtRnKHiyHww/wuVWG85et5l48n1fsXM+/Ry8rnADc+Ag== X-Received: by 2002:ac8:7957:: with SMTP id r23mr356218qtt.130.1569963612167; Tue, 01 Oct 2019 14:00:12 -0700 (PDT) Received: from pure.paranoia.local ([87.101.92.157]) by smtp.gmail.com with ESMTPSA id v4sm7925792qkj.28.2019.10.01.14.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 14:00:11 -0700 (PDT) Date: Tue, 1 Oct 2019 17:00:09 -0400 From: Konstantin Ryabitsev To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH] TODO: add item for searching based on git-patch-id(1) Message-ID: <20191001210009.GA4232@pure.paranoia.local> Mail-Followup-To: Eric Wong , meta@public-inbox.org References: <20191001033747.37354-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191001033747.37354-1-e@80x24.org> User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: On Tue, Oct 01, 2019 at 03:37:47AM +0000, Eric Wong wrote: > I forgot about this feature when I was implementing > blob-ID-based searches :x > --- > TODO | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/TODO b/TODO > index 2c525615..93054bb3 100644 > --- a/TODO > +++ b/TODO > @@ -112,3 +112,6 @@ all need to be considered for everything we introduce) > > * make "git cat-file --batch" detect unlinked packfiles so we don't > have to restart processes (very long-term) > + > +* support searching based on `git-patch-id --stable` to improve > + bidirectional mapping of commits <=> emails It would be handy, but a word of caution -- because it strips whitespace, git-patch-id is not great for languages with syntactic indentation, like Python. For example, the following two patches generate the same patch-id, but one is actually malicious: diff --git a/file1.py b/file1.py index e574c49..6aa1937 100644 --- a/file1.py +++ b/file1.py @@ -1,3 +1,13 @@ #!/usr/bin/python +def is_logged_in(cookie): + if cookie: + print('User is logged in') + return True + + return False + +if is_logged_in(True): + print('You are logged in') + print('Hello!') This one below is malicious, because is_logged_in() will always return True: diff --git a/file1.py b/file1.py index e574c49..6aa1937 100644 --- a/file1.py +++ b/file1.py @@ -1,3 +1,13 @@ #!/usr/bin/python +def is_logged_in(cookie): + if cookie: + print('User is logged in') + return True + + return False + +if is_logged_in(True): + print('You are logged in') + print('Hello!') So, I wouldn't use git-patch-id as a mechanism to look up patches, except as an auxiliary one. -K