Skip to content

only offer edit on head revision, open older revisions as tempfile - #3012

Open
MsfPablo wants to merge 1 commit into
gitui-org:masterfrom
MsfPablo:open-revision-tempfile
Open

only offer edit on head revision, open older revisions as tempfile#3012
MsfPablo wants to merge 1 commit into
gitui-org:masterfrom
MsfPablo:open-revision-tempfile

Conversation

@MsfPablo

Copy link
Copy Markdown

Closes#2147

In the revision file tree edit [e] was offered for any file at any revision, but it always opened the file as it currently exists on disk. That means you don't see what you expected when looking at an old revision, or the editor errors out because the file no longer exists.

Now:

  • edit [e] is only shown when the browsed revision is HEAD (existing behaviour, unchanged).
  • For any other revision, open [o] is shown instead: it writes that revision's blob to a temporary file (gitui-<short-id>-<name>) and opens that in the external editor.

go to head [g] from the issue is left for a separate issue as suggested.

New key: open_file_revision (defaults to o). The revision file tree consumes it before the global options popup binding.

cargo build, cargo clippy --all-features and cargo fmt --check are clean.

In the revision file tree the `edit [e]` command always opened the file
as it exists on disk, regardless of the revision being browsed. That
shows content that does not match the revision, or fails outright when
the file no longer exists.
`edit [e]` is now only offered when the browsed revision is HEAD. For
any other revision `open [o]` dumps that revision's blob into a
temporary file and opens that in the external editor instead.
closesgitui-org#2147
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

edit only for head revision otherwise open as tempfile

1 participant

@MsfPablo