Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch repos to a subrepo by clicking on it in the Commit Details View file tree #155

Closed
patrickyyang opened this issue Aug 9, 2019 · 7 comments
Assignees
Labels
feature request Feature request nice to have A feature request that is nice to have (lower priority)
Projects
Milestone

Comments

@patrickyyang
Copy link

When click the submodule modification in git graph, it will show an error tips.
Maybe should jump to a new graph page, and show the selected submodule's logs.

@mhutchie
Copy link
Owner

mhutchie commented Aug 9, 2019

Hi Patrick,

Submodules can already be added to Git Graph by running the Git Graph: Add Git Repository command from the Visual Studio Code Command Palette. Once added, a "Repo" dropdown appears in the Git Graph View control bar letting you choose which repo you'd like to view in Git Graph.

I'm not sure if you're asking for other functionality, and I've misinterpreted your request. If I have, please provide more information to describe what you would like implemented, so I can better understand your request. Additionally, please clarify what you mean by "submodule modification" and "show an error tips".

@patrickyyang
Copy link
Author

patrickyyang commented Aug 9, 2019

I got it, Add Git Repository supports this feature, but maybe a little inconvenient.

When I click the submodule modification to view the diff, the following tips shows
image

So, I think maybe should scan the submodule and automatically add it to repos, and if click to view the diff, then jump to the clicked submodule.

@mhutchie
Copy link
Owner

mhutchie commented Aug 9, 2019

Hi Patrick,

It seems like your request is that you would like Git Graph to automatically switch from the parent repo to display the submodule repo in the Git Graph view, if the user is attempting to view the diff of a file that occurs within the submodule. Is this correct?

Could you please provide:

  • An example directory structure, indicating the positions of the parent and submodule repos.
  • The full message being shown in the screenshot you provided "Unable to retrieve file: ...".
    • Which repo contains the commit hash being referenced?
  • How have you configured the repos such that files from within the submodule are also tracked in the parent repository?

@patrickyyang
Copy link
Author

I have set options git-graph.maxDepthOfRepoSearch, I read the code, It will stop scanning the directory when get a repo.

these are my submodules:
+4c7886abaf0fd3c584a470dce05fab7035130923 testsets (heads/master)
ac6d9862574c3e8e674c4d27f7ea485d1788f893 tools/errant (remotes/origin/HEAD)
17a7b713d88609f99de526c58aace0b03d733412 tools/jfleg (remotes/origin/HEAD)
53dbe14527cc7b8b8bbf13f8c01e45426cdd12c6 tools/m2scorer (heads/master)
d517525a223706fdc5f7174da39e0373a5017a94 tools/marian-dev (heads/master)
fd6d9682188c5f0aa28bdc1270e28c5fa8534e27 tools/moses-scripts (heads/master)
18a5c87046d15290a1b7d947449052aa6d2b47cc tools/subword-nmt (heads/master)
4a55a8ab33b5559a6444822544b3d0a6acc8295e validsets (remotes/origin/HEAD)
image

marian-dev is a submodule, I hope to jump to marian-dev's git commit list when I click it.

@mhutchie
Copy link
Owner

mhutchie commented Aug 9, 2019

@patrickyyang Apologies, I forgot that subrepos are not detected by the maxDepthORepoSearch when writing my previous response. The reason why they cannot be automatically scanned is due to the exponential search cost this adds when the extension is searching for repos (that occurs every time Visual Studio Code is opened), as the extension would have to traverse the entire directory structure (on large projects and workspaces this is extremely slow). That is why the “Add Git Repository” command was added, to avoid the need for scanning the entire workspace.

From the extensions perspective, the git command used to get the data for the file tree returns what appears to be a file (it has no idea that it is actually a sub repo). I’ll make an adjustment to the logic so that if the sub repo appears in the file tree of the Commit Details View, and it is known to be a subrepo by the extension (the user has manually added it via the command), it will display it as a repo in the tree. Clicking on the subrepos name in the file tree will switch the current repo displayed in Git Graph to it.

Thanks for making this feature request, it’s definitely a nice improvement.

@mhutchie mhutchie added this to To Do in Git Graph Aug 9, 2019
@mhutchie mhutchie added the nice to have A feature request that is nice to have (lower priority) label Aug 9, 2019
@mhutchie mhutchie changed the title Support git submodule Switch repos to a subrepo by clicking on it in the Commit Details View file tree Aug 9, 2019
@mhutchie mhutchie added this to the v1.13.0 milestone Aug 10, 2019
@mhutchie mhutchie moved this from To Do to In Progress in Git Graph Aug 10, 2019
@patrickyyang
Copy link
Author

Thanks for developing this new feature, This extension is very awesome.

mhutchie added a commit that referenced this issue Aug 15, 2019
… file tree, clicking on it will now load it in the Git Graph View.
@mhutchie mhutchie moved this from In Progress to Ready For Release in Git Graph Aug 15, 2019
@mhutchie
Copy link
Owner

This will be available in v1.13.0, which will be released in the next day.

@mhutchie mhutchie moved this from Ready For Release to Released in Git Graph Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request nice to have A feature request that is nice to have (lower priority)
Projects
Git Graph
Released
Development

No branches or pull requests

2 participants