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

Error when the path to file GitInfo.txt contains spaces #13

Closed
ghost opened this issue Sep 19, 2016 · 1 comment
Closed

Error when the path to file GitInfo.txt contains spaces #13

ghost opened this issue Sep 19, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 19, 2016

Missing quotes in GitInfo.targets line 370.
$(GitExe) rev-list --count "$(_GitLastBump)"..HEAD $([System.IO.Path]::GetDirectoryName("$(GitVersionFile)"))
should be
$(GitExe) rev-list --count "$(_GitLastBump)"..HEAD "$([System.IO.Path]::GetDirectoryName("$(GitVersionFile)"))"

Caused this error:
C:\Program Files (x86)\Jenkins\workspace\develop\packages\GitInfo.1.1.31\build\GitInfo.targets(370,3): warning MSB3073: The command ""C:\Program Files\Git\bin\git.exe" rev-list --count "65923a7"..HEAD C:\Program Files (x86)\Jenkins\workspace\develop" exited with code 128. [C:\Program Files (x86)\Jenkins\workspace\develop\project.csproj]
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "Exec" is set to "true".
C:\Program Files (x86)\Jenkins\workspace\develop\packages\GitInfo.1.1.31\build\GitInfo.targets(586,4): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::Add('$(GitBaseVersionPatch)', '$(GitCommits)')". Input string was not in a correct format. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)). [C:\Program Files (x86)\Jenkins\workspace\develop\project.csproj]

It worked after adding the quotes manually -.-

@kzu
Copy link
Member

kzu commented Oct 19, 2016

Care to send a PR so you get proper credit?

@kzu kzu closed this as completed in c69b7b0 Dec 26, 2016
kzu added a commit that referenced this issue Jan 6, 2017
Whenever the GitVersionFile is located at the GitRoot path, the
GetDirectoryName would return an empty string. Previously, that
would have caused the rev-list --count ... HEAD to receive an
empty trailing string, which would have been ignored by git.

As part of c69b7b0, a fix for
#13 when the directory was non-empty (that is, the version file
existed at a subfolder of GitRoot), the basic scenario above
broke, since we'd now be passing "" (two quotes and an empty
string inside), causing the rev-list command to fail and not
populate the GitCommits value.
@devlooped devlooped locked and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant