Skip to content

Support --summary on show, log and diff #17

Closed as not planned
Closed as not planned

Description

@Hazzng

Summary

--summary isn't supported on git show, git log or git diff. Each one fails with exit 1:

Unknown option "--summary".
Not all git options are supported. Run 'git <command> --help' for available options.

Agents use git show --stat --summary and git log --summary to see what a commit created, deleted or re-moded. Right now the whole command fails, so they get none of the output, not even the commit.

Repro (just-git 1.9.1 + just-bash 3.6.0)

mkdir s && cd s && git init -q
echo a > a && printf 'x\n' > run.sh && chmod 755 run.sh && git add -A && git commit -q -m one
git rm -q a && echo b > b && chmod 644 run.sh && git add -A && git commit -q -m two
git show --stat --summary --format=%s HEAD; echo rc=$?
git log --summary --format=%s -1; echo rc=$?
git diff --summary HEAD~1 HEAD; echo rc=$?

just-git 1.9.1: the error above three times, rc=1 each time.

git 2.34.1:

two

 a      | 1 -
 b      | 1 +
 run.sh | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 a
 create mode 100644 b
 mode change 100755 => 100644 run.sh
rc=0
two

 delete mode 100644 a
 create mode 100644 b
 mode change 100755 => 100644 run.sh
rc=0
 delete mode 100644 a
 create mode 100644 b
 mode change 100755 => 100644 run.sh
rc=0

Most of it exists already

src/lib/commit-summary.ts already builds these lines for the summary printed after git commit (create mode, delete mode, rename ... (N%)). --summary could reuse that list, printed after the stat block (or alone, when no other diff format is selected).

One difference to fix while there: for a permission-only change, commit-summary.ts L141–L144 pushes a delete mode and a create mode line. Git prints mode change 100755 => 100644 <path> when both sides are regular files, and keeps delete + create only for type changes such as file to symlink. So today git commit after a chmod shows

 create mode 100644 run.sh
 delete mode 100755 run.sh

where git shows mode change 100755 => 100644 run.sh. (Cited at b509001, 1.9.1.)

Suggested scope

--summary on show, log and diff, combinable with --stat, --shortstat, --numstat and --name-only/--name-status the way git allows. Lines: create mode, delete mode, mode change <old> => <new>, and rename <path> (<similarity>%) / copy.

Low priority. git log -1 --name-status and git diff --name-status show added and deleted files. A mode change appears only as M, and git ls-files -s shows the current mode but not the old one.

Activity

  1. blindmansion commented on Oct 14, 2026

    @blindmansion
    Owner

    Duplicate of #19, which #21 fixed (merged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions