Skip to content

Commit f0fb376

Browse files
committed
renames Refs to References
Replaces `Refs` with `References` across the codebase for better clarity and consistency. Updates all method calls, variable names, and interfaces to reflect this change.
1 parent 7f3728a commit f0fb376

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

src/GitVersion.Core.Tests/Core/RepositoryExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private static IRemote MockRemote(IGitRepository repository)
4343
references["develop"].Returns(reference);
4444
references.MockCollectionReturn(reference);
4545

46-
repository.Refs.Returns(references);
46+
repository.References.Returns(references);
4747
repository.Head.Returns(branch);
4848
repository.Branches.Returns(branches);
4949
return remote;

src/GitVersion.Core/Core/GitPreparer.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ To disable this error set an environmental variable called IGNORE_NORMALISATION_
218218

219219
private void EnsureHeadIsAttachedToBranch(string? currentBranchName, AuthenticationInfo authentication)
220220
{
221-
var headSha = this.repository.Refs.Head?.TargetIdentifier;
221+
var headSha = this.repository.References.Head?.TargetIdentifier;
222222
if (!this.repository.IsHeadDetached)
223223
{
224224
this.log.Info($"HEAD points at branch '{headSha}'.");
225225
return;
226226
}
227227

228228
this.log.Info($"HEAD is detached and points at commit '{headSha}'.");
229-
var localRefs = this.repository.Refs.FromGlob("*").Select(r => $"{r.Name.Canonical} ({r.TargetIdentifier})");
229+
var localRefs = this.repository.References.FromGlob("*").Select(r => $"{r.Name.Canonical} ({r.TargetIdentifier})");
230230
this.log.Info($"Local Refs:{FileSystemHelper.Path.NewLine}" + string.Join(FileSystemHelper.Path.NewLine, localRefs));
231231

232232
// In order to decide whether a fake branch is required or not, first check to see if any local branches have the same commit SHA of the head SHA.
@@ -331,7 +331,7 @@ private void CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(string remoteName
331331
var prefix = $"refs/remotes/{remoteName}/";
332332
var remoteHeadCanonicalName = $"{prefix}HEAD";
333333
var headReferenceName = ReferenceName.Parse(remoteHeadCanonicalName);
334-
var remoteTrackingReferences = this.repository.Refs
334+
var remoteTrackingReferences = this.repository.References
335335
.FromGlob(prefix + "*")
336336
.Where(r => !r.Name.Equals(headReferenceName));
337337

@@ -344,7 +344,7 @@ private void CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(string remoteName
344344
// We do not want to touch our current branch
345345
if (this.repository.Head.Name.EquivalentTo(branchName)) continue;
346346

347-
var localRef = this.repository.Refs[localReferenceName];
347+
var localRef = this.repository.References[localReferenceName];
348348
if (localRef != null)
349349
{
350350
if (localRef.TargetIdentifier == remoteTrackingReference.TargetIdentifier)
@@ -356,13 +356,13 @@ private void CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(string remoteName
356356
if (remoteRefTipId != null)
357357
{
358358
this.log.Info($"Updating local ref '{localRef.Name.Canonical}' to point at {remoteRefTipId}.");
359-
this.retryAction.Execute(() => this.repository.Refs.UpdateTarget(localRef, remoteRefTipId));
359+
this.retryAction.Execute(() => this.repository.References.UpdateTarget(localRef, remoteRefTipId));
360360
}
361361
continue;
362362
}
363363

364364
this.log.Info($"Creating local branch from remote tracking '{remoteTrackingReference.Name.Canonical}'.");
365-
this.repository.Refs.Add(localReferenceName.Canonical, remoteTrackingReference.TargetIdentifier, true);
365+
this.repository.References.Add(localReferenceName.Canonical, remoteTrackingReference.TargetIdentifier, true);
366366

367367
var branch = this.repository.Branches[branchName];
368368
if (branch != null)
@@ -406,17 +406,17 @@ public void EnsureLocalBranchExistsForCurrentBranch(IRemote remote, string? curr
406406
this.log.Info(isLocalBranch
407407
? $"Creating local branch {referenceName}"
408408
: $"Creating local branch {referenceName} pointing at {repoTipId}");
409-
this.repository.Refs.Add(localCanonicalName, repoTipId.Sha);
409+
this.repository.References.Add(localCanonicalName, repoTipId.Sha);
410410
}
411411
else
412412
{
413413
this.log.Info(isLocalBranch
414414
? $"Updating local branch {referenceName} to point at {repoTipId}"
415415
: $"Updating local branch {referenceName} to match ref {currentBranch}");
416-
var localRef = this.repository.Refs[localCanonicalName];
416+
var localRef = this.repository.References[localCanonicalName];
417417
if (localRef != null)
418418
{
419-
this.retryAction.Execute(() => this.repository.Refs.UpdateTarget(localRef, repoTipId));
419+
this.retryAction.Execute(() => this.repository.References.UpdateTarget(localRef, repoTipId));
420420
}
421421
}
422422
}

src/GitVersion.Core/Core/RepositoryStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public IEnumerable<IBranch> GetSourceBranches(
111111
{
112112
var returnedBranches = new HashSet<IBranch>();
113113

114-
var referenceLookup = this.repository.Refs.ToLookup(r => r.TargetIdentifier);
114+
var referenceLookup = this.repository.References.ToLookup(r => r.TargetIdentifier);
115115

116116
var commitBranches = FindCommitBranchesBranchedFrom(branch, configuration, excludedBranches).ToHashSet();
117117

src/GitVersion.Core/Git/IGitRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IGitRepository : IDisposable
1010
IBranch Head { get; }
1111

1212
ITagCollection Tags { get; }
13-
IReferenceCollection Refs { get; }
13+
IReferenceCollection References { get; }
1414
IBranchCollection Branches { get; }
1515
ICommitCollection Commits { get; }
1616
IRemoteCollection Remotes { get; }

src/GitVersion.Core/PublicAPI.Shipped.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ GitVersion.Git.IGitRepository.Head.get -> GitVersion.Git.IBranch!
235235
GitVersion.Git.IGitRepository.IsHeadDetached.get -> bool
236236
GitVersion.Git.IGitRepository.IsShallow.get -> bool
237237
GitVersion.Git.IGitRepository.Path.get -> string!
238-
GitVersion.Git.IGitRepository.Refs.get -> GitVersion.Git.IReferenceCollection!
239238
GitVersion.Git.IGitRepository.Remotes.get -> GitVersion.Git.IRemoteCollection!
240239
GitVersion.Git.IGitRepository.Tags.get -> GitVersion.Git.ITagCollection!
241240
GitVersion.Git.IGitRepository.UncommittedChangesCount() -> int

src/GitVersion.Core/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
GitVersion.Common.IRepositoryStore.GetCommitsReacheableFrom(GitVersion.Git.ICommit! commit, GitVersion.Git.IBranch! branch) -> System.Collections.Generic.IReadOnlyList<GitVersion.Git.ICommit!>!
33
GitVersion.Git.ICommit.Id.get -> GitVersion.Git.IObjectId!
44
GitVersion.Git.ICommit.Sha.get -> string!
5+
GitVersion.Git.IGitRepository.References.get -> GitVersion.Git.IReferenceCollection!

src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ private IRepository RepositoryInstance
2424
public IBranch Head => this.repositoryCache.GetOrWrap(RepositoryInstance.Head, RepositoryInstance.Diff);
2525

2626
public ITagCollection Tags => new TagCollection(RepositoryInstance.Tags, RepositoryInstance.Diff, this.repositoryCache);
27-
public IReferenceCollection Refs => new ReferenceCollection(RepositoryInstance.Refs, this.repositoryCache);
2827
public IBranchCollection Branches => new BranchCollection(RepositoryInstance.Branches, RepositoryInstance.Diff, this.repositoryCache);
2928
public ICommitCollection Commits => new CommitCollection(RepositoryInstance.Commits, RepositoryInstance.Diff, this.repositoryCache);
3029
public IRemoteCollection Remotes => new RemoteCollection(RepositoryInstance.Network.Remotes, this.repositoryCache);
30+
public IReferenceCollection References => new ReferenceCollection(RepositoryInstance.Refs, this.repositoryCache);
3131

3232
public void DiscoverRepository(string? gitDirectory)
3333
{

src/GitVersion.LibGit2Sharp/Git/GitRepository.mutating.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void CreateBranchForPullRequestBranch(AuthenticationInfo auth) => Reposit
7373
var fakeBranchName = canonicalName.Replace("refs/pull/", "refs/heads/pull/").Replace("refs/pull-requests/", "refs/heads/pull-requests/");
7474

7575
this.log.Info($"Creating fake local branch '{fakeBranchName}'.");
76-
Refs.Add(fakeBranchName, headTipSha);
76+
References.Add(fakeBranchName, headTipSha);
7777

7878
this.log.Info($"Checking local branch '{fakeBranchName}' out.");
7979
Checkout(fakeBranchName);

0 commit comments

Comments
 (0)