forked from jakubgarfield/Bonobo-Git-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed jakubgarfield#45 The whole content of msysgit added.
- Loading branch information
1 parent
d7984e6
commit daaa91c
Showing
145 changed files
with
17,798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{0B124D88-5C2B-47AD-B660-434B709A0DFF}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Bonobo.Git.Server.Test</RootNamespace> | ||
<AssemblyName>Bonobo.Git.Server.Test</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
</ItemGroup> | ||
</When> | ||
<Otherwise> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" /> | ||
</ItemGroup> | ||
</Otherwise> | ||
</Choose> | ||
<ItemGroup> | ||
<Compile Include="MsysgitIntegrationTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Definitions.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Bonobo.Git.Server\Bonobo.Git.Server.csproj"> | ||
<Project>{6129b3fe-b282-4f6f-8836-8af66602f8da}</Project> | ||
<Name>Bonobo.Git.Server</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Bonobo.Git.Server.Test | ||
{ | ||
public static class Definitions | ||
{ | ||
public const string Integration = "Integration"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.IO; | ||
using System.Diagnostics; | ||
|
||
namespace Bonobo.Git.Server.Test | ||
{ | ||
[TestClass] | ||
public class MsysgitIntegrationTests | ||
{ | ||
private const string RepositoryName = "Integration"; | ||
private const string WorkingDirectory = @"D:\Desktop\Test\Integration"; | ||
private readonly static string RepositoryDirectory = Path.Combine(WorkingDirectory, RepositoryName); | ||
private const string GitPath = @"D:\Projects\Bonobo Git Server\Other\Git\{0}\bin\git.exe"; | ||
private readonly static string ServerRepositoryPath = Path.Combine(@"D:\Projects\Bonobo Git Server\Source\Bonobo.Git.Server\App_Data\Repositories", RepositoryName); | ||
private readonly static string ServerRepositoryBackupPath = Path.Combine(@"D:\Desktop\Test\", RepositoryName, "Backup"); | ||
private readonly static string[] GitVersions = { "1.7.4" }; | ||
|
||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
DeleteDirectory(WorkingDirectory); | ||
} | ||
|
||
[TestMethod, TestCategory(Definitions.Integration)] | ||
public void Run() | ||
{ | ||
foreach (var version in GitVersions) | ||
{ | ||
var git = String.Format(GitPath, version); | ||
|
||
Directory.CreateDirectory(WorkingDirectory); | ||
BackupServerRepository(); | ||
|
||
try | ||
{ | ||
CloneEmptyRepository(git); | ||
PushFiles(git); | ||
PushTag(git); | ||
PushBranch(git); | ||
CloneRepository(git); | ||
PullRepository(git); | ||
PullTag(git); | ||
PullBranch(git); | ||
} | ||
finally | ||
{ | ||
RestoreServerRepository(); | ||
DeleteDirectory(WorkingDirectory); | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
private void PullBranch(string git) | ||
{ | ||
} | ||
|
||
private void PullTag(string git) | ||
{ | ||
} | ||
|
||
private void PullRepository(string git) | ||
{ | ||
} | ||
|
||
private void CloneRepository(string git) | ||
{ | ||
} | ||
|
||
private void PushBranch(string git) | ||
{ | ||
} | ||
|
||
private void PushTag(string git) | ||
{ | ||
} | ||
|
||
private void PushFiles(string git) | ||
{ | ||
CreateRandomFile(Path.Combine(RepositoryDirectory, "1.dat"), 10); | ||
CreateRandomFile(Path.Combine(RepositoryDirectory, "2.dat"), 1); | ||
Directory.CreateDirectory(Path.Combine(RepositoryDirectory, "SubDirectory")); | ||
CreateRandomFile(Path.Combine(RepositoryDirectory, "Subdirectory", "3.dat"), 20); | ||
CreateRandomFile(Path.Combine(RepositoryDirectory, "Subdirectory", "4.dat"), 15); | ||
|
||
RunGit(git, "add ."); | ||
RunGit(git, "commit -m \"Test Files Added\""); | ||
|
||
var result = RunGit(git, "push origin master"); | ||
Assert.AreEqual(result.Item2, "To http://admin:admin@localhost:50287/Integration.git\n * [new branch] master -> master\n"); | ||
} | ||
|
||
private void CloneEmptyRepository(string git) | ||
{ | ||
var result = RunGit(git, String.Format("clone http://admin:admin@localhost:50287/{0}.git", RepositoryName), WorkingDirectory); | ||
Assert.AreEqual(result.Item1, "Cloning into Integration...\n"); | ||
Assert.AreEqual(result.Item2, "warning: You appear to have cloned an empty repository.\n"); | ||
} | ||
|
||
|
||
private void RestoreServerRepository() | ||
{ | ||
CopyOverrideDirectory(ServerRepositoryBackupPath, ServerRepositoryPath); | ||
} | ||
|
||
private void BackupServerRepository() | ||
{ | ||
CopyOverrideDirectory(ServerRepositoryPath, ServerRepositoryBackupPath); | ||
} | ||
|
||
private void CopyOverrideDirectory(string target, string destination) | ||
{ | ||
DeleteDirectory(destination); | ||
Directory.CreateDirectory(destination); | ||
|
||
|
||
foreach (string dirPath in Directory.GetDirectories(target, "*", SearchOption.AllDirectories)) | ||
{ | ||
Directory.CreateDirectory(dirPath.Replace(target, destination)); | ||
} | ||
|
||
foreach (string newPath in Directory.GetFiles(target, "*.*", SearchOption.AllDirectories)) | ||
{ | ||
File.Copy(newPath, newPath.Replace(target, destination)); | ||
} | ||
} | ||
|
||
private Tuple<string, string> RunGit(string git, string arguments) | ||
{ | ||
return RunGit(git, arguments, RepositoryDirectory); | ||
} | ||
|
||
private Tuple<string, string> RunGit(string git, string arguments, string workingDirectory) | ||
{ | ||
using (var process = new Process()) | ||
{ | ||
process.StartInfo.FileName = git; | ||
process.StartInfo.WorkingDirectory = workingDirectory; | ||
process.StartInfo.Arguments = arguments; | ||
process.StartInfo.UseShellExecute = false; | ||
process.StartInfo.RedirectStandardOutput = true; | ||
process.StartInfo.RedirectStandardError = true; | ||
process.Start(); | ||
process.WaitForExit(); | ||
|
||
var output = process.StandardOutput.ReadToEnd(); | ||
var error = process.StandardError.ReadToEnd(); | ||
|
||
return new Tuple<string, string>(output, error); | ||
} | ||
} | ||
|
||
private void CreateRandomFile(string fileName, int sizeInMb) | ||
{ | ||
const int blockSize = 1024 * 8; | ||
const int blocksPerMb = (1024 * 1024) / blockSize; | ||
byte[] data = new byte[blockSize]; | ||
Random rng = new Random(); | ||
using (FileStream stream = File.OpenWrite(fileName)) | ||
{ | ||
for (int i = 0; i < sizeInMb * blocksPerMb; i++) | ||
{ | ||
rng.NextBytes(data); | ||
stream.Write(data, 0, data.Length); | ||
} | ||
} | ||
} | ||
|
||
private void DeleteDirectory(string directoryPath) | ||
{ | ||
if (!Directory.Exists(directoryPath)) | ||
return; | ||
|
||
var directory = new DirectoryInfo(directoryPath) { Attributes = FileAttributes.Normal }; | ||
foreach (var item in directory.GetFiles("*.*", SearchOption.AllDirectories)) | ||
{ | ||
item.Attributes = FileAttributes.Normal; | ||
} | ||
directory.Delete(true); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Bonobo.Git.Server.Test")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Bonobo.Git.Server.Test")] | ||
[assembly: AssemblyCopyright("Copyright © 2013")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("94027fbc-c2ed-4081-bed2-8148b04215cd")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh -e | ||
# minimalistic replacement for `run-mailcap --action=cat <file>` | ||
|
||
if test "$#" != 1 ; then | ||
echo "Usage: astextplain <file>" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# XXX output encoding (UTF-8) hardcoded | ||
case "$1" in | ||
*.doc | *.DOC | *.dot | *.DOT) | ||
antiword -m UTF-8 "$1" || cat "$1" | ||
;; | ||
*.docx | *.DOCX) | ||
docx2txt "$1" - | ||
;; | ||
*.pdf | *.PDF) | ||
pdftotext -layout "$1" -enc UTF-8 - | ||
;; | ||
# TODO add rtf support | ||
*.rtf | *.RTF) | ||
cat "$1" | ||
;; | ||
*) | ||
echo "E: unsupported filetype $1" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# Copyright (C) 2002, Earnie Boyd | ||
# mailto:earnie@users.sf.net | ||
# This file is part of MSYS | ||
# http://www.mingw.org/msys.shtml | ||
# File: awk | ||
|
||
gawk "$@" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.