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

Microsoft.Build.Tasks.Git: Allow overriding git repositoryformatversion check #769

Open
voltagex opened this issue Nov 14, 2021 · 3 comments

Comments

@voltagex
Copy link

Hi,
We just hit an issue over in pythonnet/pythonnet#1613 where a git repository is checked out as part of a build step, but due to interactions between build systems, the repositoryformatversion is set to 1, which then hits the following code in

// See https://github.com/git/git/blob/master/Documentation/technical/repository-version.txt
string? versionStr = config.GetVariableValue("core", "repositoryformatversion");
if (GitConfig.TryParseInt64Value(versionStr, out var version) && version > SupportedGitRepoFormatVersion)
{
throw new NotSupportedException(string.Format(Resources.UnsupportedRepositoryVersion, versionStr, SupportedGitRepoFormatVersion));
}

Which then causes the Python wheel build to fail:

 C:\Users\WDAGUtilityAccount\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Error reading git repository information: Unsupported repository version 1. Only versions up to 0 are supported. [C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime\Python.Runtime.csproj]
  C:\Users\WDAGUtilityAccount\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime'. [C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime\Python.Runtime.csproj]

  Build FAILED.

  C:\Users\WDAGUtilityAccount\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime'. [C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime\Python.Runtime.csproj]
  C:\Users\WDAGUtilityAccount\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Error reading git repository information: Unsupported repository version 1. Only versions up to 0 are supported. [C:\Users\WDAGUtilityAccount\AppData\Local\Temp\pip-req-build-4vyeo0ym\src\runtime\Python.Runtime.csproj]
      1 Warning(s)
      1 Error(s)

Would it be possible to allow overriding this check via a property or environment variable?

I'm not sure what the impact of removing this check completely would be.

@KalleOlaviNiemitalo
Copy link

If GitDataReader were changed to support repositoryformatversion 1, then it would have to check whether it supports each extension used in the repository:

  • noop: Consider supported.
  • preciousObjects: Consider supported because GitDataReader does not delete objects in any case.
  • partialclone: If some trees have been omitted from the clone, GetUntrackedFiles won't work as is. At minimum, I think it should detect that the problem is caused by the partialness of the clone, and say so in the error message. It would be better to download the missing trees on demand but I imagine that could be difficult to implement. Missing blobs might not be that much of a problem because the file names are in the tree objects, but they might still hinder .gitignore processing.
  • worktreeConfig: Would need some work, but less than partialclone.
  • refStorage: Not sure.
  • objectFormat, compatObjectFormat: More work than worktreeConfig, but perhaps less than partialclone.

@KalleOlaviNiemitalo
Copy link

Repository format version 1 with some extensions is being implemented in #772.

@qlikTERror
Copy link

I am using GitHub SourceLink integration, but when building in one of my git workspaces the build fail saying it does not support repositoryformatversion 1. Is this expected? I am using the latest version of the github sourcelink nuget package.

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

3 participants