-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
(un)stage directory #600
(un)stage directory #600
Conversation
This is just a start to the PR to get an idea of how to do it. I am new to vscode and have never created/edited an extension before, so constructive criticism is appreciated. If this is not the right direction feel free to close this PR |
src/views/viewCommands.ts
Outdated
const fileNodes: (CommitFileNode | StatusFileNode)[] = []; | ||
|
||
for (const fileNode of fileNodes) { | ||
void (await this.stageFile(fileNode)); |
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'm not sure if staging each file individually is the way to do it or if there is a way to pass a directory path to Container.git.stageFile
.
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 think I would recommend adding a stageDirectory
method to GitService
, and it could call the same underlying Git.add
method since the fileName
parameter can really be a pathspec (and probably should be renamed)
See here: https://git-scm.com/docs/git-add#git-add-ltpathspecgt82308203
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.
And similar should be true for unstaging -- Git.reset
can take a set of paths (although not a pathspec)
See here: https://git-scm.com/docs/git-reset#git-reset-emgitresetem-qlttree-ishgt--ltpathsgt82308203
@UziTech Thanks for the PR! Looks like you are on the right track and should hopefully be straight forward to finish it up. Let me know if you have any other questions. (And sorry for the delay in responding) |
I think this should work. I'm not sure how to test it. Is there a way to install local extensions in vscode? |
You can build/package everything by running But you should be able to test it much easier than all that. You can run |
For some reason I keep getting an error when running
even though I tried it in the master branch and get the same error |
@UziTech Ugh sorry about that. Because of issues with the Just rebase your changes onto the |
Please also change the base of your PR from |
@UziTech FYI, I added a CONTRIBUTING.md file that may help as well. |
d32091d
to
25f74c4
Compare
@UziTech, you are doing God's work here. I wanted this feature since eons. Hopefully, it will be merged :) |
25f74c4
to
e6146c2
Compare
@UziTech This has been released as part of GitLens 9.3 -- thanks for your contribution! FYI, I made some minor changes, to restrict the commands to only show up for working tree folders and also added the commands to the inline toolbar |
Add
stageDirectory
andunstageDirectory
commands to (un)stage entire folder in tree viewfixes #599