Skip to content

refactor(diff): normalize git argument ordering in workspaceTrackedDiff #374

Description

@lizhengfeng101

Description

In internal/diff/git.go, the workspaceTrackedDiff function places the HEAD positional argument between option flags (--dst-prefix=b/ and --no-color), which is inconsistent with the argument ordering used in other git command invocations in the same file.

Current (line ~264):

p.runGit(ctx, "-c", "core.quotepath=false", "diff", "--no-ext-diff", "--no-textconv", "--find-renames", "--src-prefix=a/", "--dst-prefix=b/", "HEAD", "--no-color", "-U"+fmt.Sprint(DiffContextLines), "--")

Expected: Move HEAD after all option flags (before --), consistent with how other diff commands in the file are structured — options first, then positional refs, then --.

Scope

  • File: internal/diff/git.go
  • Function: workspaceTrackedDiff
  • Two runGit calls need reordering (the unstaged and staged diff commands)

Acceptance Criteria

  • HEAD (and --staged in the second call) are placed after all --flag options and before --
  • make test passes
  • make check passes

Context

Discovered during review of #365. This is a cosmetic/consistency improvement — the current code works correctly since git is flexible about argument ordering, but uniform style makes the codebase easier to maintain.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions