From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (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 5B1473EFFCC for ; Thu, 16 Jul 2026 10:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.146 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784197094; cv=none; b=raAF+lXDG/svq9G3MtPjWf73F3ucKq69XVr8AtiRc5H2K7fAygUX4EnFqIoPriC15DQOL02Y17cioZkR5Rvm1cBOS/XPo0TBUkOZ2L1jEi0/AIM5fQzNn0XMC8V06jtM++TQiEh+aFmP5DthDcDGs7UwpCExSq56Eex0BSs0Nhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784197094; c=relaxed/simple; bh=Sr8y5Mhp2yaG4H8GvjTj5L+2Lzj8kqfkwVjgLT7eZXo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b0EAAqga8LWpfTR+UWtCKkj8dsqTDyJ2q2spGJ+f8Bdk/MP5up64q0jIHRXVRPbhVXtbUSPWYa81MBi1KyqTNVTRpPQTYhW1XjaJs0irYzQkx9m7xNXbfMtZ3QefBluuaWnuide3/xPkwq6o5Ej0768tVmLmZtxJbf//HS/0poI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Aw6T9wLx; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=V7ZCVv4L; arc=none smtp.client-ip=202.12.124.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Aw6T9wLx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="V7ZCVv4L" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 7AC8A1D000CA; Thu, 16 Jul 2026 06:18:12 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 16 Jul 2026 06:18:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1784197092; x=1784283492; bh=goNMP2TvCi koM2NAL/9SbiEBmuZlo1D/0pFKod5Mp+A=; b=Aw6T9wLxf6Xrcx4B9/tgemF9Sk zoq5+aB5VaGQlbRgKYccskZcxEnZk0Z4puum/yf8Hx2taqTdXKChwshRQ8TpDPhK IJEO719spnDwi72r8wNQTAALu7OD9i2zxJ3vM/B0t3QsraaRpJ9smDxUZHgfuWj8 30rqHl7cc1FV9MEd4m3sbHiTkIA5cNn0czcvPYXxTP0foWp+Vm9Clq3kryCfuHJG rSmSRcODXHAn486sj9Hct+TuMBLZFmAO/yKlx5+0UYIHQO+sCsA6m861QKV6sEls BWl9U+tPDqxpLQ5MfFxS0B7HS9VVotkCeA0LaY/nHmC1nIDuexNVjfR9PCCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1784197092; x=1784283492; bh=goNMP2TvCikoM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c0jJqubpmQUdzRL/RixTEvzrm5aE887aPsjzTdqQ X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jul 2026 06:18:11 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id 726151bc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jul 2026 10:18:10 +0000 (UTC) Date: Thu, 16 Jul 2026 12:18:07 +0200 From: Patrick Steinhardt To: Souma Cc: git@vger.kernel.org, gitster@pobox.com Subject: Re: [PATCH 1/3] builtin/history: sign rewritten commits Message-ID: References: <20260703145037.69832-1-git@5ouma.me> <20260703145037.69832-2-git@5ouma.me> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260703145037.69832-2-git@5ouma.me> On Fri, Jul 03, 2026 at 11:50:35PM +0900, Souma wrote: > diff --git a/builtin/history.c b/builtin/history.c > index 091465a59e..8d669cf539 100644 > --- a/builtin/history.c > +++ b/builtin/history.c > @@ -98,6 +98,30 @@ enum commit_tree_flags { > COMMIT_TREE_EDIT_MESSAGE = (1 << 0), > }; > > +static int history_config(const char *var, const char *value, > + const struct config_context *ctx, void *data) > +{ > + const char **sign_commit = data; > + > + if (!strcmp(var, "commit.gpgsign")) { > + *sign_commit = git_config_bool(var, value) ? "" : NULL; > + return 0; > + } > + > + return git_default_config(var, value, ctx, data); Shouldn't we rather pass `NULL` instead of `data`? It works, sure, but only because `git_default_config()` doesn't use `data` at all. > @@ -160,7 +185,8 @@ static int commit_tree_ext(struct repository *repo, > static int commit_tree_with_edited_message(struct repository *repo, > const char *action, > struct commit *original, > - struct commit **out) > + struct commit **out, > + const char *sign_commit) Nit: the `out` parameter should continue to be the last one. > @@ -515,12 +546,13 @@ static int cmd_history_fixup(int argc, > bool skip_commit = false; > int ret; > > + repo_config(repo, history_config, &sign_commit); > + > argc = parse_options(argc, argv, prefix, options, usage, 0); > if (argc != 1) { > ret = error(_("command expects a single revision")); > goto out; > } > - repo_config(repo, git_default_config, NULL); > > if (action == REF_ACTION_DEFAULT) > action = REF_ACTION_BRANCHES; It might make sense to document in the commit message why we have to change the order. I guess it's because of precedence, but not everyone might realize that immediately. > @@ -785,7 +822,8 @@ static int write_ondisk_index(struct repository *repo, > static int split_commit(struct repository *repo, > struct commit *original, > struct pathspec *pathspec, > - struct commit **out) > + struct commit **out, > + const char *sign_commit) > { > struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT; > struct strbuf index_file = STRBUF_INIT; Likewise, let's ensure that the `out` parameter remains last. > diff --git a/replay.c b/replay.c > index da531d5bc6..683c384ef8 100644 > --- a/replay.c > +++ b/replay.c It might make sense to split out the changes to "replay.c" into a preparatory commit. One interesting question is whether it really makes sense to sign _all_ commits. It's rather likely that the history will contain commits that aren't even owned by you, so signing them with your signature might be a bit of a weird choice. I guess that might be okay-ish, but it's certainly something that's worth a discussion as part of the commit message. Thanks! Patrick