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

Use machine output for listing partially staged files #876

merged 2 commits into from May 29, 2020


Copy link

@johnnywalker johnnywalker commented May 29, 2020

When a partially staged file name contains one or more spaces or special characters, git status --porcelain escapes and quotes the file name (see Consequently, gitWorkflow.hideUnstagedChanges() fails with a pathspec error since execa expects arguments to not be escaped or quoted:

[SUCCESS] Preparing...
[STARTED] Hiding unstaged changes to partially staged files...
[FAILED] error: pathspec '"src/file with spaces.ts"' did not match any file(s) known to git

  ✖ lint-staged failed due to a git error.
  Any lost modifications can be restored from a git stash:

    > git stash list
    stash@{0}: automatic lint-staged backup
    > git stash apply --index stash@{0}

This PR resolves the problem by using the machine output from git-status instead. Note: the order of renamed files in the status output is reversed and separated by a NUL character (instead of ->) when machine output (-z option) is specified.

Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #876 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #876   +/-   ##
  Coverage   100.00%   100.00%           
  Files           17        17           
  Lines          597       597           
  Branches       142       142           
  Hits           597       597           
Impacted Files Coverage Δ
lib/gitWorkflow.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 979da5d...390d168. Read the comment docs.

iiroj approved these changes May 29, 2020
Copy link

@iiroj iiroj left a comment

Can't say anything else other than great work, and thanks for the PR!

@iiroj iiroj merged commit 21a2b41 into okonet:master May 29, 2020
3 checks passed
Copy link

github-actions bot commented May 29, 2020

🎉 This PR is included in version 10.2.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor Author

johnnywalker commented Jun 1, 2020

@iiroj Appreciate the note and thanks for merging!

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

Successfully merging this pull request may close these issues.

None yet

2 participants