From patchwork Sat Aug 17 07:26:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767026 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 637C0646 for ; Sat, 17 Aug 2024 07:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879608; cv=none; b=W4mk8nGfAPwWIT+B5sqNpvls13+itR7I9G5lUhdJ9HqeHp4sH28X2F0GFqVym/uyBfv/LFWgAdZ528MBi2C/s4qA6rHx13ZiwyUB3jgMgzG/3NGFuAFkOKXUJQ/rBvV0s8r2DbdOVeUh5apt9duEJ64TQ7rDn56dUBZ/9SJ2m9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879608; c=relaxed/simple; bh=cV8CoVp27+UIwk01GlA/Tjtxy7CENQJfCFVFhmhlIsw=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XIm2pfnyQ+NRjinomcDAj4qwXiDin+4+DeRbEXQTqzXqbX2l/XF0UCzICvZ2BiQWrvvfcj8uerONqwObC88PSR7U17uj/eJtZq/Tl1iRcWss46m60E5jS/iu3kNv9/6d8K7arJ0Df2mnobJV3j8VV+14rIg6nM3tqiumY38G4eU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 23552 invoked by uid 109); 17 Aug 2024 07:26:45 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 07:26:45 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27557 invoked by uid 111); 17 Aug 2024 07:26:49 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 03:26:49 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 03:26:44 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 1/5] refs: drop some unused parameters from create_symref_lock() Message-ID: <20240817072644.GA1535915@coredump.intra.peff.net> References: <20240817072621.GA1535666@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817072621.GA1535666@coredump.intra.peff.net> This function was factored out in 57d0b1e2ea (files-backend: extract out `create_symref_lock()`, 2024-05-07), but we never look at the ref_store or refname parameters. We just need the path, which is already contained in the lockfile struct. Signed-off-by: Jeff King --- refs/files-backend.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 8d6ec9458d..1cff65f6ae 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1961,9 +1961,8 @@ static int create_ref_symlink(struct ref_lock *lock, const char *target) return ret; } -static int create_symref_lock(struct files_ref_store *refs, - struct ref_lock *lock, const char *refname, - const char *target, struct strbuf *err) +static int create_symref_lock(struct ref_lock *lock, const char *target, + struct strbuf *err) { if (!fdopen_lock_file(&lock->lk, "w")) { strbuf_addf(err, "unable to fdopen %s: %s", @@ -2579,8 +2578,7 @@ static int lock_ref_for_update(struct files_ref_store *refs, } if (update->new_target && !(update->flags & REF_LOG_ONLY)) { - if (create_symref_lock(refs, lock, update->refname, - update->new_target, err)) { + if (create_symref_lock(lock, update->new_target, err)) { ret = TRANSACTION_GENERIC_ERROR; goto out; } From patchwork Sat Aug 17 07:26:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767027 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DF19646 for ; Sat, 17 Aug 2024 07:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879617; cv=none; b=FjaOJ9mlUhAwQqb5oZWEKqnZyg8iB59Gkzg/qd9MOsRX02L3OxjkZg2iclBtbf603nywE/A5Xcp4C474lXLheLY5597gHLUlIerkDa1r5G5F5MfNdcsmFrU7gFX5gS+AiforgsObBfXzGYphaoTAF4XPvbfo3cnyxx04JfDxtjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879617; c=relaxed/simple; bh=xm6u3FGrkVsyLYEEiM+gIHzIIJMHWuG3sun7g1YMD4Y=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iAhysSKbXSCDxItXu9JVf+N8jMAXJQ5oE9V9uH6/I//aGAWEhRGa7CP3tNpvmqavtr3+uk9OJHqjZwioIBhVd+WLCHj5Jb+pXg9suHJYN55aF6h3JtHOVApIHzqTegB4hTZV7MnLBgWGQL9x4J5J3mNd87i21+J79vAMk7t/TZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 23555 invoked by uid 109); 17 Aug 2024 07:26:54 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 07:26:54 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27564 invoked by uid 111); 17 Aug 2024 07:26:58 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 03:26:58 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 03:26:53 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 2/5] pack-bitmap: load writer config from repository parameter Message-ID: <20240817072653.GB1535915@coredump.intra.peff.net> References: <20240817072621.GA1535666@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817072621.GA1535666@coredump.intra.peff.net> In bitmap_writer_init(), we take a repository parameter but ever look at it. Most of the initialization here is independent of the repository, but we do load some config. So let's pass the repo we get down to load_pseudo_merges_from_config(), which in turn can use repo_config(), rather than depending on the_repository via git_config(). The outcome is the same, since all callers pass in the_repository anyway. But it takes us a step closer to getting rid of the global, and as a bonus it silences an unused parameter warning. Signed-off-by: Jeff King --- pack-bitmap-write.c | 2 +- pseudo-merge.c | 5 +++-- pseudo-merge.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index bf96c80898..7787600234 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -51,7 +51,7 @@ void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r) string_list_init_dup(&writer->pseudo_merge_groups); - load_pseudo_merges_from_config(&writer->pseudo_merge_groups); + load_pseudo_merges_from_config(r, &writer->pseudo_merge_groups); } static void free_pseudo_merge_commit_idx(struct pseudo_merge_commit_idx *idx) diff --git a/pseudo-merge.c b/pseudo-merge.c index 77a83b9c5c..1d7f5381a4 100644 --- a/pseudo-merge.c +++ b/pseudo-merge.c @@ -183,11 +183,12 @@ static int pseudo_merge_config(const char *var, const char *value, return ret; } -void load_pseudo_merges_from_config(struct string_list *list) +void load_pseudo_merges_from_config(struct repository *r, + struct string_list *list) { struct string_list_item *item; - git_config(pseudo_merge_config, list); + repo_config(r, pseudo_merge_config, list); for_each_string_list_item(item, list) { struct pseudo_merge_group *group = item->util; diff --git a/pseudo-merge.h b/pseudo-merge.h index 2aca01d056..3aecba772b 100644 --- a/pseudo-merge.h +++ b/pseudo-merge.h @@ -10,6 +10,7 @@ struct commit; struct string_list; struct bitmap_index; struct bitmap_writer; +struct repository; /* * A pseudo-merge group tracks the set of non-bitmapped reference tips @@ -72,7 +73,7 @@ struct pseudo_merge_matches { * entry keys are the pseudo-merge group names, and the values are * pointers to the pseudo_merge_group structure itself. */ -void load_pseudo_merges_from_config(struct string_list *list); +void load_pseudo_merges_from_config(struct repository *r, struct string_list *list); /* * A pseudo-merge commit index (pseudo_merge_commit_idx) maps a From patchwork Sat Aug 17 07:29:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767028 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6095A83A06 for ; Sat, 17 Aug 2024 07:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879781; cv=none; b=Pkf82KZB6HhDzxJNpabyp31DLhfI9CO1gcygRvHmI7mTbgN14MNNUdXhtUF39zAUPflzhO6eXwFEN8ZHejS/g9vDAUUQmIFGaage7jkfTtmdKl0ADQduLoan9d19rwRq3zCN0hh0oRYCfHJSzk+7iyu52uDmBzutwLV9I6hqy74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879781; c=relaxed/simple; bh=xA23hBW1h6exUVtVn11HXbb7CfdyletrlSKyC0veqfE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fsLxzCfagn/YYDlTIt/huGZb13vccak2f/y+eq4i5WlBO0Q7ab1dXscvo/dDkzyvZPiWp7hsDZyM49qk+LOhjIiwJaa7SjKIJO8vL93iiTkbF6lq3hrPHKVDaiG7E+l1KC+dzVb/cDECOyheOI4dFbl3JgZAtiWMe2in3sxD61c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 23586 invoked by uid 109); 17 Aug 2024 07:29:38 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 07:29:38 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27575 invoked by uid 111); 17 Aug 2024 07:29:42 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 03:29:42 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 03:29:37 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 3/5] pack-bitmap: drop unused parameters from select_pseudo_merges() Message-ID: <20240817072937.GC1535915@coredump.intra.peff.net> References: <20240817072621.GA1535666@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817072621.GA1535666@coredump.intra.peff.net> We take the array of indexed_commits (and its length), but there's no need. The selection is based on ref reachability, not the linearized set of commits we're packing. Signed-off-by: Jeff King --- A careful reader may wonder whether we ought to be using the set of commits to limit what we're willing to select (since we can't make a bitmap for a commit that isn't in our index). And this is indeed a problem, but the solution doesn't involve using indexed_commits. It should be fixed in this series: https://lore.kernel.org/git/c9a64b1d2a9d6b3fe1f5fb0a7303e043114fcd8f.1723743050.git.me@ttaylorr.com/ pack-bitmap-write.c | 2 +- pseudo-merge.c | 3 +-- pseudo-merge.h | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 7787600234..9b9ca1cc36 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -737,7 +737,7 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer, stop_progress(&writer->progress); - select_pseudo_merges(writer, indexed_commits, indexed_commits_nr); + select_pseudo_merges(writer); } diff --git a/pseudo-merge.c b/pseudo-merge.c index 1d7f5381a4..c952a7cba9 100644 --- a/pseudo-merge.c +++ b/pseudo-merge.c @@ -425,8 +425,7 @@ static void sort_pseudo_merge_matches(struct pseudo_merge_matches *matches) QSORT(matches->unstable, matches->unstable_nr, commit_date_cmp); } -void select_pseudo_merges(struct bitmap_writer *writer, - struct commit **commits, size_t commits_nr) +void select_pseudo_merges(struct bitmap_writer *writer) { struct progress *progress = NULL; uint32_t i; diff --git a/pseudo-merge.h b/pseudo-merge.h index 3aecba772b..4b5febaa63 100644 --- a/pseudo-merge.h +++ b/pseudo-merge.h @@ -95,8 +95,7 @@ struct pseudo_merge_commit_idx { * * Optionally shows a progress meter. */ -void select_pseudo_merges(struct bitmap_writer *writer, - struct commit **commits, size_t commits_nr); +void select_pseudo_merges(struct bitmap_writer *writer); /* * Represents a serialized view of a file containing pseudo-merge(s) From patchwork Sat Aug 17 07:29:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767029 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6C4F20E6 for ; Sat, 17 Aug 2024 07:29:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879789; cv=none; b=fzJwEqS1pEPvn8LL60f3vRgcYZE8qETlibWvJOg4nszs9Hv6ai9VsoW83++exvgcMqW/4lIx7aTsRRStHRxqXfxsfh4KrtQK152UNqKFQUba4KYjel0ySU82VICt33G9YUI0aqANd2XBh++6E0fZHA1Rse44YEFkWTt5xHy9/Go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879789; c=relaxed/simple; bh=PWAsPAuK/XgUfakIfggmy9KExA2NPl/u0Qcb36qPJQU=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CCqgpGbC9OA2Vzmktq0et85i4zbH8MR6CXH5LO9BdLUgl4XwE4YyOf+yi5BiiW4ZwK9APEN7xNJoK28CETVrNpj5JsaFOvpjJ9OI2DIYCnSssatD2aPE6v85a4dzCXpocs/VJoqAg9DohYKYTJwjDEN1VKJsQsRSvLuBYTfGgGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 23591 invoked by uid 109); 17 Aug 2024 07:29:46 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 07:29:46 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27579 invoked by uid 111); 17 Aug 2024 07:29:50 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 03:29:50 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 03:29:45 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 4/5] ref-filter: drop unused parameters from email_atom_option_parser() Message-ID: <20240817072945.GD1535915@coredump.intra.peff.net> References: <20240817072621.GA1535666@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817072621.GA1535666@coredump.intra.peff.net> This code was extracted from person_email_atom_parser() in a3d2e83a17 (ref-filter: add mailmap support, 2023-09-25), but the part that was extracted doesn't care about the atom struct or the error strbuf. Signed-off-by: Jeff King --- ref-filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 6d8b591930..2d7a65a56b 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -742,8 +742,7 @@ static int person_name_atom_parser(struct ref_format *format UNUSED, return 0; } -static int email_atom_option_parser(struct used_atom *atom, - const char **arg, struct strbuf *err) +static int email_atom_option_parser(const char **arg) { if (!*arg) return EO_RAW; @@ -761,7 +760,7 @@ static int person_email_atom_parser(struct ref_format *format UNUSED, const char *arg, struct strbuf *err) { for (;;) { - int opt = email_atom_option_parser(atom, &arg, err); + int opt = email_atom_option_parser(&arg); const char *bad_arg = arg; if (opt < 0) From patchwork Sat Aug 17 07:29:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 13767030 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F5320E6 for ; Sat, 17 Aug 2024 07:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.231.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879792; cv=none; b=Mu9kJ5N2F4xBuGghEJO1smoZXtX/XjJEDZiu50wImC31pH3Br7RfGtq1A/z+ZPCd8pf66Bk+FBBRkC+z2py5qyMEKiH+N9lKO/okatEbqdKLPNMXb3i9VWmWVur5P8yBxfX4zuXp9aoVOQdZKlcLeN3DJN0KATT9OXShf+YdXm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723879792; c=relaxed/simple; bh=QVyOqMyKfpPRd+QSd9S5mN16dqcv2GPfEcsCpTDQwVE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jnT727F+AuA9NmG+Bf10fnVdG0b9wSOOw8X7sK0P81mXec4sSR8H/Eg4Rt4lJEPU90O+IvduMwPKPC0xUd6OfeK7WGDKhtJMVKFLnX58Kc32CDe5raqmBJSKxcIH8XI/vlW7Hnh4z53XKX5n+klDLcIemGUHQipQ+zPqIGDz+Go= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net; spf=pass smtp.mailfrom=peff.net; arc=none smtp.client-ip=104.130.231.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=peff.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peff.net Received: (qmail 23594 invoked by uid 109); 17 Aug 2024 07:29:50 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Sat, 17 Aug 2024 07:29:50 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27582 invoked by uid 111); 17 Aug 2024 07:29:54 -0000 Received: from coredump.intra.peff.net (HELO coredump.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Sat, 17 Aug 2024 03:29:54 -0400 Authentication-Results: peff.net; auth=none Date: Sat, 17 Aug 2024 03:29:49 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 5/5] diff-lib: drop unused index argument from get_stat_data() Message-ID: <20240817072949.GE1535915@coredump.intra.peff.net> References: <20240817072621.GA1535666@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240817072621.GA1535666@coredump.intra.peff.net> The "struct index_state" parameter passed to get_stat_data() has been unused since we stopped passing it to check_removed() in 6a044a2048 (diff-lib: fix check_removed when fsmonitor is on, 2023-09-11). We can just drop it, which in turns lets us simplify our callers a bit. Signed-off-by: Jeff King --- diff-lib.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/diff-lib.c b/diff-lib.c index 7a1eb63757..a680768ee7 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -308,8 +308,7 @@ static void diff_index_show_file(struct rev_info *revs, oid, oid_valid, ce->name, dirty_submodule); } -static int get_stat_data(const struct index_state *istate, - const struct cache_entry *ce, +static int get_stat_data(const struct cache_entry *ce, const struct object_id **oidp, unsigned int *modep, int cached, int match_missing, @@ -352,7 +351,6 @@ static void show_new_file(struct rev_info *revs, const struct object_id *oid; unsigned int mode; unsigned dirty_submodule = 0; - struct index_state *istate = revs->diffopt.repo->index; if (new_file && S_ISSPARSEDIR(new_file->ce_mode)) { diff_tree_oid(NULL, &new_file->oid, new_file->name, &revs->diffopt); @@ -363,7 +361,7 @@ static void show_new_file(struct rev_info *revs, * New file in the index: it might actually be different in * the working tree. */ - if (get_stat_data(istate, new_file, &oid, &mode, cached, match_missing, + if (get_stat_data(new_file, &oid, &mode, cached, match_missing, &dirty_submodule, &revs->diffopt) < 0) return; @@ -379,7 +377,6 @@ static int show_modified(struct rev_info *revs, unsigned int mode, oldmode; const struct object_id *oid; unsigned dirty_submodule = 0; - struct index_state *istate = revs->diffopt.repo->index; assert(S_ISSPARSEDIR(old_entry->ce_mode) == S_ISSPARSEDIR(new_entry->ce_mode)); @@ -395,7 +392,7 @@ static int show_modified(struct rev_info *revs, return 0; } - if (get_stat_data(istate, new_entry, &oid, &mode, cached, match_missing, + if (get_stat_data(new_entry, &oid, &mode, cached, match_missing, &dirty_submodule, &revs->diffopt) < 0) { if (report_missing) diff_index_show_file(revs, "-", old_entry,