-
Notifications
You must be signed in to change notification settings - Fork 324
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
[File Explorer Integration] Git submodule status and commit log inside submodule #3745
Conversation
extensions/GitExtension/FileExplorerGitIntegration/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
@@ -45,6 +36,11 @@ public void Add(string path, GitStatusEntry status) | |||
} | |||
} | |||
|
|||
public bool TryAdd(string path, SubmoduleStatus status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we consider using a more descriptive method name instead of TryAdd which is identical to the called Dictionary method name? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately chose TryAdd
because it is identical to the method on Dictionary
. My hope was that would make the semantics clear.
extensions/GitExtension/FileExplorerGitIntegration/Models/CommitLogCache.cs
Outdated
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration/Models/StatusCache.cs
Outdated
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration.UnitTest/GitSubmoduleUnitTests.cs
Outdated
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration.UnitTest/GitSubmoduleUnitTests.cs
Outdated
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration.UnitTest/SandboxHelper.cs
Outdated
Show resolved
Hide resolved
...FileExplorerGitIntegration.UnitTest/resources/submodules/sm_added_and_uncommitted/README.txt
Outdated
Show resolved
Hide resolved
...xtension/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_changed_file/README.txt
Outdated
Show resolved
Hide resolved
...xtension/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_changed_head/README.txt
Outdated
Show resolved
Hide resolved
...tension/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_changed_index/README.txt
Outdated
Show resolved
Hide resolved
...ileExplorerGitIntegration.UnitTest/resources/submodules/sm_changed_untracked_file/README.txt
Outdated
Show resolved
Hide resolved
...nsion/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_missing_commits/README.txt
Show resolved
Hide resolved
...eExplorerGitIntegration.UnitTest/resources/submodules/sm_missing_commits_detached/README.txt
Show resolved
Hide resolved
...itExtension/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_unchanged/README.txt
Outdated
Show resolved
Hide resolved
...on/FileExplorerGitIntegration.UnitTest/resources/submodules/sm_unchanged_detached/README.txt
Outdated
Show resolved
Hide resolved
...ions/GitExtension/FileExplorerGitIntegration.UnitTest/resources/submodules_target/README.txt
Outdated
Show resolved
Hide resolved
…sources/submodules/sm_added_and_uncommitted/README.txt Co-authored-by: ssparach <128866445+ssparach@users.noreply.github.com>
38ac731
to
4af2462
Compare
extensions/GitExtension/FileExplorerGitIntegration/Models/CommitLogCache.cs
Outdated
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration/Models/CommitLogCache.cs
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration/Models/StatusCache.cs
Show resolved
Hide resolved
extensions/GitExtension/FileExplorerGitIntegration.UnitTest/SandboxHelper.cs
Outdated
Show resolved
Hide resolved
…itLogCache.cs Co-authored-by: Vineeth Thomas Alex <vineeththomasalex@gmail.com>
…/microsoft/devhome into user/defaultryan/submodulestatus
Summary of the pull request
Parse submodule status (which submodules are new, changed, and/or dirty) and report latest commit info from files within the submodule.
Still to do: display folder and file status for submodule contents. That is coming next, but this commit is getting big enough as it is.
Detailed description of the pull request / Additional comments
A big part of this PR is the addition of test repos under the resources folder. This allows us to "freeze" a repository in a specific state, including the working directory and index. We're able to do this by renaming
.git
todot-git
and.gitmodules
todot-gitmodules
, and this makes Git see these files/folders as just normal stuff, instead of special Git infrastructure. When deploying the repo to a temp location for testing, we undo that rename. This approach was inspired by similar approaches seen in libgit2 and libgit2sharp for their unit testing.When finding the latest commit, always run the git command from the leaf-most folder. This way, git will automatically use the correct history when were are inside a submodule.
Parse submodule-specific status and provide the appropriate property values. New submodule status values are:
Submodule staged
Submodule changed
Submodule dirty
Validation steps performed
Ran newly added unit tests.
PR checklist