From nobody Thu Aug 13 20:33:34 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hLcWf4SG4z6pGKB for ; Thu, 13 Aug 2026 20:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hLcWf3dFHz45Fb for ; Thu, 13 Aug 2026 20:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786653214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vbb6NuxPcK8m5DfPQvRIbKG71ZGPYYPwk6XVZZiUNmo=; b=DDS5EpW2FEXU7QS+9jazx7B8F85BDZGga1Mrkca4066R2TE50kHzLYx4cVrrirMVmcTIjG gnD9/FF7LG/GUC9qW0AA/QppoQMnkL33rYP3RW3E3EaHphgiy9TdbB84aUS75IRbswAfuP RPMXg56ipCCj1UbE2JETDiqBOE1qDufCJZlJlLWzoP0tigiGIpKl8FHIvyF1pG1/aDjp/y r2I10QTsfFMAVQznOIWTsYWBiIQkF2Q9AjCcnPa/k4dQtj90s3lc+EIBjndpysF2oU8GCk yMXRQX+zT/PlzTa7XuVoOM462lj04wHoEwsus/CeQQskosBUTX5JOAoqyVqEkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786653214; a=rsa-sha256; cv=none; b=CmGJb6uBAsJQHZboNYulAndyDNsfgLGDpOnnFy63CdjsS3+vAFFCaoboYFlNMp8wNefpIZ PM5esByZGc8dIhVEHXsD2ZB55yRXdrBhT1aZWgECgGfxNxN/ZWTuTHWw0as3exB5MNuBX5 cYOQkPqeYlrPLaR4ClE4HMO0K1wdvGfuV4D8RqRtCKyBv3HyHlzwNWwX+VLVxQsw7EFcAw bwqTOkAWtfX/EDDrNOkHOPqyx1EqjW6wkpeCpBoODr9eimIo7Wj7CCYtdivYsQURMSWT5R TeYo2/YujlEmYOHmzqPfZ247ZL0PGZXrhIxzYgbL9ZNQzwZAwsY4yLusRGqMNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786653214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vbb6NuxPcK8m5DfPQvRIbKG71ZGPYYPwk6XVZZiUNmo=; b=LoK/1Fv2CfRe/H/79SQp4W4CkNzcXO+FoAWxw4thhU16tLWv5P0GxT/1YJoubesLhpViFl 9uNfOHUbbZLdgZLLdEX/vLOu7f5UX6N5b07mK1aeJbyj8acMYT6dW88XU7J3jBKEAe7U5K DY4DIsa49kF11eUUQaUi6OXfecmJRzDcGGVSFD4d8H+//kiAmvj5x/a6rlV6yvFXWiTRDG 0OJWI4EcW0H7sxkcJi7Ql/s8kgl5kQ6bKGGnu/hKIIXpiLFr/6ZemFE2x4gKV8Zu6uU5r/ fcpQ+BnGB+A2tWQsl+4+FaTBRfzHNADFOtW8rJhiNk9984BjdwQij3iK1e74GA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hLcWf2KpLzBQ1 for ; Thu, 13 Aug 2026 20:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a57a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 13 Aug 2026 20:33:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Devin Teske Subject: git: a8347f442824 - main - git-arc: Add a diff subcommand List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dteske X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8347f44282408fb1a4c0aa611ecdf469bc030a8 Auto-Submitted: auto-generated Date: Thu, 13 Aug 2026 20:33:34 +0000 Message-Id: <6a7e2a1e.3a57a.54b10e94@gitrepo.freebsd.org> The branch main has been updated by dteske: URL: https://cgit.FreeBSD.org/src/commit/?id=a8347f44282408fb1a4c0aa611ecdf469bc030a8 commit a8347f44282408fb1a4c0aa611ecdf469bc030a8 Author: Devin Teske AuthorDate: 2026-08-13 20:31:36 +0000 Commit: Devin Teske CommitDate: 2026-08-13 20:31:36 +0000 git-arc: Add a diff subcommand Show the differences between local commits and their associated Phabricator reviews, i.e., what "git arc update" would upload. For each commit, the review's current raw diff is applied to the commit's parent in a temporary index and the resulting tree is compared against the commit itself. An empty diff means the commit and the review are in sync. This makes it easy to check whether local amendments have diverged from the posted review before updating it, or to confirm that a review is current before landing. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D58789 --- tools/tools/git/git-arc.1 | 23 ++++++++++++++++++++++- tools/tools/git/git-arc.sh | 45 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1 index da5732fdba26..655f81c971c5 100644 --- a/tools/tools/git/git-arc.1 +++ b/tools/tools/git/git-arc.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 27, 2026 +.Dd August 11, 2026 .Dt GIT-ARC 1 .Os .Sh NAME @@ -39,6 +39,8 @@ .Op Fl p Ar parent .Ar commit-ref Op Ar commit-ref ... .Nm +.Cm diff Ar commit-ref Op Ar commit-ref ... +.Nm .Cm list Ar commit-ref Op Ar commit-ref ... .Nm .Cm patch @@ -117,6 +119,19 @@ Specify the parent of the first commit in the list. This is useful when adding more commits on top of an already existing stack in Phabricator. .El +.It Cm diff +Show the differences between the specified commits and their associated +Differential Revisions, that is, what +.Cm update +would upload. +For each commit, the current raw diff of the associated revision is +applied to the commit's parent, and the result is compared against the +commit itself. +An empty diff means the commit and the revision are in sync. +.Pp +Since the revision's diff is applied to the local commit's parent, the +comparison may fail or show unrelated changes if the commit has been +rebased since the revision was last updated. .It Cm list Print the associated Differential Revisions for the specified commits. .It Cm patch @@ -271,6 +286,12 @@ The title of the commit must be the same as it was when the review was created. Note that the review description is not automatically updated. .Pp +Show what an update of the review corresponding to HEAD would upload, +e.g., to check whether local amendments have diverged from the review: +.Bd -literal -offset indent +$ git arc diff HEAD +.Ed +.Pp Apply the patch in review D12345 to the currently checked-out tree, and stage it: .Bd -literal -offset indent diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index d8551630f7e2..c34d47160749 100755 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -4,6 +4,7 @@ # # Copyright (c) 2019-2021 Mark Johnston # Copyright (c) 2021 John Baldwin +# Copyright (c) 2026 Devin Teske # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -58,6 +59,7 @@ Usage: git arc [-vy] Commands: create [-dl] [-r [,...]] [-s subscriber[,...]] [|] + diff | list | patch [-bcrs] [ ...] stage [-b branch] [|] @@ -429,6 +431,41 @@ gitarc__create() done } +# +# Show the differences between local commits and their associated +# Phabricator reviews, i.e., what "git arc update" would upload. The +# review's tree is reconstructed by applying its current raw diff to the +# local commit's parent in a temporary index, and is then compared +# against the local commit. +# +gitarc__diff() +{ + local commit commits diff rawdiff rtree + + commits=$(build_commit_list "$@") + + for commit in $commits; do + diff=$(commit2diff "$commit") + + rawdiff=$(xmktemp) + fetch -q -o "$rawdiff" "https://reviews.freebsd.org/$diff.diff" || + err "could not fetch ${diff}.diff" + + rtree=$( + export GIT_INDEX_FILE="$(xmktemp)" + git read-tree --quiet "$commit~" && + git -C "$(git rev-parse --show-toplevel)" apply \ + --cached "$rawdiff" && + git write-tree + ) || err "cannot apply $diff to $commit~ (rebased since last update?)" + + echo "Comparing $diff against" \ + "$( git rev-parse --short "$commit" )..." >&2 + + git diff "$rtree" "$commit" + done +} + gitarc__list() { local chash commit commits diff openrevs title @@ -837,7 +874,7 @@ else fi case "$1" in -create|list|patch|stage|update) +create|diff|list|patch|stage|update) ;; *) err_usage @@ -869,10 +906,10 @@ if [ -n "$GIT_PAGER" ]; then PAGER=$GIT_PAGER fi -# Bail if the working tree is unclean, except for "list" and "patch" -# operations. +# Bail if the working tree is unclean, except for "diff", "list" and +# "patch" operations. case $verb in -list|patch) +diff|list|patch) ;; *) require_clean_work_tree "$verb"