Skip to content

[Feature Request] Include commit hash when showing a commit #2217

@jbyler

Description

@jbyler

When displaying a commit object, vim-fugitive calls git show with a pretty format that imitates what git cat-file commit shows: it includes the tree hash, parent hash, author info, and committer info.

My feature request is to add the commit hash to the pretty format, and ideally also the ref description.

Justification: when viewing info about a commit, I'd like easy access to which commit I'm looking at. I might want to yank the commit hash to use elsewhere, for example.

I'm happy to submit a PR for this if you'll accept it. The PR will do 2 things:

  1. add commit%x20%H%d%n to the start of the pretty format
  2. replace git cat-file commit <rev> with a modified git show command in the code branch for when b:fugitive_display_format is set, so that the format will still match when pressing a or i

I'm testing this locally and it seems to work fine. I can keep it as a local patch I suppose if you don't think this feature will benefit other users.

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