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

Commit 67da4b6

Browse files
Merge branch 'release/3.1.0'
2 parents 0b32d3b + d1f2ecf commit 67da4b6

File tree

12 files changed

+289
-146
lines changed

12 files changed

+289
-146
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Andrew Arnott <[email protected]>
1414
Geert van Horrik <[email protected]>
1515
Wesley Eledui <[email protected]>
1616
Marek Fišera <[email protected]>
17+
Shai Nahum <[email protected]>

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ GitLink
1212

1313
![GitLink](design/logo/logo_64.png)
1414

15-
GitLink let's users step through your code hosted on GitHub! **Help make .NET open source projects more accessible by enabling this for your .NET projects, it's just a single additional step in your build**. See the list of [projects using GitLink](#projects-using-gitlink).
15+
GitLink lets users step through your code hosted on GitHub! **Help make .NET open source projects more accessible by enabling this for your .NET projects, it's just a single additional step in your build**. See the list of [projects using GitLink](#projects-using-gitlink).
1616

1717
<a href="https://pledgie.com/campaigns/26957"><img alt="Click here to lend your support to: GitLink and make a donation at pledgie.com !" src="https://pledgie.com/campaigns/26957.png?skin_name=chrome" border="0" /></a>
1818

@@ -78,6 +78,14 @@ There are many more parameters you can use. Display the usage doc with the follo
7878

7979
GitLink.exe -h
8080

81+
### Native PDBs
82+
83+
Native PDBs (from C++ projects) are supported by using -a option:
84+
85+
GitLink.exe <nativePdbfile> -a
86+
87+
All known C++ source files from your git depot will be indexed in the PDB.
88+
8189
# How does it work
8290

8391
The SrcSrv tool (Srcsrv.dll) enables a client to retrieve the exact version of the source files that were used to build an application. Because the source code for a module can change between versions and over the course of years, it is important to look at the source code as it existed when the version of the module in question was built.
@@ -145,6 +153,7 @@ It is also possible to specify a custom url provider.
145153

146154
Below is a list of projects already using GitLink (alphabetically ordered).
147155

156+
- <a href="https://aspnetboilerplate.com" target="_blank">ASP.NET Boilerplate</a>
148157
- <a href="http://www.catelproject.com" target="_blank">Catel</a>
149158
- <a href="http://www.expandframework.com/" target="_blank">eXpand</a>
150159
- <a href="https://fakeiteasy.github.io/" target="_blank">FakeItEasy</a>

src/GitLink.Tests/Providers/VisualStudioTeamServicesProviderFacts.cs

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void ReturnsValidInitialization()
1919
{
2020
var provider = new VisualStudioTeamServicesProvider();
2121
var valid = provider.Initialize("https://my-account.visualstudio.com/_git/main-repo");
22-
22+
2323
Assert.IsTrue(valid);
2424
}
2525

@@ -35,60 +35,47 @@ public void ReturnsInValidInitialization()
3535
[TestFixture]
3636
public class TheVisualStudioTeamServicesProviderProperties
3737
{
38-
[TestCase]
39-
public void ReturnsValidCompany()
40-
{
41-
var provider = new VisualStudioTeamServicesProvider();
42-
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");
43-
44-
Assert.AreEqual("CatenaLogic", provider.CompanyName);
45-
}
46-
47-
[TestCase]
48-
public void ReturnsValidCompanyUrl()
38+
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "main-repo")]
39+
[TestCase("https://CatenaLogic.visualstudio.com/BigProject/_git/main-repo", "BigProject")]
40+
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/BigProject/_git/main-repo", "BigProject")]
41+
public void ReturnsValidProject(string url, string expectedProjectName)
4942
{
5043
var provider = new VisualStudioTeamServicesProvider();
51-
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");
44+
provider.Initialize(url);
5245

53-
Assert.AreEqual("https://CatenaLogic.visualstudio.com/", provider.CompanyUrl);
46+
Assert.AreEqual(expectedProjectName, provider.ProjectName);
5447
}
5548

56-
[TestCase]
57-
public void ReturnsValidProject()
49+
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "CatenaLogic")]
50+
public void ReturnsValidCompany(string url, string expectedCompanyName)
5851
{
5952
var provider = new VisualStudioTeamServicesProvider();
60-
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");
53+
provider.Initialize(url);
6154

62-
Assert.AreEqual("main-repo", provider.ProjectName);
55+
Assert.AreEqual(expectedCompanyName, provider.CompanyName);
6356
}
6457

65-
[TestCase]
66-
public void ReturnsValidProject2()
58+
[TestCase("https://CatenaLogic.visualstudio.com/Project/_git/main-repo", "main-repo")]
59+
[TestCase("https://CatenaLogic.visualstudio.com/Project/_git/main.repo", "main.repo")]
60+
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/Project/_git/main.repo", "main.repo")]
61+
public void ReturnsValidRepositoryName(string url, string expectedProjectUrl)
6762
{
6863
var provider = new VisualStudioTeamServicesProvider();
69-
provider.Initialize("https://CatenaLogic.visualstudio.com/BigProject/_git/main-repo");
64+
provider.Initialize(url);
7065

71-
Assert.AreEqual("BigProject", provider.ProjectName);
66+
Assert.AreEqual(expectedProjectUrl, provider.ProjectUrl);
7267
}
7368

