Skip to content

Browse repository contents at a revision without checkout #14

Description

@Tranthanh98

What would you like to see?

Add “Show Repository at Revision” to the History commit context menu. It should open a read-only repository browser for that commit, branch, or tag without changing HEAD, the index, or the working tree.

Problem it solves

Commit diffs show what changed in one commit, but they do not show the complete project state at that point in time. Users currently need to checkout the revision or use Terminal commands just to inspect surrounding files.

Feasibility

Medium-high. Git provides the required object access through ls-tree and show <revision>:<path>. The main work is a scalable tree browser, safe revision/path handling, file rendering, and binary/large-file behavior. No checkout is required.

Proposed UX

  • Add “Show Repository at Revision” to a single commit context menu and allow the same viewer to accept branches/tags later.
  • Open a read-only split view: lazy directory tree on the left, selected file content on the right.
  • Keep the revision identity visible with commit subject and short hash.
  • Support text preview, syntax highlighting where available, copy, and reveal metadata.
  • For binary, submodule, symlink, Git LFS pointer, missing, or oversized content, show a specific non-editable state rather than corrupt text.
  • Offer search/filter by path after the base browser is stable.

Acceptance criteria

  • Opening and browsing a revision never changes HEAD, index, working tree, selection, or uncommitted files.
  • Directories load lazily and filenames with tabs, newlines, Unicode, or spaces are parsed safely using NUL-delimited Git output.
  • Selecting a normal text blob displays exactly the content stored at that revision.
  • Binary and large blobs do not block or exhaust the UI.
  • Switching rapidly between nodes cannot display stale file content.
  • Tests cover nested trees, empty repositories, symlinks, submodules, unusual paths, deleted files, binary files, and large-file limits.

Implementation notes

Use validated refs and argument arrays. git ls-tree -z can enumerate tree entries and git show <revision>:<path> can read a blob. Keep Git object loading in a service/view model and the SwiftUI view rendering-only.

References: https://www.jetbrains.com/help/idea/investigate-changes.html and https://git-scm.com/docs/git-ls-tree

Area

Commits / History

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions