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

[Improvement] check if repository is shallow before other operations #2842

Closed
1 of 2 tasks
BinToss opened this issue Sep 3, 2021 · 6 comments
Closed
1 of 2 tasks

Comments

@BinToss
Copy link
Contributor

BinToss commented Sep 3, 2021

Requires:

If a repository is shallow, halting and throwing a detailed exception would clarify the reason for the NullReferenceException reported in #2734

Detailed Description

Context

Throwing an informative exception message is more useful than an unhandled NullReferenceException.

Possible Implementation

GitVersion should query git rev-parse --is-shallow-repository (or test for ".git/shallow" file with very old Git clients) and then throw an exception if the operation returns "true".

ref: https://stackoverflow.com/qestions/37531605/how-to-test-if-git-repository-is-shallow

@asbjornu
Copy link
Member

asbjornu commented Sep 4, 2021

Great idea! If LibGit2Sharp exposes this information directly, that would be the best solution as we would like to avoid relying on the git command line or the existence of files or directories on disk.

@BinToss
Copy link
Contributor Author

BinToss commented Sep 6, 2021

libgit2/libgit2#3058
Looks like LibGit2Sharp's underlying library is unable to parse shallow repositories at all. So, LibGit2 would need to support shallow repositories before it can parse whether a repository is shallow or not.

@asbjornu
Copy link
Member

asbjornu commented Sep 6, 2021

However unfortunate, that does not come as a surprise. 😕

@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 2, 2022
@stale stale bot closed this as completed Apr 16, 2022
@BinToss
Copy link
Contributor Author

BinToss commented May 29, 2023

As of May 9, 2023, LibGit2 supports shallow repositories. However, LibGit2Sharp is still blocking.

@BinToss
Copy link
Contributor Author

BinToss commented May 29, 2023

btw this issue was automatically closed due to inactivity despite not having been resolved.

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

No branches or pull requests

2 participants