Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit c50cb5d

Browse files
committed
Use correct branch name in config.
When storing the related PR number in the branch config, use the correct branch name - this ensures that they key will be deleted along with the branch. For some reason I thought this didn't work before, but it seems to now?!
1 parent 7f9b834 commit c50cb5d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public IObservable<Unit> SwitchToBranch(ILocalRepositoryModel repository, int nu
160160
async Task DoFetchAndCheckout(ILocalRepositoryModel repository, int pullRequestNumber, string localBranchName)
161161
{
162162
var repo = gitService.GetRepository(repository.LocalPath);
163-
var configKey = $"branch.{BranchNameToConfigKey(localBranchName)}.ghfvs-pr";
163+
var configKey = $"branch.{localBranchName}.ghfvs-pr";
164164
await gitClient.Fetch(repo, "origin", new[] { $"refs/pull/{pullRequestNumber}/head:{localBranchName}" });
165165
await gitClient.Checkout(repo, localBranchName);
166166
await gitClient.SetConfig(repo, configKey, pullRequestNumber.ToString());
@@ -172,7 +172,7 @@ IEnumerable<string> GetLocalBranchesInternal(IRepository repository, int number)
172172
return repository.Config
173173
.Select(x => new { Branch = BranchCapture.Match(x.Key).Groups["branch"].Value, Value = x.Value })
174174
.Where(x => !string.IsNullOrWhiteSpace(x.Branch) && x.Value == pr)
175-
.Select(x => ConfigKeyToBranchName(x.Branch));
175+
.Select(x => x.Branch);
176176
}
177177

178178
async Task<IPullRequestModel> PushAndCreatePR(IRepositoryHost host,
@@ -224,9 +224,5 @@ static string GetSafeBranchName(string name)
224224
before = after;
225225
}
226226
}
227-
228-
static string BranchNameToConfigKey(string name) => name.Replace("/", ".");
229-
230-
static string ConfigKeyToBranchName(string name) => name.Replace(".", "/");
231227
}
232228
}

0 commit comments

Comments
 (0)