Skip to content

read git data faild "empty string is not a valid pathspec" #345

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

Closed
yishuiliunian opened this issue Feb 4, 2018 · 4 comments
Closed

read git data faild "empty string is not a valid pathspec" #345

yishuiliunian opened this issue Feb 4, 2018 · 4 comments

Comments

@yishuiliunian
Copy link

读取Git数据失败git '--git-dir=/Users/dongzhao/Works/QCloud/Src/iOS/Git/QCloudiOSCodes/.git' '--work-tree=/Users/dongzhao/Works/QCloud/Src/iOS/Git/QCloudiOSCodes' ls-files '--stage' '' 2>&1:fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

@baranga
Copy link

baranga commented Feb 12, 2018

Same here. Looks like git returns a error for empty path spec since version 2.16. The behavior to treat empty path spec as . was already deprecated for some versions but now its gone.

@steventebrinke
Copy link

It looks like defaulting the location parameter of ls_files (lib.rb line 398) to '.' solves this bug for me, but I do not know whether that is a proper and/or complete fix.

@rafamanzo
Copy link
Contributor

This really was deprecated since git 2.1.6: https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.16.0.txt

An empty string as a pathspec element that means "everything"
i.e. 'git add ""', is now illegal.  We started this by first
deprecating and warning a pathspec that has such an element in
2.11 (Nov 2016).

Judging by this changelog entry, the ix here really is using ..

I've mapped possible code where this could break the code on lib.rb:

  • line 104. There is no fix necessary because there is a check for nil values
  • line 398. This is where our bug is needs a fix
  • line 409. There is no fix necessary because there is a check for nil values
  • line 488. There is no check for nil values. But performing the the following local test raises no errors Git.open('.').show. Thus no action is required for this case also.

Thus I'll open a PR fixing the case for line 398.

rafamanzo added a commit to rafamanzo/ruby-git that referenced this issue Feb 28, 2018
Since GIT version 2.16.0 empty pathspecs as alias to "everything" has
been made illegal.

A more detailed study this change's impact has been made at:

ruby-git#345 (comment)

Closes ruby-git#345
rafamanzo added a commit to rafamanzo/ruby-git that referenced this issue Mar 8, 2018
Since GIT version 2.16.0 empty pathspecs as alias to "everything" has
been made illegal.

A more detailed study this change's impact has been made at:

ruby-git#345 (comment)

Closes ruby-git#345
rvodden pushed a commit that referenced this issue Mar 28, 2018
Since GIT version 2.16.0 empty pathspecs as alias to "everything" has
been made illegal.

A more detailed study this change's impact has been made at:

#345 (comment)

Closes #345
@sbussetti
Copy link

Any eta on a new version released with this fix?

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

5 participants