From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795996896; b=jJjYhdx2Iid+gbBFazty7/2QlZwI7prihpTxIsBmX8Tzokfeq2XdIX+J/ovzzOEtnqV9 2jzlF8HJ0WQHcHAoXFR59OXsbV56fkEa8lJUR5+40lV9UvNWNLHC43YJ+dp7OGiMsFfWS YNKkR/obhDcVUQNjdU21RIoZCcR+QAj2GRJwZfk1ewLEmVm5TgA8VdzU8NpUzn+UuJPK8 tew+fsPuT7x06h0Ox5ADcUe3KPcPETv8JO7+IaBXpqg3MI8Q86fxvlkk4Awx4hbJ1VTxV JNneGRUSMmr61CKywW9ImANP7byDsVUX+Z147llHgt63kf7hHumLX55DJSXG2l5cXnQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795996896; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To: References:From:Date:Subject:Fcc:Content-Type: Content-Transfer-Encoding:MIME-Version:To:Cc; bh=kn/8QiXU1oIap8U4tjS69LXIcluwTRogSGDXBpjtQ5A=; b=s35vaS6qmNrkhjR5Td6SAg94ZhTS0qNza8dNF+q/auoktsuJULtm8jNY1easxHCEAGhQ nYImv+lzX7Df5tn4xa8PnUegAZRSRwJCwGcYlW/IrMAE2RxB51oJYUwItewvieNueHXuO /vhFdLYM2vISC4Wn/SNw3Sf/DaCt822gMfLGxkOoCKmZKRU0ECnq+7lyqqMA3rwW6c9t/ WUiMyO/vCkNsBUHH10PJ6dsqRSrzo6C47HB6/hHDuX8QEIDve1x/UaMnNLl/edgk7vm4h 6eWQL3QqJxadJboJ3vrw/nBgokbkyuTt560yufMShcd7+dFR5+OaI3cwqAo2inetfAg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xq8lkZHg; arc=none smtp.remote-ip=209.85.160.177 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A506A606A329 for ; Mon, 30 Nov 2026 00:01:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A506A606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xq8lkZHg Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-55dc111ae86so31579441cf.1 for ; Sun, 29 Nov 2026 16:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795996895; x=1796601695; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=kn/8QiXU1oIap8U4tjS69LXIcluwTRogSGDXBpjtQ5A=; b=xq8lkZHgLwKlFuJ0rp8oNBrmiqdRAdoD6RfkpXEms53J38xvYuwJu12MKGxRtqhAot gviNIBeJS+A5wBfWAD/LvTBDnCvCsSBHCJqpCJwUhWGETl/T8A19SsnoIuLPv4n27anV b6lUH6PKqWb6LoBQD7ULTmAwJVfOUKaowDNt29RtgaNqLvvW9jWTA93KyzPaH0MEZw/M ULwORbmK5fQ8a6NOtvrR4cYgtBJU/bMgqwTa1JyrQOElVhYCg3xMy0PEZ8Nt3lmAxcCB zhQ88T3rC9iGeNyPQ9G7BRhJuzLr3bag6VUm8faB4TTsfQeXHFmWaEq/shEy73I6PtpO WhsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795996895; x=1796601695; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kn/8QiXU1oIap8U4tjS69LXIcluwTRogSGDXBpjtQ5A=; b=XE20V9qJRT5SP1ngMdPY5lV1D2NlcoYZsETGw9SwXiFSFpruNk/nEJ2feh7CWY9jt2 Au9DrGRCUuyQSttbuC1vLJazReAOV8NmILTPokkkZvhlJFY+xMfHuKi2Ww0BO4YC0Lx4 zEUfCC0enb2ScsAC/fSnSHBTJuvIdCpHfx5nvmi6B0B0wzNVrB4rJnmYI6VzA/7qTi2h Warny/OZyoVAotUqx0n98oZMbZM1ZMCQwOy3+8IgKxJnKvA/HGK8lnvKz8tXcNAFr8QD B730+7CE/8R5spLJCm1vZRgxUcESn6YQgdUCriDjGELxFEVlRZOvUkYfmFjg0m/Q0FpP GWCw== X-Gm-Message-State: APuU4Z+IKBKMLHUmPmkOmKRe/scygrI7VKY/o+eWqfhJlFEnvawL6O4x Ryof78YeFA0I71UIC0fo1s8s2B6ZNaP3B9cmg9ROIJgUQIDFPjpi9u5hMWRT3fgm X-Gm-Gg: AZFdTZfV6eT1gNFaw8ggT7okuoNlN/ODdd82bb16xgGodXICylVf8Sfny53E635W2Lh Zqo/+MrIs/r5IQ3OgrQ23b1rwjzPM/7vVT6xmxbLn2Zw+Fz43OdVqvszXMHKg7uerOIsHIAiqes dz3jT9ngfJAEbcPrOL69WU2ck6wwWaNFKxNpYfogiOwoU4xLXR6AufSZ7dF2PyApR0IYrU4r6Ys 4L/TtC3RzyOVXfoIG0e2O7HPBfIGQnkyEmzTeVaKRuT2iBAhwjkdxmNhK6KNK+sQE+IJ8ZYEpzH ytI18pRUsCU8R2lDzNHlSCIDiaM0k2gyZ4wU89JEIyYAbzosKiyeAKMDt0Gl6pRcaaSfpFjfp0c Pp6RARqGBW0Y6n4IA1OdYS/Izk6PdxeWa8PKwvKO0oFMIXS3DgkkyKbsBBxLZIbZA8aqKqLahPw btOoX8LadHrk/rtJKtcS4ESiq2/R6x2Wka10p3+dYmDIjOtN2x0VxpyPAWnyrTReD6ODcrInJot f5gX3N+eHpVuEwuBsqhdG9D3NbNcnTWTzYwdI6BZRAvfRi1FmCbraUzvkSinJNKlV6is90uFhgM w9E5n4yWI0EHqjQwgjnnV2afs30RUg4= X-Received: by 2002:a05:622a:4899:b0:533:31b5:bec5 with SMTP id d75a77b69052e-55d769e99demr598784991cf.17.1795996894675; Sun, 29 Nov 2026 16:01:34 -0800 (PST) Received: from [127.0.0.1] ([20.64.247.97]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d7884c35dsm264350481cf.16.2026.11.29.16.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 16:01:34 -0800 (PST) Message-Id: In-Reply-To: References: From: "Alessio Attilio via GitGitGadget" Date: Mon, 30 Nov 2026 00:01:25 +0000 Subject: [PATCH 4/4] rebase: test whitespace fixes with the merge backend Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Alessio Attilio , Alessio Attilio From: Alessio Attilio Exercise whitespace=fix while replaying commits with the merge backend, including interactive use, attribute rules, existing whitespace in the base, added files, and whitespace at end of file. Also check that the option remains rejected with the merge backend for actions it does not support. These tests cover the user-visible behavior across both backend selection and merge replay, guarding against fixing unchanged context or regressing the apply backend. Signed-off-by: Alessio Attilio --- t/t3417-rebase-whitespace-fix.sh | 163 +++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/t/t3417-rebase-whitespace-fix.sh b/t/t3417-rebase-whitespace-fix.sh index 96f2cf22fa..c65b5c1e37 100755 --- a/t/t3417-rebase-whitespace-fix.sh +++ b/t/t3417-rebase-whitespace-fix.sh @@ -94,6 +94,169 @@ test_expect_success 'same, but do not remove trailing spaces' ' test_cmp file third ' +test_expect_success 'interactive rebase fixes whitespace' ' + git config core.whitespace blank-at-eol && + git checkout -b interactive-whitespace HEAD^ && + test_write_lines "clean" >file && + git commit -am clean && + test_write_lines "trailing " >>file && + git commit -am "add whitespace errors" && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor git rebase -i --whitespace=fix HEAD^^ && + test_write_lines clean "trailing" >expect && + test_cmp expect file +' + +test_expect_success 'interactive rebase fixes whitespace in upstream context' ' + test_create_repo context && + ( + cd context && + test_write_lines one "two " three >file && + git add file && git commit -m base && + git checkout -b topic && + test_write_lines one two THREE >file && + git commit -am topic && + git checkout -b upstream HEAD^ && + test_write_lines one two three >file && + git commit -am whitespace && + git checkout topic && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix upstream && + test_write_lines one two THREE >expect && + test_cmp expect file + ) +' + +test_expect_success 'interactive rebase preserves other whitespace changes' ' + test_create_repo preserve && + ( + cd preserve && + git config core.whitespace blank-at-eol && + test_write_lines one "two " three >file && + git add file && git commit -m base && + git checkout -b topic && + printf " one\ntwo \nthree \n" >file && + git commit -am topic && + git checkout -b upstream HEAD^ && + printf "one\ntwo\nthree\n" >file && + git commit -am whitespace && + git checkout topic && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix upstream && + printf " one\ntwo\nthree\n" >expect && + test_cmp expect file + ) +' + +test_expect_success 'interactive rebase rejects unsupported whitespace actions' ' + test_create_repo unsupported && + ( + cd unsupported && + test_write_lines base >file && + git add file && git commit -m base && + test_write_lines change >>file && + git commit -am change && + test_must_fail env GIT_SEQUENCE_EDITOR=: \ + git rebase -i --whitespace=warn HEAD^ + ) +' + +test_expect_success 'interactive rebase fixes blank-at-eof' ' + test_create_repo eof && + ( + cd eof && + test_write_lines one >file && + git add file && git commit -m base && + test_write_lines one two >file && + printf "\n\n" >>file && + git commit -am whitespace && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix HEAD^ && + test_write_lines one two >expect && + test_cmp expect file + ) +' + +test_expect_success 'interactive rebase handles upstream blank-at-eof fixes' ' + test_create_repo eof-context && + ( + cd eof-context && + test_write_lines one >file && + printf "\n\n" >>file && + git add file && git commit -m base && + git checkout -b topic && + test_write_lines one two >file && + printf "\n\n" >>file && + git commit -am topic && + git checkout -b upstream HEAD^ && + test_write_lines one >file && + git commit -am whitespace && + git checkout topic && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix upstream && + test_write_lines one two >expect && + test_cmp expect file + ) +' + +test_expect_success 'interactive rebase honors path whitespace rules' ' + test_create_repo attr && + ( + cd attr && + echo "file whitespace=-blank-at-eol" >.gitattributes && + test_write_lines one >file && + git add .gitattributes file && git commit -m base && + printf "one \n" >file && + git commit -am whitespace && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix HEAD^ && + printf "one \n" >expect && + test_cmp expect file + ) +' + +test_expect_success 'interactive rebase fixes whitespace in added files' ' + test_create_repo added && + ( + cd added && + test_write_lines base >file && + git add file && git commit -m base && + printf "new file with whitespace \n" >new-file && + git add new-file && git commit -m add && + write_script sequence-editor <<-\EOF && + sed -e "s/^pick/pick/" "$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + GIT_SEQUENCE_EDITOR=./sequence-editor \ + git rebase -i --whitespace=fix HEAD^ && + printf "new file with whitespace\n" >expect && + test_cmp expect new-file + ) +' + sed -e's/Z//' >beginning <