Repository navigation
display context menu for files in commit history - #4037
Conversation
|
Looks like your PR is very similar to the work found in PR #4030. |
|
@iAmWillShepherd yep, I think that they can be merged together (however I have no idea how). |
|
and additional menu option can be added to my pr. |
|
@iAmWillShepherd Can I fork your branch and send my changes into your PR? |
|
@iAmWillShepherd already implemented it: |
|
@iAmWillShepherd I have finished changes according to your pr #4030 . |
| { | ||
| label: revealInFileManagerLabel, | ||
| action: () => this.props.onRevealInFileManager(filePath), | ||
| enabled: this.props.selectedFile.status !== AppFileStatus.Deleted, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| import { showContextualMenu } from '../main-process-proxy' | ||
| import { IMenuItem } from '../../lib/menu-item' | ||
|
|
||
| const RestrictedFileExtensions = ['.cmd', '.exe', '.bat', '.sh'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Dropping myself from this review as I've contributed to a bunch of the refactoring/cleanup. |
|
🍎 |
| * @param path The path of the file relative to the root of the repository | ||
| */ | ||
| export function revealInFileManager(repository: Repository, path: string) { | ||
| const normalized = Path.join(repository.path, path) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| readonly availableWidth: number | ||
|
|
||
| /** | ||
| * Called to open a file it its default application |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (!fileExistsOnDisk) { | ||
| showContextualMenu([ | ||
| { | ||
| label: 'File does not exist on disk', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| enabled: isSafeExtension && fileExistsOnDisk, | ||
| }, | ||
| { | ||
| label: __DARWIN__ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
So, I tried to merge it - please review. |
|
@crea7or thanks for following up with this! I ran through some tests on this again and it all seems file, but I'll let @iAmWillShepherd follow up with any outstanding feedback he has. |


Fixes #2845
This code will add context menu for the files in the repo history with these comands: open and show in explorer. Opening/finding file from the commit is a very handy thing and here is issue about this context menu opened in the Github Desktop repo.
There is only basic functionality without actuall checks if the selected file still exist in the repo, but code that checks for potentially dangerous files is here (actually copied from changed-file.tsx).