Skip to content

Support directory history #516

Description

@ItsDrike

Summary

I'd love to see :CodeDiff history support Git pathspecs, similarly to how the explorer already does.

For example:

:CodeDiff history -- lua/codediff/ui/

would show only commits that touched files under that directory, with only the changes to the files in that directory, much like:

git log -- lua/codediff/ui/

or, more generally, allow arbitrary Git pathspecs after --.

Motivation

When working on a larger project, I often want to browse the history of a subsystem or directory rather than the entire repository or a single file.

CodeDiff's history view is a really nice interface for exploring commits and viewing diffs, but currently the available scopes seem to be:

  • Entire repository
  • Single file

Having an intermediate directory/pathspec scope would make it much easier to navigate the history of larger codebases.

Current behavior

Passing a pathspec after -- appears to be silently ignored:

:CodeDiff history -- lua/codediff/ui/

still shows the full repository history.

Passing the directory as a positional argument gets closer:

:CodeDiff history lua/codediff/ui/

This filters the commit list to commits that touched files within the directory, but selecting a commit still shows all files changed by that commit, including files outside the directory. For larger commits, this makes it difficult to focus on the history of just that subsystem.

For comparison, a file path behaves as expected:

:CodeDiff history lua/codediff/ui/init.lua

Only that file's history and diffs are shown.

Note that even a file path is ignored when passed after --:

:CodeDiff history -- lua/codediff/ui/init.lua

which again shows the full repository history.

Expected behavior

Ideally, I'd expect :CodeDiff history to support Git pathspecs after --, so that both the commit list and the displayed diffs are scoped to the supplied path(s), whether that's a single file, a directory, or any other valid Git pathspec.

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