libgit2 / libgit2/libgit2sharp

Setting tracking branch fails with "ref 'refs/remotes/origin/master' doesn't match the destination"

オープン
#1,782 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

Reproduction steps
  • a repo with multiple overlapping fetch specs:
[remote "origin"]
	url = ../multifetchspec_testrepo.git/
	fetch = +refs/pull/28/head:refs/remotes/origin/PR-28
	fetch = +refs/heads/master:refs/remotes/origin/master
	fetch = +refs/heads/*:refs/remotes/origin/*
  • repo doesn't have local master branch (but remote does)
  • call repo.Branches.Update("master", b => b.TrackedBranch = trackedBranch.CanonicalName); (with trackedBranch pointing to refs/remotes/origin/master).
Expected behavior

Tracking branch gets set.

Actual behavior

Exception:

LibGit2Sharp.LibGit2SharpException: ref 'refs/remotes/origin/master' doesn't match the destination

LibGit2Sharp.LibGit2SharpException
ref 'refs/remotes/origin/master' doesn't match the destination
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in D:\Develop\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in D:\Develop\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_refspec_rtransform(IntPtr refSpecPtr, String name) in D:\Develop\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 2085
   at LibGit2Sharp.Remote.FetchSpecTransformToSource(String reference) in D:\Develop\libgit2sharp\LibGit2Sharp\Remote.cs:line 138
   at LibGit2Sharp.BranchUpdater.GetUpstreamInformation(String canonicalName, String& remoteName, String& mergeBranchName) in D:\Develop\libgit2sharp\LibGit2Sharp\BranchUpdater.cs:line 188
   at LibGit2Sharp.BranchUpdater.SetUpstream(String upstreamBranchName) in D:\Develop\libgit2sharp\LibGit2Sharp\BranchUpdater.cs:line 116
   at LibGit2Sharp.BranchUpdater.set_TrackedBranch(String value) in D:\Develop\libgit2sharp\LibGit2Sharp\BranchUpdater.cs:line 53
   at LibGit2Sharp.Tests.BranchFixture.<>c__DisplayClass43_0.<CanSetTrackedBranch_MultipleFetchSpecs>b__0(BranchUpdater b) in D:\Develop\libgit2sharp\LibGit2Sharp.Tests\BranchFixture.cs:line 898
   at LibGit2Sharp.BranchCollection.Update(Branch branch, Action`1[] actions) in D:\Develop\libgit2sharp\LibGit2Sharp\BranchCollection.cs:line 292
Version of LibGit2Sharp (release number or SHA1)

4de700fedf87a5c9de10b921a636cc2f21d8964d

Operating system(s) tested; .NET runtime tested

Windows 10, Ubuntu 18.04

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

LibGit2Sharp.Tests/BranchFixture.cs にある失敗しているテスト CanSetTrackedBranch_MultipleFetchSpecs から始めます。再現で使用されている重複する fetch 仕様を使って、BranchUpdater.GetUpstreamInformation と Remote.FetchSpecTransformToSource を追跡します。追跡対象のブランチの設定が成功し、指定されたシナリオでリグレッションテストがパスすれば、問題は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。