Clone: surface the real clone failure instead of a misleading InvalidDataException#2070
Closed
ShiningMassXAcc wants to merge 1 commit into
Closed
Conversation
…DataException
When 'gvfs clone --branch <nonexistent>' failed, CloneVerb.Execute constructed a
LibGit2RepoInvoker against the enlistment's src folder unconditionally - even
after the clone had already failed. On a failed clone that src folder was never
created, so opening it logged a "Couldn't open repo at ...\src" warning and threw
an InvalidDataException. That exception escaped the tracer scope, bypassing the
else branch that prints the real error, and was caught by the generic handler
which printed the misleading "Cannot clone @ ...: InvalidDataException: Couldn't
open repo" message. The actionable error ("Remote branch ... not found in
upstream origin") was only written to the clone log.
Guard the LibGit2RepoInvoker construction behind cloneResult.Success so failed
clones fall through to the existing else branch that prints the real error. Add a
functional test asserting the branch-not-found error is shown and the misleading
messages are not.
Contributor
|
I suspect this is a duplicate of #2065 |
Member
Author
|
Confirmed duplicate of #2065 — thanks @tyrielv. #2065 targets the same root cause in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gvfs clone <url> <dst> --branch <nonexistent-branch>printed a misleadingdownstream exception instead of the real, actionable failure. The console showed:
…while the real error was only in the clone log, one line above an even-more-downstream warning:
Root cause
In
CloneVerb.Execute()theLibGit2RepoInvokerfor the enlistmentsrcfolderwas constructed unconditionally, even after
cloneResult.Success == false. On afailed clone the
srcworking directory was never created, soLibGit2Repo'sconstructor logged a
Couldn't open repo at ...\srcwarning and threw anInvalidDataException. That exception escaped theusing (tracer)scope, bypassingthe existing
elsebranch that printsError: <real message>, and was caught by thegeneric
catch (Exception)handler that printed the misleadingCannot clone @ ...: InvalidDataException: Couldn't open repomessage.Fix
Guard the
LibGit2RepoInvokerconstruction behindcloneResult.Success(andinitialize
trustPackIndexes = false, since it is only read on the success path).Failed clones now fall through to the existing
elsebranch, which already printsthe real error:
Tests
Added
CloneTests.CloneWithNonExistentBranchFailsWithBranchError, which clones with anon-existent
--branchand asserts:Remote branch ... not found in upstream origin,Couldn't open repo/InvalidDataException.Validation
dotnet build GVFS/GVFS/GVFS.csproj -c Debug— succeeded (0 errors).GVFS.FunctionalTestsC# compiles; the new test exercises the fixed path (requiresthe full functional-test harness to execute).
Tracked by ADO Task 63117974 (parent Deliverable 60994157 — "Git reliability for razzle").