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-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id E8DEE1F66E for ; Fri, 21 Aug 2020 19:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725903AbgHUS75 (ORCPT ); Fri, 21 Aug 2020 14:59:57 -0400 Received: from cloud.peff.net ([104.130.231.41]:37448 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbgHUS75 (ORCPT ); Fri, 21 Aug 2020 14:59:57 -0400 Received: (qmail 19680 invoked by uid 109); 21 Aug 2020 18:59:57 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 21 Aug 2020 18:59:57 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 31108 invoked by uid 111); 21 Aug 2020 18:59:56 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 21 Aug 2020 14:59:56 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 21 Aug 2020 14:59:55 -0400 From: Jeff King To: Jacob Keller Cc: Junio C Hamano , Jacob Keller , Git mailing list Subject: Re: [RFC 3/3] refspec: add support for negative refspecs Message-ID: <20200821185955.GA1165@coredump.intra.peff.net> References: <20200815002509.2467645-1-jacob.e.keller@intel.com> <20200815002509.2467645-3-jacob.e.keller@intel.com> <20200818174116.GA2473110@coredump.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Aug 21, 2020 at 11:21:19AM -0700, Jacob Keller wrote: > > I also tried adding a test for fetch --prune, but that ultimately > > calls query_refspecs_multiple and query_refspecs. I need to figure out > > how negative refspecs need to interact with that function still. > > So there's an interesting problem here... query_refspecs_multiple > takes only the destination name, which makes the "get_stale_heads" not > work properly, since for fetch we want to apply the refspec to the > remote sides "source". Hmm. So if I understand it, that function is asking about _local_ refs, and wondering "if we were to fetch using these refspecs, would we write to this ref". We know that negative refspecs can't impact the mapping of remote to local. But I guess the case you are about is: git fetch --prune refs/heads/*:refs/remotes/origin/* ^refs/heads/foo where we need to realize that the local refs/remotes/origin/foo needs to be saved. I think that should be possible by reverse-applying the transformations from any positive refspecs, and then seeing if they match any negative ones. I don't know how much support the existing code will give you for that, though. -Peff