74-
[TestCase]
75-
public void ReturnsValidRepositoryName()
69+
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "https://CatenaLogic.visualstudio.com/")]
70+
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/BigProject/_git/main-repo", "https://CatenaLogic.visualstudio.com/DefaultCollection/")]
71+
[TestCase("https://CatenaLogic.visualstudio.com/Other.Collection/BigProject/_git/main-repo", "https://CatenaLogic.visualstudio.com/Other.Collection/")]
72+
public void ReturnsValidCompanyUrl(string url, string expectedCompanyUrl)
7673
{
7774
var provider = new VisualStudioTeamServicesProvider();
78-
provider.Initialize("https://CatenaLogic.visualstudio.com/Project/_git/main-repo");
75+
provider.Initialize(url);
7976

80-
Assert.AreEqual("main-repo", provider.ProjectUrl);
77+
Assert.AreEqual(expectedCompanyUrl, provider.CompanyUrl);
8178
}
82-
83-
[TestCase]
84-
public void ReturnsValidRepositoryNameWhenContainsPeriod()
85-
{
86-
var provider = new VisualStudioTeamServicesProvider();
87-
provider.Initialize("https://CatenaLogic.visualstudio.com/Big.Project/_git/main.repo");
88-
89-
Assert.AreEqual("main.repo", provider.ProjectUrl);
90-
}
91-
9279
}
9380
}
9481
}

src/GitLink.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/TagAlwaysOnNewLine/@EntryValue">False</s:Boolean>
2929
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
3030
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WrapLongLines/@EntryValue">False</s:Boolean>
31+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WRAP_LINES/@EntryValue">False</s:Boolean>
3132

3233
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/MaxSingleLineTagLength/@EntryValue">20</s:Int64>
3334
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
3435
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapLongLines/@EntryValue">False</s:Boolean>
3536
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/MaxBlankLines/@EntryValue">1</s:Int64>
3637
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/ProcessingInstructionAttributesFormat/@EntryValue">OnSingleLine</s:String>
3738
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/TagAttributesFormat/@EntryValue">FirstAttributeOnSingleLine</s:String>
39+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WRAP_LINES/@EntryValue">False</s:Boolean>
3840
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&#xD;
3941
&lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt;&#xD;
4042
&lt;TypePattern Priority="100" DisplayName="Type Pattern"&gt;&#xD;
@@ -416,6 +418,7 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
416418
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
417419
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
418420
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
421+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
419422
<s:String x:Key="/Default/Environment/UserInterface/ShortcutSchemeName/@EntryValue">None</s:String>
420423
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
421424
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

src/GitLink/GitLink.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<Compile Include="Pdb\PdbStream.cs" />
7676
<Compile Include="Pdb\SrcSrv.cs" />
7777
<Compile Include="Pdb\SrcSrvContext.cs" />
78+
<Compile Include="Helpers\PortablePdbHelper.cs" />
7879
<Compile Include="Program.cs" />
7980
<Compile Include="Properties\AssemblyInfo.cs" />
8081
<Compile Include="Providers\BitBucketProvider.cs" />
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright file="PortablePdbHelper.cs" company="CatenaLogic">
3+
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
4+
// </copyright>
5+
// --------------------------------------------------------------------------------------------------------------------
6+
7+
namespace GitLink
8+
{
9+
using System.IO;
10+
11+
internal static class PortablePdbHelper
12+
{
13+
/// <summary>
14+
/// Is the given .pdb using the new Portable format ? (https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md)
15+
/// </summary>
16+
/// <param name="pdbPath">.pdb file path</param>
17+
/// <returns>Returns if it's a Portable PDB</returns>
18+
public static bool IsPortablePdb(string pdbPath)
19+
{
20+
using (var fs = File.Open(pdbPath, FileMode.Open, FileAccess.Read))
21+
using (var br = new BinaryReader(fs))
22+
{
23+
// More infos in chapter II.24.2 of ECMA-335 (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf)
24+
var signature = 0x424A5342;
25+
if (br.ReadUInt32() != signature)
26+
{
27+
return false;
28+
}
29+
30+
var majorVersion = br.ReadUInt16();
31+
if (majorVersion != 1)
32+
{
33+
return false;
34+
}
35+
36+
var minorVersion = br.ReadUInt16();
37+
if (minorVersion != 1)
38+
{
39+
return false;
40+
}
41+
42+
var reserved = br.ReadUInt32();
43+
if (reserved != 0)
44+
{
45+
return false;
46+
}
47+
48+
var versionLength = br.ReadUInt32();
49+
var version = System.Text.Encoding.UTF8.GetString(br.ReadBytes((int)versionLength));
50+
51+
return version.StartsWith("PDB v1.0");
52+
}
53+
}
54+
}
55+
}

src/GitLink/LinkOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ public struct LinkOptions
2323
public string CommitId { get; set; }
2424

2525
public string GitWorkingDirectory { get; set; }
26+
27+
public bool IndexAllDepotFiles { get; set; }
2628
}
2729
}

0 commit comments

Comments
 (0)