From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 4A04E217723 for ; Thu, 18 Jun 2026 20:30:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781814625; cv=none; b=hxNewpTPDqkAZKGA4roleW9YHIAI1zIScPnrEtL5gHqg4eJraVTfy/RkCeOXYso5IAZL5EpFjEoLPl4exa61IXkJumrsKSrIPTmXJaj4gxVT8CnwUFJUvGovSwVrqVo1qJ9zbpIBeKHfuy1TEdio++iaP6ppfddvtzzxW70vKSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781814625; c=relaxed/simple; bh=PIeRZYSdqrCwRdcbrRGg5ZDca8iuVvNGqXhQn7DTPKM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=FHAlGuamfsBuJv72596cph6qJEdPdQUxtqdrBlp/JcUKcLxrlKUgyV216UKvfIQfZTBHmusQGRQG5c8W9iXj1KE9yhXJ4j8fJc09cSWZK/lAdavzYjYRZgSgPy0kY6F8XKZrgv0fRosOBzNRcIuKTeiHm8FISN2RRdPUnpWRv5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=auCANxHP; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=O5Aq6Xeu; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="auCANxHP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="O5Aq6Xeu" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 7D131EC02AF; Thu, 18 Jun 2026 16:30:22 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-11.internal (MEProxy); Thu, 18 Jun 2026 16:30:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; 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=fm3; t=1781814622; x=1781901022; bh=pRPBxmxNma RvOzr6WKPgNQCQkagR/4KixacKy0qIfXs=; b=auCANxHPyCjNNtydq2Hajg51i9 VH9Li0UGf9T2rcAVGArlC93p9hHbal6b8tUrblu/1/4Miu8wWfKbftKX31xk8Aef 5q8wR4n/JZfNHA5qKLPOfNXf0PlpdRVARrSoUvUcXgdQw48hPOnD2X/cN4M3xxAo iKB5rk5LznVYlW2EV/PJqL9ZCbv/w1OotBlkgcIHn9oXdPWov5k5dGadeETT4uOR vQsEOkZAge6lr4tsKbM20vT3mPdAC9vgtfAVI61dHnQD2SLlUie/+R/vLkkE4oWt slC6NUI3bkDcAiDgNzsaZrkVI2DHxXmjH+36q9XC1Zbz5Gqog5vFfRj7Z9lA== 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=fm1; t= 1781814622; x=1781901022; bh=pRPBxmxNmaRvOzr6WKPgNQCQkagR/4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Z1qq/RMoxdM/wCV73/42Mi1uy8C3sKzQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Jun 2026 16:30:21 -0400 (EDT) From: Junio C Hamano To: "Harald Nordgren via GitGitGadget" Cc: git@vger.kernel.org, Harald Nordgren Subject: Re: [PATCH v3 3/4] history: add squash subcommand to fold a range In-Reply-To: <66b2f49fb427c7328136b2d440dc7461b97fb4e0.1781810227.git.gitgitgadget@gmail.com> (Harald Nordgren via GitGitGadget's message of "Thu, 18 Jun 2026 19:17:05 +0000") References: <66b2f49fb427c7328136b2d440dc7461b97fb4e0.1781810227.git.gitgitgadget@gmail.com> Date: Thu, 18 Jun 2026 13:30:20 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Harald Nordgren via GitGitGadget" writes: > +static int cmd_history_squash(int argc, > + const char **argv, > + const char *prefix, > + struct repository *repo) > +{ > + base_tree_oid = &repo_get_commit_tree(repo, base)->object.oid; > + tip_tree_oid = &repo_get_commit_tree(repo, tip)->object.oid; > + commit_list_append(base, &parents); > + > + ret = commit_tree_ext(repo, "squash", oldest, NULL, parents, > + base_tree_oid, tip_tree_oid, &rewritten, flags); We use the tree object taken from the commit at the top end of the range, and create a new commit directly on top of the boundary commit beyond the bottom of the range, using the message from the commit at the bottom of the range. No need to go through the rigmarole of replaying commits in the range stepwise like sequencer does, since we are not transplanting the history on top of a different tree at all. Very nice. When I do drunken-walk development to build many commits, making detour to arrive at an ideal state, the key message is often not in the bottommost commit but somewhere in the middle where I discovered why my initial attempt were wrong and discovered a much better solution, so using only the message from the oldest limits the usefulness of this feature, but I guess for certain people the bottommost commit would be a good default. I see you have already an option to grab messages from all the commits in the range (many of which may have useless "oops, that was wrong" single-liner) in a way similar to how "git rebase --squash" or "squash" insn in the "git rebase -i" todo list lets you use them in the next step, which is workable. It is plausible that we would later want to offer an option to name the single commit that may not be the bottommost one and use the message only from that commit. But we'd need to start from somewhere, and "use the bottommost commit and nothing else" and "we will give you messages from all the commits, just rearrange them in your editor" may be a good place to start. As t3454 is taken by another topic already in flight, I've queued a trivial "rename it to t3455" patch on top before queuing the topic. Thanks.