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

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Sep 11, 2017
2 parents 0b32d3b + d1f2ecf commit 67da4b6
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 146 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Andrew Arnott <[email protected]>
Geert van Horrik <[email protected]>
Wesley Eledui <[email protected]>
Marek Fišera <[email protected]>
Shai Nahum <[email protected]>
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GitLink

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

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).
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).

<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>

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

GitLink.exe -h

### Native PDBs

Native PDBs (from C++ projects) are supported by using -a option:

GitLink.exe <nativePdbfile> -a

All known C++ source files from your git depot will be indexed in the PDB.

# How does it work

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.
Expand Down Expand Up @@ -145,6 +153,7 @@ It is also possible to specify a custom url provider.

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

- <a href="https://aspnetboilerplate.com" target="_blank">ASP.NET Boilerplate</a>
- <a href="http://www.catelproject.com" target="_blank">Catel</a>
- <a href="http://www.expandframework.com/" target="_blank">eXpand</a>
- <a href="https://fakeiteasy.github.io/" target="_blank">FakeItEasy</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void ReturnsValidInitialization()
{
var provider = new VisualStudioTeamServicesProvider();
var valid = provider.Initialize("https://my-account.visualstudio.com/_git/main-repo");

Assert.IsTrue(valid);
}

Expand All @@ -35,60 +35,47 @@ public void ReturnsInValidInitialization()
[TestFixture]
public class TheVisualStudioTeamServicesProviderProperties
{
[TestCase]
public void ReturnsValidCompany()
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");

Assert.AreEqual("CatenaLogic", provider.CompanyName);
}

[TestCase]
public void ReturnsValidCompanyUrl()
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "main-repo")]
[TestCase("https://CatenaLogic.visualstudio.com/BigProject/_git/main-repo", "BigProject")]
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/BigProject/_git/main-repo", "BigProject")]
public void ReturnsValidProject(string url, string expectedProjectName)
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");
provider.Initialize(url);

Assert.AreEqual("https://CatenaLogic.visualstudio.com/", provider.CompanyUrl);
Assert.AreEqual(expectedProjectName, provider.ProjectName);
}

[TestCase]
public void ReturnsValidProject()
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "CatenaLogic")]
public void ReturnsValidCompany(string url, string expectedCompanyName)
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/_git/main-repo");
provider.Initialize(url);

Assert.AreEqual("main-repo", provider.ProjectName);
Assert.AreEqual(expectedCompanyName, provider.CompanyName);
}

[TestCase]
public void ReturnsValidProject2()
[TestCase("https://CatenaLogic.visualstudio.com/Project/_git/main-repo", "main-repo")]
[TestCase("https://CatenaLogic.visualstudio.com/Project/_git/main.repo", "main.repo")]
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/Project/_git/main.repo", "main.repo")]
public void ReturnsValidRepositoryName(string url, string expectedProjectUrl)
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/BigProject/_git/main-repo");
provider.Initialize(url);

Assert.AreEqual("BigProject", provider.ProjectName);
Assert.AreEqual(expectedProjectUrl, provider.ProjectUrl);
}

[TestCase]
public void ReturnsValidRepositoryName()
[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "https://CatenaLogic.visualstudio.com/")]
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/BigProject/_git/main-repo", "https://CatenaLogic.visualstudio.com/DefaultCollection/")]
[TestCase("https://CatenaLogic.visualstudio.com/Other.Collection/BigProject/_git/main-repo", "https://CatenaLogic.visualstudio.com/Other.Collection/")]
public void ReturnsValidCompanyUrl(string url, string expectedCompanyUrl)
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/Project/_git/main-repo");
provider.Initialize(url);

Assert.AreEqual("main-repo", provider.ProjectUrl);
Assert.AreEqual(expectedCompanyUrl, provider.CompanyUrl);
}

[TestCase]
public void ReturnsValidRepositoryNameWhenContainsPeriod()
{
var provider = new VisualStudioTeamServicesProvider();
provider.Initialize("https://CatenaLogic.visualstudio.com/Big.Project/_git/main.repo");

Assert.AreEqual("main.repo", provider.ProjectUrl);
}

}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/GitLink.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/TagAlwaysOnNewLine/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WrapLongLines/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WRAP_LINES/@EntryValue">False</s:Boolean>

<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/MaxSingleLineTagLength/@EntryValue">20</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapLongLines/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/MaxBlankLines/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/ProcessingInstructionAttributesFormat/@EntryValue">OnSingleLine</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/TagAttributesFormat/@EntryValue">FirstAttributeOnSingleLine</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WRAP_LINES/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&#xD;
&lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt;&#xD;
&lt;TypePattern Priority="100" DisplayName="Type Pattern"&gt;&#xD;
Expand Down Expand Up @@ -416,6 +418,7 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UserInterface/ShortcutSchemeName/@EntryValue">None</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>
1 change: 1 addition & 0 deletions src/GitLink/GitLink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<Compile Include="Pdb\PdbStream.cs" />
<Compile Include="Pdb\SrcSrv.cs" />
<Compile Include="Pdb\SrcSrvContext.cs" />
<Compile Include="Helpers\PortablePdbHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Providers\BitBucketProvider.cs" />
Expand Down
55 changes: 55 additions & 0 deletions src/GitLink/Helpers/PortablePdbHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PortablePdbHelper.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace GitLink
{
using System.IO;

internal static class PortablePdbHelper
{
/// <summary>
/// Is the given .pdb using the new Portable format ? (https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md)
/// </summary>
/// <param name="pdbPath">.pdb file path</param>
/// <returns>Returns if it's a Portable PDB</returns>
public static bool IsPortablePdb(string pdbPath)
{
using (var fs = File.Open(pdbPath, FileMode.Open, FileAccess.Read))
using (var br = new BinaryReader(fs))
{
// More infos in chapter II.24.2 of ECMA-335 (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf)
var signature = 0x424A5342;
if (br.ReadUInt32() != signature)
{
return false;
}

var majorVersion = br.ReadUInt16();
if (majorVersion != 1)
{
return false;
}

var minorVersion = br.ReadUInt16();
if (minorVersion != 1)
{
return false;
}

var reserved = br.ReadUInt32();
if (reserved != 0)
{
return false;
}

var versionLength = br.ReadUInt32();
var version = System.Text.Encoding.UTF8.GetString(br.ReadBytes((int)versionLength));

return version.StartsWith("PDB v1.0");
}
}
}
}
2 changes: 2 additions & 0 deletions src/GitLink/LinkOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ public struct LinkOptions
public string CommitId { get; set; }

public string GitWorkingDirectory { get; set; }

public bool IndexAllDepotFiles { get; set; }
}
}
Loading

0 comments on commit 67da4b6

Please sign in to comment.