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

Commit a627271

Browse files
authored
Merge branch 'master' into refactor/connections-master
2 parents 17c845e + a62b02c commit a627271

File tree

7 files changed

+91
-11
lines changed

7 files changed

+91
-11
lines changed

src/GitHub.App/Services/GitClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ public Task<bool> IsModified(IRepository repository, string path, byte[] content
405405
{
406406
if (repository.RetrieveStatus(path) == FileStatus.Unaltered)
407407
{
408-
var head = repository.Head[path];
409-
if (head.TargetType != TreeEntryTargetType.Blob)
408+
var treeEntry = repository.Head[path];
409+
if (treeEntry?.TargetType != TreeEntryTargetType.Blob)
410410
{
411411
return false;
412412
}
413413

414-
var blob1 = (Blob)head.Target;
414+
var blob1 = (Blob)treeEntry.Target;
415415
using (var s = contents != null ? new MemoryStream(contents) : new MemoryStream())
416416
{
417417
var blob2 = repository.ObjectDatabase.CreateBlob(s, path);

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<NuGetPackageImportStamp>
1212
</NuGetPackageImportStamp>
1313
<TargetFrameworkProfile />
14-
<ApplicationVersion>2.3.4.52</ApplicationVersion>
14+
<ApplicationVersion>2.3.4.54</ApplicationVersion>
1515
<OutputPath>..\..\build\$(Configuration)\</OutputPath>
1616
<VsixType>v3</VsixType>
1717
<IsProductComponent>false</IsProductComponent>

src/GitHub.VisualStudio/UI/Views/Controls/RepositoryCloneControl.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ public RepositoryGroupDescription(RepositoryCloneControl owner)
8888

8989
public override object GroupNameFromItem(object item, int level, System.Globalization.CultureInfo culture)
9090
{
91-
Guard.ArgumentNotNull(culture, nameof(culture));
92-
9391
var repo = item as IRemoteRepositoryModel;
9492
var name = repo?.Owner ?? string.Empty;
9593
RepositoryGroup group;

src/GitHub.VisualStudio/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="2.3.4.52" Language="en-US" Publisher="GitHub, Inc" />
4+
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="2.3.4.54" Language="en-US" Publisher="GitHub, Inc" />
55
<DisplayName>GitHub Extension for Visual Studio</DisplayName>
66
<Description xml:space="preserve">A Visual Studio Extension that brings the GitHub Flow into Visual Studio.</Description>
77
<PackageId>GitHub.VisualStudio</PackageId>

src/MsiInstaller/Version.wxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Include>
3-
<?define VersionNumber="2.3.4.52" ?>
3+
<?define VersionNumber="2.3.4.54" ?>
44
</Include>

src/UnitTests/GitHub.App/Services/GitClientTests.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,88 @@
1111

1212
public class GitClientTests
1313
{
14+
public class TheIsModifiedMethod
15+
{
16+
[Theory]
17+
[InlineData(FileStatus.Unaltered, false)]
18+
[InlineData(FileStatus.ModifiedInIndex, true)]
19+
[InlineData(FileStatus.ModifiedInWorkdir, true)]
20+
public async Task RetrieveStatus(FileStatus fileStatus, bool expect)
21+
{
22+
var path = "path";
23+
var repo = Substitute.For<IRepository>();
24+
repo.RetrieveStatus(path).Returns(fileStatus);
25+
repo.Head.Returns(Substitute.For<Branch>());
26+
var treeEntry = null as TreeEntry;
27+
repo.Head[path].Returns(treeEntry);
28+
var gitClient = new GitClient(Substitute.For<IGitHubCredentialProvider>());
29+
30+
var modified = await gitClient.IsModified(repo, path, null);
31+
32+
Assert.Equal(expect, modified);
33+
}
34+
35+
[Fact]
36+
public async Task TreeEntry_Null_False()
37+
{
38+
var path = "path";
39+
var repo = Substitute.For<IRepository>();
40+
repo.RetrieveStatus(path).Returns(FileStatus.Unaltered);
41+
repo.Head.Returns(Substitute.For<Branch>());
42+
var treeEntry = null as TreeEntry;
43+
repo.Head[path].Returns(treeEntry);
44+
var gitClient = new GitClient(Substitute.For<IGitHubCredentialProvider>());
45+
46+
var modified = await gitClient.IsModified(repo, path, null);
47+
48+
Assert.False(modified);
49+
}
50+
51+
[Fact]
52+
public async Task TreeEntryTarget_GitLink_False()
53+
{
54+
var path = "path";
55+
var repo = Substitute.For<IRepository>();
56+
repo.RetrieveStatus(path).Returns(FileStatus.Unaltered);
57+
repo.Head.Returns(Substitute.For<Branch>());
58+
var treeEntry = Substitute.For<TreeEntry>();
59+
treeEntry.TargetType.Returns(TreeEntryTargetType.GitLink);
60+
treeEntry.Target.Returns(Substitute.For<GitLink>());
61+
repo.Head[path].Returns(treeEntry);
62+
var gitClient = new GitClient(Substitute.For<IGitHubCredentialProvider>());
63+
64+
var modified = await gitClient.IsModified(repo, path, null);
65+
66+
Assert.False(modified);
67+
}
68+
69+
[Theory]
70+
[InlineData(0, 0, false)]
71+
[InlineData(1, 0, true)]
72+
[InlineData(0, 1, true)]
73+
[InlineData(1, 1, true)]
74+
public async Task ContentChanges(int linesAdded, int linesDeleted, bool expected)
75+
{
76+
var path = "path";
77+
var repo = Substitute.For<IRepository>();
78+
repo.RetrieveStatus(path).Returns(FileStatus.Unaltered);
79+
repo.Head.Returns(Substitute.For<Branch>());
80+
var treeEntry = Substitute.For<TreeEntry>();
81+
treeEntry.TargetType.Returns(TreeEntryTargetType.Blob);
82+
treeEntry.Target.Returns(Substitute.For<Blob>());
83+
repo.Head[path].Returns(treeEntry);
84+
var changes = Substitute.For<ContentChanges>();
85+
changes.LinesAdded.Returns(linesAdded);
86+
changes.LinesDeleted.Returns(linesDeleted);
87+
repo.Diff.Compare(null, null).ReturnsForAnyArgs(changes);
88+
var gitClient = new GitClient(Substitute.For<IGitHubCredentialProvider>());
89+
90+
var modified = await gitClient.IsModified(repo, path, null);
91+
92+
Assert.Equal(expected, modified);
93+
}
94+
}
95+
1496
public class TheIsHeadPushedMethod : TestBaseClass
1597
{
1698
[Theory]

src/common/SolutionInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using System.Runtime.InteropServices;
44

55
[assembly: AssemblyProduct("GitHub Extension for Visual Studio")]
6-
[assembly: AssemblyVersion("2.3.4.52")]
7-
[assembly: AssemblyFileVersion("2.3.4.52")]
6+
[assembly: AssemblyVersion("2.3.4.54")]
7+
[assembly: AssemblyFileVersion("2.3.4.54")]
88
[assembly: ComVisible(false)]
99
[assembly: AssemblyCompany("GitHub, Inc.")]
1010
[assembly: AssemblyCopyright("Copyright © GitHub, Inc. 2014-2016")]
@@ -16,6 +16,6 @@
1616
namespace System
1717
{
1818
internal static class AssemblyVersionInformation {
19-
internal const string Version = "2.3.4.52";
19+
internal const string Version = "2.3.4.54";
2020
}
2121
}

0 commit comments

Comments
 (0)