提交 40ee6fbe 编写于 作者: N nulltoken

Initial commit.

-C wrapper (libwrap)
-C# library (libgit2sharp)
-Some tests
上级
ref: refs/heads/master
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
Unnamed repository; edit this file 'description' to name the repository.
# git-ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
0000000000000000000000000000000000000000 8496071c1b46c854b31185ea97743be6a8774479 Scott Chacon <schacon@gmail.com> 1273360386 -0700 commit (initial): testing
8496071c1b46c854b31185ea97743be6a8774479 5b5b025afb0b4c913b4c338a42934a3863bf3644 Scott Chacon <schacon@gmail.com> 1273610322 -0700 commit: another commit
5b5b025afb0b4c913b4c338a42934a3863bf3644 36060c58702ed4c2a40832c51758d5344201d89a Scott Chacon <schacon@gmail.com> 1288115062 -0200 push
0000000000000000000000000000000000000000 8496071c1b46c854b31185ea97743be6a8774479 Scott Chacon <schacon@gmail.com> 1273360386 -0700 commit (initial): testing
8496071c1b46c854b31185ea97743be6a8774479 5b5b025afb0b4c913b4c338a42934a3863bf3644 Scott Chacon <schacon@gmail.com> 1273610322 -0700 commit: another commit
5b5b025afb0b4c913b4c338a42934a3863bf3644 36060c58702ed4c2a40832c51758d5344201d89a Scott Chacon <schacon@gmail.com> 1288115062 -0200 push
xQ
0)reݴ $ۭ-F-00𸖲?iL#HSS#q2D據jC|HSL8$)a#2i׹6js?JZftΞUiͶqiZ"_/H6
\ No newline at end of file
xQ
0D)6ͦ "xO-FbEo0 Ǥ,ske[Pn8R,EpD?g}^3 <GhYK8ЖDA);gݧjp4-r;sGA4ۺ=(in7IKFE
\ No newline at end of file
x 1ENi@k2 "X$YW0YcÅszMD08!s Xgd::@X0Pw"F/RUzmZZV}|/o5I!1z:vUim}/>
F-
\ No newline at end of file
x[
0E*fդ "W0-Ft݁pS[Yx^
Db CLhut}8X*4ZsYUA X3RM) s6輢Mរ&Jm;}<\@ޏpĀv?jۺL?H
\ No newline at end of file
x;j1Dmdǎ|M3`V{ >QvL0I?!4Z=!צ8F!rsQy9]$D&l6A>jFWҵ IKNiZ%S
 U~̽>' w [ DGڡQ-M>dO}\8g_ШoYr
\ No newline at end of file
xKj1D)zUB-0uV9<#+W<J&8/seȕKJS
Rv{QrYQN$H\E=6X5K Fr)(dCΆjs}9c-w8o\rI:
l}FW$DsǣٚOWe]V8-Ý"U
\ No newline at end of file
xQ
0D)ʦI<'lR+FjEo0<xha ]șXUlPF)z4y,\r 'S-mI4
Xh&F}n+\Y-p|鷜oUz;-alt{?I,:oRcHK
\ No newline at end of file
# pack-refs with: peeled
41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/heads/packed
36060c58702ed4c2a40832c51758d5344201d89a
5b5b025afb0b4c913b4c338a42934a3863bf3644
0c37a5391bbff43c37f0d0371823a5509eed5b1d
文件已添加
文件已添加
文件已添加
文件已添加
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# define uncompress z_uncompress
# define zError z_zError
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# define gzFile z_gzFile
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef STDC
# include <sys/types.h> /* for off_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define z_off64_t off64_t
#else
# define z_off64_t z_off_t
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
此差异已折叠。
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("libgit2sharp.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("libgit2sharp.Tests")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("808554a4-f9fd-4035-8ab9-325793c7da51")]
// 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")]
using NUnit.Framework;
using System.IO;
using NUnit.Framework.Constraints;
namespace libgit2net.Tests
{
[TestFixture]
public class RepositoryFixtures
{
const string PathToRepository = "../../Resources/testrepo.git";
[Test]
public void Ctor_RetrieveDetails()
{
using (var repo = new Repository(PathToRepository))
{
Assert.AreEqual(true, repo.Details.IsBare);
var gitDir = new DirectoryInfo(PathToRepository);
Assert.AreEqual(gitDir, new DirectoryInfo(repo.Details.RepositoryDirectory));
var odb = new DirectoryInfo(repo.Details.DatabaseDirectory);
Assert.AreEqual("objects", odb.Name);
}
}
[Test]
public void AnExistingObjectCanBeLookedUp()
{
const string objectId = "8496071c1b46c854b31185ea97743be6a8774479";
GitObject gitObject;
using (var repo = new Repository(PathToRepository))
{
gitObject = repo.Lookup(objectId);
}
Assert.IsNotNull(gitObject);
Assert.AreEqual(objectId, gitObject.Id);
}
[Test]
[Ignore]
public void ANonExistingObjectCanNotBeLookedUp()
{
const string objectId = "a496071c1b46c854b31185ea97743be6a8774471";
GitObject gitObject;
using (var repo = new Repository(PathToRepository))
{
gitObject = repo.Lookup(objectId);
}
Assert.IsNull(gitObject);
}
[Test]
public void HeadersOfAnExistingObjectCanBeRead()
{
const string objectId = "8496071c1b46c854b31185ea97743be6a8774479";
Header header;
using (var repo = new Repository(PathToRepository))
{
header = repo.ReadHeader(objectId);
}
Assert.IsNotNull(header);
Assert.AreEqual(objectId, header.Id);
Assert.AreEqual(ObjectType.Commit, header.Type);
Assert.AreEqual(172, header.Length);
}
}
}
<?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>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{286E63EB-04DD-4ADE-88D6-041B57800761}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>libgit2sharp.Tests</RootNamespace>
<AssemblyName>libgit2sharp.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\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>..\build\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\libs\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="RepositoryFixtures.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libgit2sharp\libgit2sharp.csproj">
<Project>{EE6ED99F-CB12-4683-B055-D28FC7357A34}</Project>
<Name>libgit2net</Name>
</ProjectReference>
</ItemGroup>
<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>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgit2wrap", "libgit2wrap\libgit2.wrap.vcxproj", "{45FF8275-1165-4FEE-B16A-6D270E14A455}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libgit2sharp", "libgit2sharp\libgit2sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libgit2sharp.Tests", "libgit2sharp.Tests\libgit2sharp.Tests.csproj", "{286E63EB-04DD-4ADE-88D6-041B57800761}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Debug|Any CPU.ActiveCfg = Debug|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Debug|Win32.ActiveCfg = Debug|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Debug|Win32.Build.0 = Debug|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Release|Any CPU.ActiveCfg = Release|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Release|Mixed Platforms.Build.0 = Release|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Release|Win32.ActiveCfg = Release|Win32
{45FF8275-1165-4FEE-B16A-6D270E14A455}.Release|Win32.Build.0 = Release|Win32
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Win32.ActiveCfg = Debug|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Any CPU.Build.0 = Release|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Win32.ActiveCfg = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Win32.ActiveCfg = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Any CPU.Build.0 = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
namespace libgit2net
{
public class GitObject
{
public object Id { get; set; }
}
}
namespace libgit2net
{
public class Header
{
public Header(string id, ObjectType type, ulong length)
{
Id = id;
Type = type;
Length = length;
}
public string Id { get; private set; }
public ObjectType Type { get; private set; }
public ulong Length { get; private set; }
}
}
\ No newline at end of file
namespace libgit2net
{
public enum ObjectType
{
Commit = 1, /**< A commit object. */
Tree = 2, /**< A tree (directory listing) object. */
Blob = 3, /**< A file revision object. */
Tag = 4, /**< An annotated tag object. */
}
}
\ No newline at end of file
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("libgit2sharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("libgit2sharp")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("c6f71967-5be1-49f5-b48e-861bff498ea3")]
// 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("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
using System;
using System.Runtime.InteropServices;
using libgit2net.Wrapper;
namespace libgit2net
{
public class Repository : IDisposable
{
private IntPtr _repositoryPtr = IntPtr.Zero;
private readonly RepositoryDetails _details;
public RepositoryDetails Details
{
get { return _details; }
}
public Repository(string repositoryDirectory, string databaseDirectory, string index, string workingDirectory)
{
#region Parameters Validation
if (string.IsNullOrEmpty(repositoryDirectory))
{
throw new ArgumentNullException("repositoryDirectory");
}
if (string.IsNullOrEmpty(databaseDirectory))
{
throw new ArgumentNullException("databaseDirectory");
}
if (string.IsNullOrEmpty(index))
{
throw new ArgumentNullException("index");
}
if (string.IsNullOrEmpty(workingDirectory))
{
throw new ArgumentNullException("workingDirectory");
}
#endregion Parameters Validation
wrapped_git_repository_details repositoryDetails;
OperationResult result = LibGit2Api.wrapped_git_repository_open(out repositoryDetails, out _repositoryPtr, repositoryDirectory);
_repositoryPtr = repositoryDetails.repository;
if (result != OperationResult.GIT_SUCCESS)
{
throw new Exception(Enum.GetName(typeof(OperationResult), result));
}
_details = BuildFrom(repositoryDetails);
}
public Repository(string repositoryDirectory)
{
#region Parameters Validation
if (string.IsNullOrEmpty(repositoryDirectory))
{
throw new ArgumentNullException(repositoryDirectory);
}
#endregion Parameters Validation
wrapped_git_repository_details repositoryDetails;
OperationResult result = LibGit2Api.wrapped_git_repository_open(out repositoryDetails, out _repositoryPtr, repositoryDirectory);
_repositoryPtr = repositoryDetails.repository;
if (result != OperationResult.GIT_SUCCESS)
{
throw new Exception(Enum.GetName(typeof(OperationResult), result));
}
_details = BuildFrom(repositoryDetails);
}
private static RepositoryDetails BuildFrom(wrapped_git_repository_details repositoryDetails)
{
string index = Marshal.PtrToStringAnsi(repositoryDetails.path_index);
string databaseDirectory = Marshal.PtrToStringAnsi(repositoryDetails.path_odb);
string repositoryDirectory = Marshal.PtrToStringAnsi(repositoryDetails.path_repository);
string workingDirectory = Marshal.PtrToStringAnsi(repositoryDetails.path_workdir);
return new RepositoryDetails(repositoryDirectory, index, databaseDirectory, workingDirectory, repositoryDetails.is_bare);
}
public GitObject Lookup(string objectId)
{
return new GitObject() { Id = objectId };
}
public Header ReadHeader(string objectId)
{
git_rawobj rawObj;
OperationResult result = LibGit2Api.wrapped_git_odb_read_header(out rawObj, _repositoryPtr, objectId);
switch (result)
{
case OperationResult.GIT_SUCCESS:
return new Header(objectId, (ObjectType)rawObj.type, rawObj.len.ToUInt64());
case OperationResult.GIT_ENOTFOUND:
return null;
default:
throw new Exception(Enum.GetName(typeof(OperationResult), result));
}
}
void IDisposable.Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (_repositoryPtr == (IntPtr)0)
return;
LibGit2Api.wrapped_git_repository_free(_repositoryPtr);
_repositoryPtr = (IntPtr)0;
}
~Repository()
{
Dispose(false);
}
}
}
\ No newline at end of file
using System;
namespace libgit2net
{
public class RepositoryDetails
{
private static readonly Func<string, string> Check = path => String.IsNullOrEmpty(path) ? "Undetermined" : path;
public RepositoryDetails(string repositoryDirectory, string index, string databaseDirectory, string workingDirectory, bool isBare)
{
RepositoryDirectory = Check(repositoryDirectory);
Index = Check(index);
DatabaseDirectory = Check(databaseDirectory);
WorkingDirectory = Check(workingDirectory);
IsBare = isBare;
}
public bool IsBare { get; private set; }
public string RepositoryDirectory { get; private set; }
public string Index { get; private set; }
public string DatabaseDirectory { get; private set; }
public string WorkingDirectory { get; private set; }
}
}
\ No newline at end of file
namespace libgit2net.Wrapper
{
public static class Constants
{
//public const int GIT_PATH_MAX = 4096;
public const int GIT_ERROR = -1;
}
}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
namespace libgit2net.Wrapper
{
internal static class LibGit2Api
{
private const string Libgit2 = "libgit2wrap.dll";
[DllImport(Libgit2)]
public static extern OperationResult wrapped_git_repository_open(out wrapped_git_repository_details repositoryDetails, out IntPtr repoPtr, [In] string path);
[DllImport(Libgit2)]
public static extern OperationResult wrapped_git_repository_open2(out wrapped_git_repository_details repositoryDetails, out IntPtr repoPtr, [In] string gitDir, [In] string gitObjectDirectory, [In] string gitIndexFile, [In] string gitWorkTree);
[DllImport(Libgit2)]
public static extern void wrapped_git_repository_free([In] IntPtr repository);
[DllImport(Libgit2)]
public static extern OperationResult wrapped_git_odb_read_header(out git_rawobj rawObject, [In] IntPtr repository, [In] string objectId);
}
}
\ No newline at end of file
namespace libgit2net.Wrapper
{
internal enum OperationResult
{
/** Operation completed successfully. */
GIT_SUCCESS = 0,
/**
* Operation failed, with unspecified reason.
* This value also serves as the base error code; all other
* error codes are subtracted from it such that all errors
* are < 0, in typical POSIX C tradition.
*/
GIT_ERROR = Constants.GIT_ERROR,
/** Input was not a properly formatted Git object id. */
GIT_ENOTOID = (Constants.GIT_ERROR - 1),
/** Input does not exist in the scope searched. */
GIT_ENOTFOUND = (Constants.GIT_ERROR - 2),
/** Not enough space available. */
GIT_ENOMEM = (Constants.GIT_ERROR - 3),
/** Consult the OS error information. */
GIT_EOSERR = (Constants.GIT_ERROR - 4),
/** The specified object is of invalid type */
GIT_EOBJTYPE = (Constants.GIT_ERROR - 5),
/** The specified object has its data corrupted */
GIT_EOBJCORRUPTED = (Constants.GIT_ERROR - 6),
/** The specified repository is invalid */
GIT_ENOTAREPO = (Constants.GIT_ERROR - 7),
/** The object type is invalid or doesn't match */
GIT_EINVALIDTYPE = (Constants.GIT_ERROR - 8),
/** The object cannot be written that because it's missing internal data */
GIT_EMISSINGOBJDATA = (Constants.GIT_ERROR - 9),
/** The packfile for the ODB is corrupted */
GIT_EPACKCORRUPTED = (Constants.GIT_ERROR - 10),
/** Failed to adquire or release a file lock */
GIT_EFLOCKFAIL = (Constants.GIT_ERROR - 11),
/** The Z library failed to inflate/deflate an object's data */
GIT_EZLIB = (Constants.GIT_ERROR - 12),
/** The queried object is currently busy */
GIT_EBUSY = (Constants.GIT_ERROR - 13),
/** The index file is not backed up by an existing repository */
GIT_EBAREINDEX = (Constants.GIT_ERROR - 14),
}
}
\ No newline at end of file
namespace libgit2net.Wrapper
{
internal enum git_otype
{
GIT_OBJ_ANY = -2, /**< Object can be any of the following */
GIT_OBJ_BAD = -1, /**< Object is invalid. */
GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
GIT_OBJ_COMMIT = 1, /**< A commit object. */
GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
GIT_OBJ_BLOB = 3, /**< A file revision object. */
GIT_OBJ_TAG = 4, /**< An annotated tag object. */
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
}
}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace libgit2net.Wrapper
{
[StructLayout(LayoutKind.Sequential)]
internal struct git_rawobj
{
public IntPtr data; /**< Raw, decompressed object data. */
public UIntPtr len; /**< Total number of bytes in data. */
public git_otype type; /**< Type of this object. */
}
}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
namespace libgit2net.Wrapper
{
[StructLayout(LayoutKind.Sequential)]
internal struct wrapped_git_repository_details
{
public IntPtr path_repository;
public IntPtr path_index;
public IntPtr path_odb;
public IntPtr path_workdir;
public IntPtr repository;
[MarshalAs(UnmanagedType.U1)]
public bool is_bare;
}
}
\ No newline at end of file
<?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>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EE6ED99F-CB12-4683-B055-D28FC7357A34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>libgit2sharp</RootNamespace>
<AssemblyName>libgit2sharp</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\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>..\build\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="RepositoryDetails.cs" />
<Compile Include="Wrapper\Constants.cs" />
<Compile Include="GitObject.cs" />
<Compile Include="Header.cs" />
<Compile Include="Wrapper\git_otype.cs" />
<Compile Include="Wrapper\git_rawobj.cs" />
<Compile Include="Wrapper\wrapped_git_repository_details.cs" />
<Compile Include="Wrapper\LibGit2Api.cs" />
<Compile Include="ObjectType.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository.cs" />
<Compile Include="Wrapper\OperationResult.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>xcopy "$(SolutionDir)deps\*.*" . /Y</PreBuildEvent>
</PropertyGroup>
<!-- 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>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\libgit2wrap.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\libgit2wrap.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{45FF8275-1165-4FEE-B16A-6D270E14A455}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libgit2wrap</RootNamespace>
<ProjectName>libgit2wrap</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>..\..\libgit2/src;$(IncludePath)</IncludePath>
<OutDir>..\build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>..\..\libgit2/src;$(IncludePath)</IncludePath>
<OutDir>..\build\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGIT2WRAP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\deps\libgit2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGIT2WRAP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>..\deps\libgit2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\libgit2wrap.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\libgit2wrap.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#include "libgit2wrap.h"
void build_wrapped_git_repository_details(wrapped_git_repository_details* wrapped_repo_out, git_repository* repo);
void build_wrapped_git_repository_details(wrapped_git_repository_details* wrapped_repo_out, git_repository* repo)
{
wrapped_git_repository* wrapped = ((wrapped_git_repository*)(repo));
wrapped_repo_out->path_repository = wrapped->path_repository;
wrapped_repo_out->path_index = wrapped->path_index;
wrapped_repo_out->path_odb = wrapped->path_odb;
wrapped_repo_out->path_workdir = wrapped->path_workdir;
wrapped_repo_out->is_bare = wrapped->is_bare;
wrapped_repo_out->repo = repo;
}
int wrapped_git_repository_open(wrapped_git_repository_details* wrapped_repo_out, git_repository** repo_out, const char* path)
{
git_repository *repo;
int error = git_repository_open(&repo, path);
build_wrapped_git_repository_details(wrapped_repo_out, repo);
*repo_out = repo;
return error;
}
int wrapped_git_repository_open2(wrapped_git_repository_details* wrapped_repo_out, git_repository** repo_out, const char *git_dir, const char *git_object_directory, const char *git_index_file, const char *git_work_tree)
{
git_repository *repo;
int error = git_repository_open2(&repo, git_dir, git_object_directory, git_index_file, git_work_tree);
build_wrapped_git_repository_details(wrapped_repo_out, repo);
*repo_out = repo;
return error;
}
void wrapped_git_repository_free(git_repository* repo)
{
git_repository_free(repo);
}
int wrapped_git_odb_read_header(git_rawobj* obj_out, git_repository* repo, const char *raw_id)
{
git_odb *odb;
git_oid id;
int error;
odb = git_repository_database(repo);
error = git_oid_mkstr(&id, raw_id);
if (error != GIT_SUCCESS)
return error;
error = git_odb_read_header(obj_out, odb, &id);
if (error != GIT_SUCCESS)
return error;
return error;
}
\ No newline at end of file
#ifndef INCLUDE_libgit2_wrap_h__
#define INCLUDE_libgit2_wrap_h__
#include <git/common.h>
#include <git/repository.h>
typedef struct wrapped_git_repository {
size_t db;
size_t index;
size_t objects;
char *path_repository;
char *path_index;
char *path_odb;
char *path_workdir;
unsigned is_bare:1;
} wrapped_git_repository ;
typedef struct wrapped_git_repository_details {
char *path_repository;
char *path_index;
char *path_odb;
char *path_workdir;
git_repository* repo;
unsigned is_bare:1;
} wrapped_git_repository_details ;
GIT_BEGIN_DECL
GIT_EXTERN(int) wrapped_git_repository_open(wrapped_git_repository_details* repo_out, git_repository** repo2, const char* path);
GIT_EXTERN(int) wrapped_git_repository_open2(wrapped_git_repository_details* repo_out, git_repository** repo2, const char *git_dir, const char *git_object_directory, const char *git_index_file, const char *git_work_tree);
GIT_EXTERN(void) wrapped_git_repository_free(git_repository* repo);
GIT_EXTERN(int) wrapped_git_odb_read_header(git_rawobj* obj_out, git_repository* repo, const char* raw_id);
GIT_END_DECL
#endif
\ No newline at end of file
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册