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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, 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 3412B1F5AE for ; Tue, 20 Jul 2021 07:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234178AbhGTGjk (ORCPT ); Tue, 20 Jul 2021 02:39:40 -0400 Received: from cloud.peff.net ([104.130.231.41]:54316 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbhGTGjQ (ORCPT ); Tue, 20 Jul 2021 02:39:16 -0400 Received: (qmail 2250 invoked by uid 109); 20 Jul 2021 07:19:30 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 20 Jul 2021 07:19:30 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19742 invoked by uid 111); 20 Jul 2021 07:19:31 -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; Tue, 20 Jul 2021 03:19:31 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 20 Jul 2021 03:19:29 -0400 From: Jeff King To: Junio C Hamano Cc: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , git@vger.kernel.org, Han-Wen Nienhuys , Michael Haggerty Subject: Re: [PATCH v2 02/11] refs/files: remove unused REF_DELETING in lock_ref_oid_basic() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Jul 19, 2021 at 09:16:49AM -0700, Junio C Hamano wrote: > > None of those callers pass REF_DELETING, the last such caller went > > away in 8df4e511387 (struct ref_update: move "have_old" into "flags", > > 2015-02-17). This is the start of even more removal of unused code in > > and around this function. > > While I agree that no existing calls to lock_ref_oid_basic() pass > REF_DELETING to it (hence this patch is a benign no-op), inside > ref_transaction_commit(), 8df4e511387 still used REF_DELETING, I > think, like so: > > /* Acquire all locks while verifying old values */ > for (i = 0; i < n; i++) { > struct ref_update *update = updates[i]; > unsigned int flags = update->flags; > > if (is_null_sha1(update->new_sha1)) > flags |= REF_DELETING; > update->lock = lock_ref_sha1_basic( > update->refname, > ((update->flags & REF_HAVE_OLD) ? > update->old_sha1 : NULL), > NULL, > flags, > &update->type); Good catch. That code got moved to refs/files-backend.c in 7bd9bcf372 (refs: split filesystem-based refs code into a new file, 2015-11-09), and then pulled into a function in 165056b2fc (lock_ref_for_update(): new function, 2016-04-24). And then finally in 92b1551b1d (refs: resolve symbolic refs first, 2016-04-25), we replaced the call to lock_ref_sha1_basic() with lock_raw_ref(). So I think that final one is when the parameter actually became obsolete (so the patch is still good, just a minor history inaccuracy). -Peff