Skip to content

Work attempt patch follows the user's diff.submodule setting #287

Closed

Description

@NopeCharon

Expected and actual behavior / 实际现象与期望

PATCH_FORMAT_ARGS (server/local_git.py) pins the patch format the Host parses, but not the submodule format. With diff.submodule=log or diff.submodule=diff in the user's Git config, the attempt patch (and collect_diff's patch) changes shape when a submodule pointer moves:

  • log: Git writes Submodule vendor abc..def: followed by > commit subject lines. The parser appends each > ... line as a context line to the previous file's last hunk.
  • diff: Git writes the submodule's own changes as diff --git a/vendor/lib.txt b/vendor/lib.txt. The canvas lists files inside the submodule as attempt changes, next to a hunk-less vendor entry from changed_files.

Expected: the default Subproject commit <old> / Subproject commit <new> hunk for the submodule path, regardless of user configuration.

Steps to reproduce / 复现步骤

In a workspace with a submodule at vendor:

git config diff.submodule log    # or: diff

Run an attempt that commits inside vendor and edits app.txt in the main repository, then open the attempt diff.

Actual (log): the app.txt hunk ends with an extra context line > library change, and vendor has no hunks.
Actual (diff): an extra vendor/lib.txt entry.
Expected: app.txt with its own hunk and vendor with the Subproject commit hunk.

Relevant environment / 使用环境

Platform-independent; current main (f86c72a). Reproduced with Git 2.43 and 2.54.

Sanitized evidence / 错误信息或截图(请先脱敏)

git diff --submodule=short overrides diff.submodule for one command, like the options already in PATCH_FORMAT_ARGS.

Related issues or fixes / 相关问题或修复

Follow-up to #279 / #284; the submodule configuration was noted as a separate follow-up in the #284 review.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions