libgit2 / libgit2/libgit2sharp

Not seeing any branches, can't create branch

Ouverte
#1,658 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C#
Étoiles
3.5k
Forks
925
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I am running into the following error when i try to create a branch...

LibGit2Sharp.NotFoundException: revspec 'master' not found
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_annotated_commit_from_revspec(RepositoryHandle repo, String revspec)
   at LibGit2Sharp.Core.Proxy.git_branch_create_from_annotated(RepositoryHandle repo, String branch_name, String targetIdentifier, Boolean force)
   at LibGit2Sharp.BranchCollection.Add(String name, String committish, Boolean allowOverwrite)
   at LibGit2Sharp.BranchCollection.Add(String name, String committish)
   at LibGit2Sharp.RepositoryExtensions.CreateBranch(IRepository repository, String branchName)
   at EncompassSettingsExport.GitWriter..ctor(String PathToRepo, Signature Signature, CredentialsHandler credentialsHandler, String Branch, String SupplimentalPath, ILogger logger, Boolean purgeDirectory) in C:\Users\barnao\Downloads\EncompassSettingsExport2\EncompassSettingsExport\EncompassSettingsExport\GitWriter.cs:line 52
   at EncompassSettingsExport.Program.<Run>d__1.MoveNext() in C:\Users\barnao\Downloads\EncompassSettingsExport2\EncompassSettingsExport\EncompassSettingsExport\Program.cs:line 71
Finished! Press any key to exit...

The line of code that produces this error is

brnch = repo.CreateBranch(Branch)

Where Branch is just a string like "test-brnch" and repo is a Repository object i've already created.

I am checking to make sure i can see my repo here (it is a private non-local repo)

Repository.IsValid(PathToRepo)

and this returns true.

I create my repo here...

repo = new Repository(PathToRepo);

However i've noticed that when i call

repo.Branches.Count();

This return 0 even though i do have a few branches in my repo

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par EncompassSettingsExport.GitWriter.cs ligne 52 et Program.cs ligne 71, puis examinez la configuration de Repository et le résultat de repo.Branches.Count(). Reproduisez la tentative de création d’une branche dans le dépôt privé décrit et vérifiez si les branches existantes sont énumérées et si CreateBranch réussit ; documentez l’échec ou la correction pertinente avec un test de régression si le projet en fournit un.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, git
Domaine
devtools
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.