8000 Suggestion: PSProvider for working with Git · Issue #47 · PoshCode/PSGit · GitHub
[go: up one dir, main page]

Skip to content

Suggestion: PSProvider for working with Git #47

8000 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

Open
omidkrad opened this issue Jun 12, 2015 · 6 comments
Open

Suggestion: PSProvider for working with Git #47

omidkrad opened this issue Jun 12, 2015 · 6 comments

Comments

@omidkrad
Copy link

Default PSProviders in PowerShell are the followings:

> Get-PSProvider

Name                 Capabilities                                      Drives
----                 ------------                                      ------
Registry             ShouldProcess, Transactions                       {HKLM, HKCU}
Alias                ShouldProcess                                     {Alias}
Environment          ShouldProcess                                     {Env}
FileSystem           Filter, ShouldProcess, Credentials                {C, D, E, F...}
Function             ShouldProcess                                     {Function}
Variable             ShouldProcess                                     {Variable}

I thought it would make sense to have one for working with Git repositories, so that you can do, for example:

Get-ChildItem Git:MyRepo\src\*

and other Git operations with standard PS cmdlets.

@Jaykul
Copy link
Member
Jaykul commented Jun 12, 2015

Can you give some more examples of git actions which you can imagine mapping to a provider?

For instance, how would you imagine handling the core 6:
clone
status
add
commit
push
pull

In my head, I immediately thought git clone would map to New-PSDrive ... but that already clashes with your example 😉

@jrich523
Copy link
Contributor

i had considered this too (once i saw add-item remove-item) but after giving it some thought i realized it wouldnt really work out too well in the end

@omidkrad
Copy link
Author

I don't think there is an intuitive way to do the main operations. Now that I think more about it I think a PSProvider would be better suited for managing the Git repositories on your computer, rather than Git operations themselves. For example the Git: drive can be your central point for registering and accessing Git repositories on your computer, or on your GitHub account. I think it can work well with Git cmdlets. For example I can imagine the following scenario:

cd GitHub:PoshCode/PSGit
dir # list files
Get-Commit # list commits
Open-Commit a6eb714 # open commit in GitHub
Git-Clone . C:\GitHub -register
cd Git:\
dir # list registered repos
dir -directory | where { $_.Remote -eq PoshCode/PSGit }

Difference between using the repository from file system vs Git: drive is that when querying files in the Git: drive you will get get-specific properties, such as SHA, LastModifiedBy, LastCommitDate, History, Lines, IsIgnored, RemotePath, etc.

@Jaykul
Copy link
Member
Jaykul commented Jun 12, 2015

Oh, well in that case, you'll be happy to hear that you don't need a git drive to get stuff like that when you query files ... we can detect you're in a git folder and give you stuff like that on your Get-ChildItem output automatically, without needing to register them.

@jrich523
Copy link
Contributor

yeah, if you look there is a GCI Proxy branch (currently a PR) that shows the change/stage state

@omidkrad
Copy link
Author

That's great to know. Thank you guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0