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

No pathspec error when using unstage all #11801

Closed
Hanksha opened this issue Oct 26, 2022 · 7 comments · Fixed by #11805 or #11806
Closed

No pathspec error when using unstage all #11801

Hanksha opened this issue Oct 26, 2022 · 7 comments · Fixed by #11805 or #11806
Labels
git issues related to git

Comments

@Hanksha
Copy link
Contributor

Hanksha commented Oct 26, 2022

Bug Description:

Whenever I use "Unstage All" in the Source Control view, via button (-) or the tab bar dropdown menu, I get this error: "fatal: No pathspec was given. Which files should I remove?"

bug

Steps to Reproduce:

  1. Create a directory
  2. Run git init in that directory
  3. Create a sample test.txt file
  4. Open Theia with that directory as workspace
  5. Go to Source Control view
  6. Use the Unstage All via the button or tab bar dropdown menu

Note that it works fine to unstage a selected file or multiple selected files, it just does that with the unstage all command.

Additional Information

  • Operating System: macOS and Windows
  • Theia Version: 1.30
@vince-fugnitto
Copy link
Member

@Hanksha I believe the same scenario will produce errors in vscode as well:

image

@Hanksha
Copy link
Contributor Author

Hanksha commented Oct 26, 2022

@vince-fugnitto Works fine in vscode for me:
bug

Also there's already a master branch.

@vince-fugnitto
Copy link
Member

@Hanksha would you like to contribute a fix?
I believe adding { reset: 'index' } works:

await this.git.unstage(repository, uris);

async unstageAll(): Promise<void> {
    try {
        const { repository, stagedChanges } = this;
        const uris = stagedChanges.map(c => c.uri);
-        await this.git.unstage(repository, uris);
+        await this.git.unstage(repository, uris, { reset: 'index' });
    } catch (error) {
        this.gitErrorHandler.handleError(error);
    }
}

@Hanksha
Copy link
Contributor Author

Hanksha commented Oct 26, 2022

@vince-fugnitto Sure I will

@vince-fugnitto vince-fugnitto added the git issues related to git label Oct 26, 2022
@Hanksha
Copy link
Contributor Author

Hanksha commented Oct 27, 2022

@vince-fugnitto I just saw you did a PR, I was about to create mine. I added a unit test for it as well, do you want me to send it to you so you can add it to your PR?

@vince-fugnitto
Copy link
Member

@vince-fugnitto I just saw you did a PR, I was about to create mine. I added a unit test for it as well, do you want me to send it to you so you can add it to your PR?

@Hanksha sorry I just didn't know when you'd be done and I wanted to get it in for the release, you can open yours and I'll review :)

@Hanksha
Copy link
Contributor Author

Hanksha commented Oct 27, 2022

@vince-fugnitto Alright, on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git issues related to git
Projects
None yet
2 participants