From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 ACCC63BB100 for ; Wed, 30 Sep 2026 14:40:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790779221; cv=none; b=c6gVzsmOyiK3svHOd3Oak7OLRA3QFEa/Xt3YFpN3vd6lO6qLk753BAq+dKF1i9I0eVl/z1qVdiva3x0e5/F60hVcIebuEN1RySigqVj2a4ISFObErV52R9f1Mu8OT8kUvz13Ioj8guwTUV5wzInD34NaGZViLXdCtJuO7O89rLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790779221; c=relaxed/simple; bh=HMKdqrqj6e5K6mnWHp1cQfqpW0/bKYu4blMFE0joIto=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=adIMk4qMp6qOvQyfVNTCSQa2rb0mjvg1utP+OUc9OZqtwkNZTjP0bcN4J4E7qQfODBtZSTkdaC6zRhCheTAWerJKndfFXP6CDsRkenOfFnn9pTFNhXqAAIyRqqhFGghfcY12JcL5YNWUy583xEj8u6L0ehVBSd/f8ACn0tPlDWE= 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=clTc/mRB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=bFEbmnbQ; arc=none smtp.client-ip=103.168.172.153 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="clTc/mRB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bFEbmnbQ" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 75D861400281; Wed, 30 Sep 2026 10:40:11 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 30 Sep 2026 10:40:11 -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=fm1; t=1790779211; x=1790865611; bh=49uY+gELI9 NIive4cuk/o4XjMeRfWaXMogtFyGxM3o0=; b=clTc/mRB+jl+GH2uupV0/BhFgL UqxdcGzPGBwhPOibN13nb5FpX/pjebgNt6WWBrpX5MfkKfdYqFC8GPGFKWAqoG5g lK1ehrsXK2p4anJPG0ltIK5PayAy1C4RmWbips0abCrusroUeQlId+wVqYDv9QF9 fEH+4cZLPi6PsgEnaaU2YFuifvm02xZSNgRhfKe/SKybB5rVUeSff080UH/wKICK f4tJNfJ1xFN4a35idmChghh1RiqjK9+30tIbeBWkAmF3sSDoVSRcacNTQNadUxmx YjATSmdTZmHbOyTD1Rx7w2k/zGHJ+KfWjkVZwp6FglBnCdzF0yVdYDyKqUFw== 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= 1790779211; x=1790865611; bh=49uY+gELI9NIive4cuk/o4XjMeRfWaXMogt FyGxM3o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+ti2Q X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Sep 2026 10:40:10 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id 9bb1bca0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 30 Sep 2026 14:40:08 +0000 (UTC) Date: Wed, 30 Sep 2026 16:40:06 +0200 From: Patrick Steinhardt To: Grant Moyer Cc: git@vger.kernel.org, Michele Locati Subject: Re: [PATCH] fiter-branch: fix commit map init from state branch Message-ID: References: <20260801033127.10606-1-dev@grantmoyer.com> 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: <20260801033127.10606-1-dev@grantmoyer.com> On Fri, Jul 31, 2026 at 11:31:27PM -0400, Grant Moyer wrote: Sorry, this slipped may radar. Thanks for bumping this thread, Michele. Nit: pointed out by Michele: the subject has a typo in "fiter-branch". > The commit map dir is populated from the state branch assuming a > "to_commit:from_commit" format, but the state branch is written with a > "from_commit:to_commit" format, resulting in an inverted mapping when the > map is populated from the state branch. This is especially evident when > --prune-empty is used and creates commits which map to nothing; when the > map dir is populated from this state on subsequent runs, git-filter-branch > outputs many errors while trying to create files with empty names, like: > > > /usr/lib/git-core/git-filter-branch: line 305: ../map/: Is a directory > > This change corrects the population of the commit map dir to match the > "from_commit:to_commit" format. So... does this mean that we don't have test coverage for this case at all? It might make sense to also mention f6d855091e (filter-branch: stop depending on Perl, 2025-04-16) for context, as this is where the issue was introduced. > diff --git a/git-filter-branch.sh b/git-filter-branch.sh > index 24fa317aaa..9aa07be6e1 100755 > --- a/git-filter-branch.sh > +++ b/git-filter-branch.sh > @@ -302,7 +302,9 @@ then > do > case "$line" in > *:*) > - echo "${line%:*}" >../map/"${line#*:}";; > + from_commit=${line%:*} > + to_commit=${line#*:} > + echo "$to_commit" >../map/"$from_commit";; > *) > die "Unable to load state from $state_branch:filter.map";; > esac Okay. A simpler fix could've been the following diff: - echo "${line%:*}" >../map/"${line#*:}";; + echo "${line#*:}" >../map/"${line%:*}";; But I guess it doesn't hurt to have proper naming here. > diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh > index 86011e7b1f..3934cc4a11 100755 > --- a/t/t7003-filter-branch.sh > +++ b/t/t7003-filter-branch.sh > @@ -121,7 +121,7 @@ W=$(git rev-parse HEAD) > test_expect_success 'using --state-branch to skip already rewritten commits' ' > test_when_finished git reset --hard $V && > git reset --hard $V && > - git filter-branch --state-branch state -f --tree-filter "touch file || :" HEAD && > + git filter-branch --state-branch state -f --tree-filter "exit 1" HEAD && > test_cmp_rev $W HEAD > ' So does this now detect the issue? If so, it feels somewhat roundabout. Michele, it seems like you have already invested some time into reproducing the issue. Can this maybe be put into a proper test case that directly exercises your issues (that is, the swapped entries and such)? Thanks! Patrick