mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-01 01:48:28 +03:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c70f971e5f | ||
|
|
33ac9dfbb6 | ||
|
|
12ed472049 | ||
|
|
7cea3fa0a9 | ||
|
|
7fc5e1e959 | ||
|
|
7cc8269aeb | ||
|
|
879c2b5d8f | ||
|
|
7861721319 | ||
|
|
60408127a8 | ||
|
|
97d82d2ac8 | ||
|
|
bd7ac76035 | ||
|
|
b5d56d48ce | ||
|
|
185ac3ec77 | ||
|
|
6d98ee28b5 | ||
|
|
7363752513 | ||
|
|
b840327919 | ||
|
|
c869346ad1 | ||
|
|
6ca655d092 | ||
|
|
3f2679c81d | ||
|
|
0b60d64ccf | ||
|
|
8fce7ad07c | ||
|
|
93f6e49d7e | ||
|
|
2a16b3d168 | ||
|
|
a3ad451bdd | ||
|
|
bb9c7a7105 | ||
|
|
5ced3f6eaf |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -10,6 +10,9 @@ api.json
|
||||
# VSCode Cache
|
||||
.vscode/
|
||||
|
||||
# Mac stuff
|
||||
.DS_Store
|
||||
|
||||
# Binaries
|
||||
bin/
|
||||
intermediate/
|
||||
@@ -25,7 +28,3 @@ build/
|
||||
*.out
|
||||
.import/
|
||||
|
||||
# Binaries for distribution
|
||||
!/demo/bin/
|
||||
!git2.lib
|
||||
!libgit.a
|
||||
|
||||
42
README.md
42
README.md
@@ -1,21 +1,47 @@
|
||||
# GDNative Based Git Plugin for Godot Version Control Editor Plugin
|
||||
Implements the proxy end-points for the `EditorVCSInterface` API in the Godot Engine Editor. Uses [libgit2](https://libgit2.org) at its backend to simulate Git in code.
|
||||
|
||||
Git implementation of the Godot Engine VCS interface in Godot. We use [libgit2](https://libgit2.org) as our backend to simulate Git in code.
|
||||
|
||||
> Planned for Godot 4.0 since Godot 3.2+. Look for other branches for support in other Godot releases.
|
||||
|
||||
## Installation Instructions
|
||||
|
||||
1. Plugin binary releases for Linux & Windows are here: <https://github.com/godotengine/godot-git-plugin/releases>
|
||||
2. Installation instructions are here: https://github.com/godotengine/godot-git-plugin/wiki
|
||||
1. Grab the platform binaries here: <https://github.com/godotengine/godot-git-plugin/releases>
|
||||
2. Then read the installation instructions: https://github.com/godotengine/godot-git-plugin/wiki
|
||||
|
||||
## Build Instructions
|
||||
|
||||
> Replace `Release` with `Debug` for a debug build.
|
||||
### Pre-requisites
|
||||
|
||||
Required build tools:
|
||||
|
||||
* [CMake](https://cmake.org/download/) (v3.5.1+)
|
||||
* [SCons](https://scons.org/pages/download.html) (v3.0.1+)
|
||||
|
||||
### Windows
|
||||
|
||||
> MSVC is our recommended compiler for Windows
|
||||
|
||||
1. Load the x64 command prompt: `x64 Native Tools Command Prompt for VS 20XX`.
|
||||
2. Run `build_libs.bat Release`.
|
||||
3. Run `scons platform=windows target=release`
|
||||
2. Run ```build_libs.bat Release```.
|
||||
3. Run ```scons platform=windows target=release```
|
||||
|
||||
### Linux
|
||||
1. Prepare script for execution: `chmod 755 build_libs.sh`
|
||||
|
||||
> G++ is our recommended compiler for Linux
|
||||
|
||||
1. Prepare script for execution: ```chmod 755 build_libs.sh```
|
||||
2. Run ```. ./build_libs.sh Release```.
|
||||
3. Run `scons platform=x11 target=release`.
|
||||
3. Run ```scons platform=x11 target=release```.
|
||||
|
||||
### MacOS
|
||||
|
||||
> G++ and Clang++ are our recommended compilers for MacOS
|
||||
|
||||
1. Prepare script for execution: ```chmod 755 build_libs_mac.sh```
|
||||
2. Run ```. ./build_libs_mac.sh Release```.
|
||||
3. Run ```scons platform=osx target=release```.
|
||||
|
||||
#### Debug build
|
||||
|
||||
Replace `Release` with `Debug` and `release` with `debug` in the above instructions for a debug build. You will also have to do the same in the paths mentioned in `demo/git_api.gdnlib` before opening the demo project in Godot.
|
||||
|
||||
22
appveyor.yml
22
appveyor.yml
@@ -1,20 +1,22 @@
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- vs_version: 15
|
||||
- vs_version: 16
|
||||
|
||||
os: Visual Studio 2017
|
||||
os: Visual Studio 2019
|
||||
|
||||
build: off
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
- release
|
||||
- debug
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
install:
|
||||
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- curl -LO https://downloads.sourceforge.net/project/scons/scons-local/3.0.5/scons-local-3.0.5.zip
|
||||
- unzip scons-local-3.0.5.zip
|
||||
- ./build_libs.bat %configuration%
|
||||
- scons platform=windows target=%configuration%
|
||||
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- curl -LO https://downloads.sourceforge.net/project/scons/scons-local/3.1.2/scons-local-3.1.2.zip
|
||||
- unzip scons-local-3.1.2.zip
|
||||
- .\build_libs.bat %configuration%
|
||||
- cd ..
|
||||
- .\scons.bat platform=windows target=%configuration% -j2
|
||||
|
||||
@@ -5,11 +5,20 @@ cd godot-git-plugin\thirdparty\libgit2\
|
||||
mkdir build
|
||||
cd build\
|
||||
del /F CMakeCache.txt
|
||||
cmake ..
|
||||
cmake --build .
|
||||
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OFF -DUSE_BUNDLED_ZLIB=ON -DWINHTTP=OFF
|
||||
cmake --build . --config %1
|
||||
cd ../../../../
|
||||
mkdir "demo/bin/win64/"
|
||||
copy godot-git-plugin\thirdparty\libgit2\build\%1\git2.lib demo\bin\win64\
|
||||
|
||||
if "%CI%"=="" (
|
||||
echo Non-CI build detected
|
||||
set SCONS=scons
|
||||
) else (
|
||||
echo CI build detected
|
||||
set SCONS=..\scons.bat
|
||||
)
|
||||
|
||||
cd godot-cpp\
|
||||
scons platform=windows target=%1 generate_bindings=yes bits=64
|
||||
%SCONS% platform=windows target=%1 generate_bindings=yes bits=64
|
||||
cd ..
|
||||
|
||||
@@ -5,12 +5,19 @@ cd godot-git-plugin/thirdparty/libgit2/
|
||||
mkdir build
|
||||
cd build/
|
||||
rm CMakeCache.txt
|
||||
cmake ..
|
||||
cmake --build .
|
||||
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OFF -DUSE_BUNDLED_ZLIB=ON
|
||||
cmake --build . --config $1
|
||||
cd ../../../../
|
||||
mv godot-git-plugin/thirdparty/libgit2/build/libgit2.a demo/bin/x11/libgit2.a
|
||||
mkdir -p "demo/bin/x11/"
|
||||
cp "godot-git-plugin/thirdparty/libgit2/build/libgit2.a" "demo/bin/x11/libgit2.a"
|
||||
|
||||
if [ -z "$CI" ]
|
||||
then
|
||||
echo "Non-CI run was detected"
|
||||
else
|
||||
echo "CI run was detected"
|
||||
fi
|
||||
|
||||
cd godot-cpp/;
|
||||
apt-get install scons
|
||||
scons platform=linux target=$1 generate_bindings=yes bits=64;
|
||||
cd ..
|
||||
|
||||
23
build_libs_mac.sh
Executable file
23
build_libs_mac.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
git submodule init;
|
||||
git submodule update --init --recursive;
|
||||
|
||||
cd godot-git-plugin/thirdparty/libgit2/
|
||||
mkdir build
|
||||
cd build/
|
||||
rm CMakeCache.txt
|
||||
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OFF -DUSE_BUNDLED_ZLIB=ON -DUSE_ICONV=OFF
|
||||
cmake --build . --config $1
|
||||
cd ../../../../
|
||||
mkdir -p "demo/bin/osx/"
|
||||
cp "godot-git-plugin/thirdparty/libgit2/build/libgit2.a" "demo/bin/osx/libgit2.a"
|
||||
|
||||
if [ -z "$CI" ]
|
||||
then
|
||||
echo "Non-CI run was detected"
|
||||
else
|
||||
echo "CI run was detected"
|
||||
fi
|
||||
|
||||
cd godot-cpp/;
|
||||
scons platform=osx target=$1 generate_bindings=yes bits=64;
|
||||
cd ..
|
||||
Binary file not shown.
Binary file not shown.
@@ -7,10 +7,12 @@ reloadable=false
|
||||
|
||||
[entry]
|
||||
|
||||
OSX.64="res://bin/osx/release/libgitapi.dylib"
|
||||
Windows.64="res://bin/win64/release/libgitapi.dll"
|
||||
X11.64="res://bin/x11/release/libgitapi.so"
|
||||
|
||||
[dependencies]
|
||||
|
||||
OSX.64=[ ]
|
||||
Windows.64=[ ]
|
||||
X11.64=[ ]
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.572
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "godot-git-plugin", "godot-git-plugin.vcxproj", "{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Debug|x64.Build.0 = Debug|x64
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Debug|x86.Build.0 = Debug|Win32
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Release|x64.ActiveCfg = Release|x64
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Release|x64.Build.0 = Release|x64
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Release|x86.ActiveCfg = Release|Win32
|
||||
{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {76AE10F4-C459-45E7-AB91-BC7C0B0BA625}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,156 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{574C5E6A-EDEC-41A6-BDF7-4106698F80B0}</ProjectGuid>
|
||||
<RootNamespace>godotgitplugin</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</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>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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|x64'">
|
||||
<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|x64'">
|
||||
<IncludePath>D:\CPP Projects\godot-git-plugin\godot-git-plugin\thirdparty\libgit2\include;.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\CPP Projects\godot-git-plugin\demo\bin\win64;..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
|
||||
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
|
||||
<OutDir>$(SolutionDir)..\demo\bin\win64\debug\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\demo\bin\win64\intermediate\</IntDir>
|
||||
<TargetName>libgitapi</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>D:\CPP Projects\godot-git-plugin\godot-git-plugin\thirdparty\libgit2\include;.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\CPP Projects\godot-git-plugin\demo\bin\win64;..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
|
||||
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
|
||||
<TargetName>libgitapi</TargetName>
|
||||
<IntDir>$(SolutionDir)..\demo\bin\win64\intermediate\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\demo\bin\win64\release\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libgodot-cpp.windows.debug.64.lib;git2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>libgodot-cpp.windows.release.64.lib;git2.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>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\gdlibrary.cpp" />
|
||||
<ClCompile Include="src\git_api.cpp" />
|
||||
<ClCompile Include="src\git_common.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\allocation_defs.h" />
|
||||
<ClInclude Include="src\git_api.h" />
|
||||
<ClInclude Include="src\git_common.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".clang-format" />
|
||||
<None Include=".editorconfig" />
|
||||
<None Include="cpp.hint" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,44 +0,0 @@
|
||||
<?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;hh;hpp;hxx;hm;inl;inc;ipp;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>
|
||||
<ClCompile Include="src\gdlibrary.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\git_api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\git_common.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\git_api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\git_common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\allocation_defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
<None Include=".clang-format" />
|
||||
<None Include=".editorconfig" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -30,8 +30,8 @@ class GitAPI : public EditorVCSInterface {
|
||||
PanelContainer *init_settings_panel_container;
|
||||
Button *init_settings_button;
|
||||
|
||||
git_repository *repo;
|
||||
|
||||
git_repository *repo = nullptr;
|
||||
|
||||
void _commit(const String p_msg);
|
||||
bool _is_vcs_initialized();
|
||||
Dictionary _get_modified_files_data();
|
||||
|
||||
4
godot-git-plugin/thirdparty/VERSIONS
vendored
4
godot-git-plugin/thirdparty/VERSIONS
vendored
@@ -1,3 +1,3 @@
|
||||
# This file lists all thirdparty libraries used in this plugin with the latest commit link of when source was picked up
|
||||
# This file lists all thirdparty libraries used in this plugin with the latest master commit link of when source was picked up
|
||||
|
||||
libgit2: https://github.com/libgit2/libgit2/commit/f039c836438f96407abc08cbd238b9102318deb2
|
||||
libgit2 v1.0: https://github.com/libgit2/libgit2/commit/7d3c7057f0e774aecd6fc4ef8333e69e5c4873e0
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
; Check http://editorconfig.org/ for more informations
|
||||
; Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
; tab indentation
|
||||
[*]
|
||||
indent_style = tab
|
||||
tab_width = 8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
; 4-column space indentation
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# > cmake --build . --target install
|
||||
|
||||
PROJECT(libgit2 C)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
|
||||
CMAKE_POLICY(SET CMP0015 NEW)
|
||||
IF(POLICY CMP0051)
|
||||
CMAKE_POLICY(SET CMP0051 NEW)
|
||||
@@ -36,6 +36,7 @@ INCLUDE(AddCFlagIfSupported)
|
||||
INCLUDE(FindPkgLibraries)
|
||||
INCLUDE(FindThreads)
|
||||
INCLUDE(FindStatNsec)
|
||||
INCLUDE(GNUInstallDirs)
|
||||
INCLUDE(IdeSplitSources)
|
||||
INCLUDE(FeatureSummary)
|
||||
INCLUDE(EnableWarnings)
|
||||
@@ -44,14 +45,14 @@ INCLUDE(EnableWarnings)
|
||||
#
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
OPTION(SONAME "Set the (SO)VERSION of the target" ON)
|
||||
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" OFF)
|
||||
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
|
||||
OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
|
||||
OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON)
|
||||
OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
|
||||
OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
|
||||
OPTION(TAGS "Generate tags" OFF)
|
||||
OPTION(PROFILE "Generate profiling information" OFF)
|
||||
OPTION(ENABLE_TRACE "Enables tracing support" OFF)
|
||||
OPTION(ENABLE_TRACE "Enables tracing support" ON)
|
||||
OPTION(LIBGIT2_FILENAME "Name of the produced binary" OFF)
|
||||
OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
|
||||
OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
|
||||
@@ -59,10 +60,9 @@ OPTION(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Gene
|
||||
OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
|
||||
OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
|
||||
OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
|
||||
OPTION(VALGRIND "Configure build for valgrind" OFF)
|
||||
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
|
||||
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
|
||||
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" ON)
|
||||
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
|
||||
SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
|
||||
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
|
||||
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
|
||||
@@ -112,8 +112,8 @@ STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_V
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_REV "${GIT2_HEADER}")
|
||||
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
|
||||
|
||||
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
|
||||
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION \"([0-9.]+)\"$")
|
||||
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION \"([0-9.]+)\"$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
|
||||
|
||||
IF (DEPRECATE_HARD)
|
||||
ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
|
||||
@@ -264,6 +264,11 @@ ELSE ()
|
||||
ENDIF ()
|
||||
ENDIF()
|
||||
|
||||
# Ensure that MinGW provides the correct header files.
|
||||
IF (WIN32 AND NOT CYGWIN)
|
||||
ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0600)
|
||||
ENDIF()
|
||||
|
||||
IF( NOT CMAKE_CONFIGURATION_TYPES )
|
||||
# Build Debug by default
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
@@ -331,10 +336,5 @@ IF(BUILD_FUZZERS)
|
||||
ADD_SUBDIRECTORY(fuzzers)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_VERSION VERSION_GREATER 3)
|
||||
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
ELSE()
|
||||
PRINT_ENABLED_FEATURES()
|
||||
PRINT_DISABLED_FEATURES()
|
||||
ENDIF()
|
||||
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
||||
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
||||
|
||||
21
godot-git-plugin/thirdparty/libgit2/README.md
vendored
21
godot-git-plugin/thirdparty/libgit2/README.md
vendored
@@ -4,9 +4,8 @@ libgit2 - the Git linkable library
|
||||
| Build Status | |
|
||||
| ------------ | - |
|
||||
| **master** branch CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=master) |
|
||||
| **v0.99 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.99) |
|
||||
| **v0.28 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.28) |
|
||||
| **v0.27 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.27) |
|
||||
| **v0.26 branch** CI builds | [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=7&branchName=maint/v0.26) |
|
||||
| **Nightly** builds | [](https://libgit2.visualstudio.com/libgit2/_build/latest?definitionId=9&branchName=master) [](https://dev.azure.com/libgit2/libgit2/_build/latest?definitionId=21?branchName=master) [](https://scan.coverity.com/projects/639) |
|
||||
|
||||
`libgit2` is a portable, pure C implementation of the Git core methods
|
||||
@@ -79,11 +78,11 @@ More detailed build guidance is available below.
|
||||
Getting Help
|
||||
============
|
||||
|
||||
**Join us on Slack**
|
||||
**Chat with us**
|
||||
|
||||
Visit [slack.libgit2.org](http://slack.libgit2.org/) to sign up, then join
|
||||
us in `#libgit2`. If you prefer IRC, you can also point your client to our
|
||||
slack channel once you've registered.
|
||||
- via IRC: join [#libgit2](https://webchat.freenode.net/#libgit2) on Freenode
|
||||
- via Slack: visit [slack.libgit2.org](http://slack.libgit2.org/) to sign up,
|
||||
then join us in `#libgit2`
|
||||
|
||||
**Getting Help**
|
||||
|
||||
@@ -248,9 +247,9 @@ For more advanced use or questions about CMake please read <https://cmake.org/Wi
|
||||
|
||||
The following CMake variables are declared:
|
||||
|
||||
- `BIN_INSTALL_DIR`: Where to install binaries to.
|
||||
- `LIB_INSTALL_DIR`: Where to install libraries to.
|
||||
- `INCLUDE_INSTALL_DIR`: Where to install headers to.
|
||||
- `CMAKE_INSTALL_BINDIR`: Where to install binaries to.
|
||||
- `CMAKE_INSTALL_LIBDIR`: Where to install libraries to.
|
||||
- `CMAKE_INSTALL_INCLUDEDIR`: Where to install headers to.
|
||||
- `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON)
|
||||
- `BUILD_CLAR`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON)
|
||||
- `THREADSAFE`: Build libgit2 with threading support (defaults to ON)
|
||||
@@ -330,8 +329,10 @@ Here are the bindings to libgit2 that are currently available:
|
||||
* hgit2 <https://github.com/jwiegley/gitlib>
|
||||
* Java
|
||||
* Jagged <https://github.com/ethomson/jagged>
|
||||
* Javascript / WebAssembly ( browser and nodejs )
|
||||
* WASM-git <https://github.com/petersalomonsen/wasm-git>
|
||||
* Julia
|
||||
* LibGit2.jl <https://github.com/jakebolewski/LibGit2.jl>
|
||||
* LibGit2.jl <https://github.com/JuliaLang/julia/tree/master/stdlib/LibGit2>
|
||||
* Lua
|
||||
* luagit2 <https://github.com/libgit2/luagit2>
|
||||
* .NET
|
||||
|
||||
@@ -6,62 +6,74 @@ trigger:
|
||||
- maint/*
|
||||
|
||||
jobs:
|
||||
- job: linux_amd64_trusty_gcc_openssl
|
||||
displayName: 'Linux (amd64; Trusty; GCC; OpenSSL)'
|
||||
- job: linux_amd64_xenial_gcc_openssl
|
||||
displayName: 'Linux (amd64; Xenial; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_trusty_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Trusty; GCC; mbedTLS)'
|
||||
- job: linux_amd64_xenial_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; GCC; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_trusty_clang_openssl
|
||||
displayName: 'Linux (amd64; Trusty; Clang; OpenSSL)'
|
||||
- job: linux_amd64_xenial_clang_openssl
|
||||
displayName: 'Linux (amd64; Xenial; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: linux_amd64_trusty_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Trusty; Clang; mbedTLS)'
|
||||
- job: linux_amd64_xenial_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; Clang; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: azure-pipelines/docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON
|
||||
GITTEST_NEGOTIATE_PASSWORD=${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: macos
|
||||
displayName: 'macOS'
|
||||
displayName: 'macOS (amd64; 10.15)'
|
||||
pool:
|
||||
vmImage: 'macOS 10.13'
|
||||
vmImage: 'macOS-10.15'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh'
|
||||
displayName: Setup
|
||||
@@ -71,34 +83,40 @@ jobs:
|
||||
TMPDIR: $(Agent.TempDirectory)
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
GITTEST_NEGOTIATE_PASSWORD: ${{ variables.GITTEST_NEGOTIATE_PASSWORD }}
|
||||
|
||||
- job: windows_vs_amd64
|
||||
displayName: 'Windows (amd64; Visual Studio)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
CMAKE_GENERATOR: Visual Studio 15 2017
|
||||
CMAKE_OPTIONS: -A x64 -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_vs_x86
|
||||
displayName: 'Windows (x86; Visual Studio)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- template: azure-pipelines/bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
CMAKE_GENERATOR: Visual Studio 15 2017
|
||||
CMAKE_OPTIONS: -A Win32 -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_mingw_amd64
|
||||
displayName: 'Windows (amd64; MinGW)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
@@ -112,10 +130,12 @@ jobs:
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: windows_mingw_x86
|
||||
displayName: 'Windows (x86; MinGW)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
@@ -130,17 +150,22 @@ jobs:
|
||||
CMAKE_GENERATOR: MinGW Makefiles
|
||||
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
|
||||
- job: documentation
|
||||
displayName: 'Generate Documentation'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- script: |
|
||||
cd $(Build.SourcesDirectory)/azure-pipelines/docker
|
||||
docker build -t libgit2/docurium --build-arg BASE=ubuntu:trusty -f docurium .
|
||||
displayName: 'Build Docker image'
|
||||
- script: |
|
||||
git config user.name 'Documentation Generation'
|
||||
git config user.email 'libgit2@users.noreply.github.com'
|
||||
git branch gh-pages origin/gh-pages
|
||||
docker run --rm -v $(Build.SourcesDirectory):/src -w /src libgit2/docurium:latest cm doc api.docurium
|
||||
docker run --rm -v $(Build.SourcesDirectory):/home/libgit2/source -w /home/libgit2/source libgit2/docurium:latest cm doc api.docurium
|
||||
git checkout gh-pages
|
||||
cp -R * '$(Build.BinariesDirectory)'
|
||||
displayName: 'Generate Documentation'
|
||||
@@ -162,4 +187,4 @@ jobs:
|
||||
echo 'password $(GITHUB_PAT)' >> ~/.netrc
|
||||
git push origin gh-pages
|
||||
displayName: 'Publish Documentation'
|
||||
condition: eq(variables['Build.Reason'], 'IndividualCI')
|
||||
condition: and(eq(variables['Build.Repository.Name'], 'libgit2/libgit2'), eq(variables['Build.Reason'], 'IndividualCI'))
|
||||
|
||||
@@ -11,6 +11,7 @@ SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $(
|
||||
BUILD_DIR=$(pwd)
|
||||
BUILD_PATH=${BUILD_PATH:=$PATH}
|
||||
CMAKE=$(which cmake)
|
||||
CMAKE_GENERATOR=${CMAKE_GENERATOR:-Unix Makefiles}
|
||||
|
||||
indent() { sed "s/^/ /"; }
|
||||
|
||||
@@ -25,7 +26,7 @@ fi
|
||||
|
||||
if [ -f "/etc/debian_version" ]; then
|
||||
echo "Debian version:"
|
||||
lsb_release -a | indent
|
||||
(source /etc/lsb-release && echo "${DISTRIB_DESCRIPTION}") | indent
|
||||
fi
|
||||
|
||||
echo "Kernel version:"
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Environment check
|
||||
[ -z "$COVERITY_TOKEN" ] && echo "Need to set a coverity token" && exit 1
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
|
||||
case $(uname -m) in
|
||||
i?86) BITS=32 ;;
|
||||
amd64|x86_64) BITS=64 ;;
|
||||
esac
|
||||
SCAN_TOOL=https://scan.coverity.com/download/cxx/linux${BITS}
|
||||
TOOL_BASE=$(pwd)/_coverity-scan
|
||||
|
||||
# Install coverity tools
|
||||
if [ ! -d "$TOOL_BASE" ]; then
|
||||
echo "Downloading coverity..."
|
||||
mkdir -p "$TOOL_BASE"
|
||||
pushd "$TOOL_BASE"
|
||||
wget -O coverity_tool.tgz $SCAN_TOOL \
|
||||
--post-data "project=libgit2&token=$COVERITY_TOKEN"
|
||||
tar xzf coverity_tool.tgz
|
||||
popd
|
||||
TOOL_DIR=$(find "$TOOL_BASE" -type d -name 'cov-analysis*')
|
||||
ln -s "$TOOL_DIR" "$TOOL_BASE"/cov-analysis
|
||||
fi
|
||||
|
||||
cp "${SOURCE_DIR}/script/user_nodefs.h" "$TOOL_BASE"/cov-analysis/config/user_nodefs.h
|
||||
|
||||
COV_BUILD="$TOOL_BASE/cov-analysis/bin/cov-build"
|
||||
|
||||
# Configure and build
|
||||
cmake ${SOURCE_DIR}
|
||||
|
||||
COVERITY_UNSUPPORTED=1 \
|
||||
$COV_BUILD --dir cov-int \
|
||||
cmake --build .
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Results check
|
||||
[ ! -d "cov-int" ] && echo "Coverity directory not found" && exit 1
|
||||
|
||||
# Upload results
|
||||
tar czf libgit2.tgz cov-int
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
SHA=$(cd ${SOURCE_DIR} && git rev-parse --short HEAD)
|
||||
|
||||
HTML="$(curl \
|
||||
--silent \
|
||||
--write-out "\n%{http_code}" \
|
||||
--form token="$COVERITY_TOKEN" \
|
||||
--form email=libgit2@gmail.com \
|
||||
--form file=@libgit2.tgz \
|
||||
--form version="$SHA" \
|
||||
--form description="libgit2 build" \
|
||||
https://scan.coverity.com/builds?project=libgit2)"
|
||||
|
||||
# Body is everything up to the last line
|
||||
BODY="$(echo "$HTML" | head -n-1)"
|
||||
|
||||
# Status code is the last line
|
||||
STATUS_CODE="$(echo "$HTML" | tail -n1)"
|
||||
|
||||
if [ "${STATUS_CODE}" != "200" -a "${STATUS_CODE}" != "201" ]; then
|
||||
echo "Received error code ${STATUS_CODE} from Coverity"
|
||||
exit 1
|
||||
fi
|
||||
62
godot-git-plugin/thirdparty/libgit2/azure-pipelines/coverity.sh
vendored
Normal file
62
godot-git-plugin/thirdparty/libgit2/azure-pipelines/coverity.sh
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if test -z "$COVERITY_TOKEN"
|
||||
then
|
||||
echo "Need to set a coverity token"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $(uname -m) in
|
||||
i?86)
|
||||
BITS=32;;
|
||||
amd64|x86_64)
|
||||
BITS=64;;
|
||||
*)
|
||||
echo "Unsupported arch '$(uname -m)'"
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
SCAN_TOOL=https://scan.coverity.com/download/cxx/linux${BITS}
|
||||
SOURCE_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..)
|
||||
BUILD_DIR=${SOURCE_DIR}/coverity-build
|
||||
TOOL_DIR=${BUILD_DIR}/coverity-tools
|
||||
|
||||
# Install coverity tools
|
||||
if ! test -d "$TOOL_DIR"
|
||||
then
|
||||
mkdir -p "$TOOL_DIR"
|
||||
curl --silent --show-error --location --data "project=libgit2&token=$COVERITY_TOKEN" "$SCAN_TOOL" |
|
||||
tar -xzC "$TOOL_DIR"
|
||||
ln -s "$(find "$TOOL_DIR" -type d -name 'cov-analysis*')" "$TOOL_DIR"/cov-analysis
|
||||
fi
|
||||
|
||||
cp "${SOURCE_DIR}/script/user_nodefs.h" "$TOOL_DIR"/cov-analysis/config/
|
||||
|
||||
# Build libgit2 with Coverity
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
cmake "$SOURCE_DIR"
|
||||
COVERITY_UNSUPPORTED=1 \
|
||||
"$TOOL_DIR/cov-analysis/bin/cov-build" --dir cov-int \
|
||||
cmake --build .
|
||||
|
||||
# Upload results
|
||||
tar -czf libgit2.tgz cov-int
|
||||
REVISION=$(cd ${SOURCE_DIR} && git rev-parse --short HEAD)
|
||||
HTML="$(curl \
|
||||
--silent --show-error \
|
||||
--write-out "\n%{http_code}" \
|
||||
--form token="$COVERITY_TOKEN" \
|
||||
--form email=libgit2@gmail.com \
|
||||
--form file=@libgit2.tgz \
|
||||
--form version="$REVISION" \
|
||||
--form description="libgit2 build" \
|
||||
https://scan.coverity.com/builds?project=libgit2)"
|
||||
|
||||
# Status code is the last line
|
||||
STATUS_CODE="$(echo "$HTML" | tail -n1)"
|
||||
if test "${STATUS_CODE}" != 200 && test "${STATUS_CODE}" != 201
|
||||
then
|
||||
echo "Received error code ${STATUS_CODE} from Coverity"
|
||||
exit 1
|
||||
fi
|
||||
@@ -5,32 +5,22 @@ jobs:
|
||||
- job: coverity
|
||||
displayName: 'Coverity'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- script: |
|
||||
cd $(Build.SourcesDirectory)/azure-pipelines/docker
|
||||
docker build -t libgit2/xenial --build-arg BASE=ubuntu:xenial -f xenial .
|
||||
displayName: 'Build Docker image'
|
||||
- task: Docker@0
|
||||
displayName: Build
|
||||
displayName: Analyze
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: 'libgit2/trusty-openssl:latest'
|
||||
imageName: libgit2/xenial
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/src
|
||||
$(Build.BinariesDirectory):/build
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: |
|
||||
COVERITY_TOKEN=$(COVERITY_TOKEN)
|
||||
workDir: '/build'
|
||||
containerCommand: '/src/azure-pipelines/coverity-build.sh'
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/coverity.sh'
|
||||
detached: false
|
||||
- task: Docker@0
|
||||
displayName: Publish
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: 'libgit2/trusty-openssl:latest'
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/src
|
||||
$(Build.BinariesDirectory):/build
|
||||
envVars: |
|
||||
COVERITY_TOKEN=$(COVERITY_TOKEN)
|
||||
workDir: '/build'
|
||||
containerCommand: '/src/azure-pipelines/coverity-publish.sh'
|
||||
detached: false
|
||||
continueOnError: true
|
||||
|
||||
@@ -4,29 +4,43 @@ steps:
|
||||
- script: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
displayName: 'Register Docker QEMU'
|
||||
|
||||
- task: cache@2
|
||||
displayName: Cache Docker layers
|
||||
inputs:
|
||||
key: docker
|
||||
path: /tmp/dockercache
|
||||
- script: |
|
||||
if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi
|
||||
displayName: 'Load Docker cache'
|
||||
- script: |
|
||||
cd $(Build.SourcesDirectory)/azure-pipelines/docker &&
|
||||
docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} . &&
|
||||
if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi &&
|
||||
docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar
|
||||
displayName: 'Build Docker image'
|
||||
- task: docker@0
|
||||
displayName: Build
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: ${{ parameters.imageName }}
|
||||
imageName: libgit2/${{ parameters.docker.image }}
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/src
|
||||
$(Build.BinariesDirectory):/build
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: ${{ parameters.environmentVariables }}
|
||||
workDir: '/build'
|
||||
containerCommand: '/src/azure-pipelines/build.sh'
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/build.sh'
|
||||
detached: false
|
||||
- task: docker@0
|
||||
displayName: Test
|
||||
inputs:
|
||||
action: 'Run an image'
|
||||
imageName: ${{ parameters.imageName }}
|
||||
imageName: libgit2/${{ parameters.docker.image }}
|
||||
volumes: |
|
||||
$(Build.SourcesDirectory):/src
|
||||
$(Build.BinariesDirectory):/build
|
||||
$(Build.SourcesDirectory):/home/libgit2/source
|
||||
$(Build.BinariesDirectory):/home/libgit2/build
|
||||
envVars: ${{ parameters.environmentVariables }}
|
||||
workDir: '/build'
|
||||
containerCommand: '/src/azure-pipelines/test.sh'
|
||||
workDir: '/home/libgit2/build'
|
||||
containerCommand: '/home/libgit2/source/azure-pipelines/test.sh'
|
||||
detached: false
|
||||
- task: publishtestresults@2
|
||||
displayName: Publish Test Results
|
||||
|
||||
42
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/bionic
vendored
Normal file
42
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/bionic
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
ARG BASE
|
||||
FROM $BASE AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
libcurl4-openssl-dev \
|
||||
libpcre3-dev \
|
||||
libssh2-1-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS configure
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod a+x /usr/local/bin/entrypoint.sh
|
||||
RUN mkdir /var/run/sshd
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
3
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/docurium
vendored
Normal file
3
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/docurium
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM ubuntu:bionic
|
||||
RUN apt update && apt install -y cmake pkg-config ruby ruby-dev llvm libclang-dev libssl-dev python-pygments
|
||||
RUN gem install docurium
|
||||
4
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/entrypoint.sh
vendored
Normal file
4
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/entrypoint.sh
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
useradd --shell /bin/bash libgit2
|
||||
chown --recursive libgit2:libgit2 /home/libgit2
|
||||
exec sudo --preserve-env --set-home --user=libgit2 "$@"
|
||||
67
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/xenial
vendored
Normal file
67
godot-git-plugin/thirdparty/libgit2/azure-pipelines/docker/xenial
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
ARG BASE
|
||||
FROM $BASE AS apt
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
bzip2 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
krb5-user \
|
||||
libcurl4-gnutls-dev \
|
||||
libgcrypt20-dev \
|
||||
libkrb5-dev \
|
||||
libpcre3-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
openjdk-8-jre-headless \
|
||||
openssh-server \
|
||||
openssl \
|
||||
pkgconf \
|
||||
python \
|
||||
sudo \
|
||||
valgrind \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM apt AS mbedtls
|
||||
RUN cd /tmp && \
|
||||
curl --location --silent --show-error https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz | \
|
||||
tar -xz && \
|
||||
cd mbedtls-2.16.2 && \
|
||||
scripts/config.pl set MBEDTLS_MD4_C 1 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf mbedtls-2.16.2
|
||||
|
||||
FROM mbedtls AS libssh2
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://www.libssh2.org/download/libssh2-1.8.2.tar.gz | \
|
||||
tar -xz && \
|
||||
cd libssh2-1.8.2 && \
|
||||
CFLAGS=-fPIC cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCRYPTO_BACKEND=Libgcrypt . && \
|
||||
ninja install && \
|
||||
cd .. && \
|
||||
rm -rf libssh2-1.8.2
|
||||
|
||||
FROM libssh2 AS valgrind
|
||||
RUN cd /tmp && \
|
||||
curl --insecure --location --silent --show-error https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2 | \
|
||||
tar -xj && \
|
||||
cd valgrind-3.15.0 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf valgrind-3.15.0
|
||||
|
||||
FROM valgrind AS configure
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod a+x /usr/local/bin/entrypoint.sh
|
||||
RUN mkdir /var/run/sshd
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
@@ -2,66 +2,74 @@ resources:
|
||||
- repo: self
|
||||
|
||||
jobs:
|
||||
- job: linux_amd64_trusty_gcc_openssl
|
||||
displayName: 'Linux (amd64; Trusty; GCC; OpenSSL)'
|
||||
- job: linux_amd64_xenial_gcc_openssl
|
||||
displayName: 'Linux (amd64; Xenial; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_trusty_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Trusty; GCC; mbedTLS)'
|
||||
- job: linux_amd64_xenial_gcc_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; GCC; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_trusty_clang_openssl
|
||||
displayName: 'Linux (amd64; Trusty; Clang; OpenSSL)'
|
||||
- job: linux_amd64_xenial_clang_openssl
|
||||
displayName: 'Linux (amd64; Xenial; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_amd64_trusty_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Trusty; Clang; mbedTLS)'
|
||||
- job: linux_amd64_xenial_clang_mbedtls
|
||||
displayName: 'Linux (amd64; Xenial; Clang; mbedTLS)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
imageName: 'libgit2/trusty-amd64:latest'
|
||||
docker:
|
||||
image: xenial
|
||||
base: ubuntu:xenial
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: macos
|
||||
displayName: 'macOS'
|
||||
displayName: 'macOS (amd64; 10.15)'
|
||||
pool:
|
||||
vmImage: 'macOS 10.13'
|
||||
vmImage: 'macOS-10.15'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh'
|
||||
displayName: Setup
|
||||
@@ -71,37 +79,40 @@ jobs:
|
||||
TMPDIR: $(Agent.TempDirectory)
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
CMAKE_GENERATOR: Ninja
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks
|
||||
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_vs_amd64
|
||||
displayName: 'Windows (amd64; Visual Studio)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
CMAKE_GENERATOR: Visual Studio 15 2017
|
||||
CMAKE_OPTIONS: -A x64 -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_vs_x86
|
||||
displayName: 'Windows (x86; Visual Studio)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- template: bash.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
CMAKE_GENERATOR: Visual Studio 12 2013
|
||||
CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
CMAKE_GENERATOR: Visual Studio 15 2017
|
||||
CMAKE_OPTIONS: -A Win32 -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS
|
||||
RUN_INVASIVE_TESTS: true
|
||||
SKIP_SSH_TESTS: true
|
||||
|
||||
- job: windows_mingw_amd64
|
||||
displayName: 'Windows (amd64; MinGW)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
@@ -119,7 +130,8 @@ jobs:
|
||||
|
||||
- job: windows_mingw_x86
|
||||
displayName: 'Windows (x86; MinGW)'
|
||||
pool: Hosted
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
steps:
|
||||
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
|
||||
displayName: Setup
|
||||
@@ -139,45 +151,51 @@ jobs:
|
||||
- job: linux_x86_bionic_gcc_openssl
|
||||
displayName: 'Linux (x86; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
imageName: 'libgit2/bionic-x86:latest'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:x86-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_x86_bionic_clang_openssl
|
||||
displayName: 'Linux (x86; Bionic; Clang; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
imageName: 'libgit2/bionic-x86:latest'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:x86-bionic
|
||||
environmentVariables: |
|
||||
CC=clang
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind
|
||||
RUN_INVASIVE_TESTS=true
|
||||
|
||||
- job: linux_arm32_bionic_gcc_openssl
|
||||
displayName: 'Linux (arm32; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
imageName: 'libgit2/bionic-arm32:latest'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:armhf-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS=true
|
||||
SKIP_PROXY_TESTS=true
|
||||
@@ -185,15 +203,17 @@ jobs:
|
||||
- job: linux_arm64_bionic_gcc_openssl
|
||||
displayName: 'Linux (arm64; Bionic; GCC; OpenSSL)'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: docker.yml
|
||||
parameters:
|
||||
qemu: 'true'
|
||||
imageName: 'libgit2/bionic-arm64:latest'
|
||||
docker:
|
||||
image: bionic
|
||||
base: multiarch/ubuntu-core:arm64-bionic
|
||||
environmentVariables: |
|
||||
CC=gcc
|
||||
CMAKE_GENERATOR=Unix Makefiles
|
||||
CMAKE_GENERATOR=Ninja
|
||||
CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON
|
||||
RUN_INVASIVE_TESTS=true
|
||||
SKIP_PROXY_TESTS=true
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
|
||||
if [ -z "$SKIP_APT" ]; then
|
||||
apt-get update
|
||||
apt-get -y install build-essential pkg-config clang cmake openssl libssl-dev libssh2-1-dev libcurl4-gnutls-dev openssh-server
|
||||
fi
|
||||
|
||||
mkdir -p /var/run/sshd
|
||||
|
||||
if [ "$MBEDTLS" ]; then
|
||||
MBEDTLS_DIR=${MBEDTLS_DIR:-$(mktemp -d ${TMPDIR}/mbedtls.XXXXXXXX)}
|
||||
|
||||
git clone --depth 10 --single-branch --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git ${MBEDTLS_DIR}
|
||||
cd ${MBEDTLS_DIR}
|
||||
|
||||
CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON .
|
||||
cmake --build .
|
||||
|
||||
if [ -z "$SKIP_MBEDTLS_INSTALL" ]; then
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
@@ -6,6 +6,11 @@ if [ -n "$SKIP_TESTS" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Windows doesn't run the NTLM tests properly (yet)
|
||||
if [[ "$(uname -s)" == MINGW* ]]; then
|
||||
SKIP_NTLM_TESTS=1
|
||||
fi
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
|
||||
BUILD_DIR=$(pwd)
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
@@ -49,6 +54,7 @@ run_test() {
|
||||
CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" ctest -V -R "^${1}$" || RETURN_CODE=$? && true
|
||||
|
||||
if [ "$RETURN_CODE" -eq 0 ]; then
|
||||
FAILED=0
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -75,10 +81,11 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
|
||||
git init --bare "${GITDAEMON_DIR}/test.git"
|
||||
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GITDAEMON_DIR}" "${GITDAEMON_DIR}" 2>/dev/null &
|
||||
GITDAEMON_PID=$!
|
||||
disown $GITDAEMON_PID
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_PROXY_TESTS" ]; then
|
||||
curl -L https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
|
||||
curl --location --silent --show-error https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
|
||||
|
||||
echo ""
|
||||
echo "Starting HTTP proxy (Basic)..."
|
||||
@@ -89,6 +96,16 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
|
||||
java -jar poxyproxy.jar --address 127.0.0.1 --port 8090 --credentials foo:bar --auth-type ntlm --quiet &
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NTLM_TESTS" ]; then
|
||||
curl --location --silent --show-error https://github.com/ethomson/poxygit/releases/download/v0.4.0/poxygit-0.4.0.jar >poxygit.jar
|
||||
|
||||
echo ""
|
||||
echo "Starting HTTP server..."
|
||||
NTLM_DIR=`mktemp -d ${TMPDIR}/ntlm.XXXXXXXX`
|
||||
git init --bare "${NTLM_DIR}/test.git"
|
||||
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${NTLM_DIR}" &
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_SSH_TESTS" ]; then
|
||||
echo "Starting ssh daemon..."
|
||||
HOME=`mktemp -d ${TMPDIR}/home.XXXXXXXX`
|
||||
@@ -201,12 +218,73 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
|
||||
export GITTEST_REMOTE_PROXY_HOST="localhost:8090"
|
||||
export GITTEST_REMOTE_PROXY_USER="foo"
|
||||
export GITTEST_REMOTE_PROXY_PASS="bar"
|
||||
export GITTEST_FLAKY_RETRY=5
|
||||
run_test proxy
|
||||
unset GITTEST_FLAKY_RETRY
|
||||
unset GITTEST_REMOTE_PROXY_HOST
|
||||
unset GITTEST_REMOTE_PROXY_USER
|
||||
unset GITTEST_REMOTE_PROXY_PASS
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NTLM_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running NTLM tests (IIS emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
|
||||
echo ""
|
||||
echo "Running NTLM tests (Apache emulation)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="http://localhost:9000/broken-ntlm/test.git"
|
||||
export GITTEST_REMOTE_USER="foo"
|
||||
export GITTEST_REMOTE_PASS="baz"
|
||||
run_test auth_clone_and_push
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_USER
|
||||
unset GITTEST_REMOTE_PASS
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
|
||||
echo ""
|
||||
echo "Running SPNEGO tests"
|
||||
echo ""
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
KINIT_FLAGS="--password-file=STDIN"
|
||||
fi
|
||||
|
||||
echo $GITTEST_NEGOTIATE_PASSWORD | kinit $KINIT_FLAGS test@LIBGIT2.ORG
|
||||
klist -5f
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
|
||||
echo ""
|
||||
echo "Running SPNEGO tests (expect/continue)"
|
||||
echo ""
|
||||
|
||||
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
|
||||
export GITTEST_REMOTE_DEFAULT="true"
|
||||
export GITTEST_REMOTE_EXPECTCONTINUE="true"
|
||||
run_test auth_clone
|
||||
unset GITTEST_REMOTE_URL
|
||||
unset GITTEST_REMOTE_DEFAULT
|
||||
unset GITTEST_REMOTE_EXPECTCONTINUE
|
||||
|
||||
kdestroy -A
|
||||
fi
|
||||
|
||||
if [ -z "$SKIP_SSH_TESTS" ]; then
|
||||
echo ""
|
||||
echo "Running ssh tests"
|
||||
|
||||
@@ -10,14 +10,14 @@ FIND_PATH(COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h)
|
||||
FIND_LIBRARY(COREFOUNDATION_LIBRARIES NAMES CoreFoundation)
|
||||
IF (COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES)
|
||||
IF (NOT CoreFoundation_FIND_QUIETLY)
|
||||
MESSAGE("-- Found CoreFoundation ${COREFOUNDATION_LIBRARIES}")
|
||||
MESSAGE(STATUS "Found CoreFoundation ${COREFOUNDATION_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(COREFOUNDATION_FOUND TRUE)
|
||||
SET(COREFOUNDATION_LDFLAGS "-framework CoreFoundation")
|
||||
ENDIF ()
|
||||
|
||||
IF (CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND)
|
||||
MESSAGE(FATAL "-- CoreFoundation not found")
|
||||
MESSAGE(FATAL_ERROR "CoreFoundation not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
|
||||
28
godot-git-plugin/thirdparty/libgit2/cmake/Modules/FindGSSFramework.cmake
vendored
Normal file
28
godot-git-plugin/thirdparty/libgit2/cmake/Modules/FindGSSFramework.cmake
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Find GSS.framework
|
||||
# This will define :
|
||||
#
|
||||
# GSSFRAMEWORK_FOUND
|
||||
# GSSFRAMEWORK_INCLUDE_DIR
|
||||
# GSSFRAMEWORK_LIBRARIES
|
||||
# GSSFRAMEWORK_LDFLAGS
|
||||
#
|
||||
|
||||
FIND_PATH(GSSFRAMEWORK_INCLUDE_DIR NAMES GSS.h)
|
||||
FIND_LIBRARY(GSSFRAMEWORK_LIBRARIES NAMES GSS)
|
||||
IF (GSSFRAMEWORK_INCLUDE_DIR AND GSSFRAMEWORK_LIBRARIES)
|
||||
IF (NOT CoreFoundation_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found GSS.framework ${GSSFRAMEWORK_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(GSSFRAMEWORK_FOUND TRUE)
|
||||
SET(GSSFRAMEWORK_LDFLAGS "-framework GSS")
|
||||
ENDIF ()
|
||||
|
||||
IF (GSS_FIND_REQUIRED AND NOT GSSFRAMEWORK_FOUND)
|
||||
MESSAGE(FATAL_ERROR "CoreFoundation not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
GSSFRAMEWORK_INCLUDE_DIR
|
||||
GSSFRAMEWORK_LIBRARIES
|
||||
GSSFRAMEWORK_LDFLAGS
|
||||
)
|
||||
@@ -20,15 +20,14 @@ FIND_PATH(PCRE2_INCLUDE_DIR NAMES pcre2posix.h)
|
||||
|
||||
# Look for the library.
|
||||
FIND_LIBRARY(PCRE2_LIBRARY NAMES pcre2-8)
|
||||
FIND_LIBRARY(PCRE2_POSIX_LIBRARY NAMES pcre2-posix)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set PCRE2_FOUND to TRUE if all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_POSIX_LIBRARY PCRE2_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
IF(PCRE2_FOUND)
|
||||
SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY} ${PCRE2_POSIX_LIBRARY})
|
||||
SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
|
||||
SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
|
||||
ELSE(PCRE2_FOUND)
|
||||
SET(PCRE2_LIBRARIES)
|
||||
|
||||
@@ -11,7 +11,7 @@ FIND_PATH(SECURITY_INCLUDE_DIR NAMES Security/Security.h)
|
||||
FIND_LIBRARY(SECURITY_LIBRARIES NAMES Security)
|
||||
IF (SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES)
|
||||
IF (NOT Security_FIND_QUIETLY)
|
||||
MESSAGE("-- Found Security ${SECURITY_LIBRARIES}")
|
||||
MESSAGE(STATUS "Found Security ${SECURITY_LIBRARIES}")
|
||||
ENDIF()
|
||||
SET(SECURITY_FOUND TRUE)
|
||||
SET(SECURITY_LDFLAGS "-framework Security")
|
||||
@@ -19,7 +19,7 @@ IF (SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES)
|
||||
ENDIF ()
|
||||
|
||||
IF (Security_FIND_REQUIRED AND NOT SECURITY_FOUND)
|
||||
MESSAGE(FATAL "-- Security not found")
|
||||
MESSAGE(FATAL_ERROR "Security not found")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
|
||||
77
godot-git-plugin/thirdparty/libgit2/cmake/Modules/PkgBuildConfig.cmake
vendored
Normal file
77
godot-git-plugin/thirdparty/libgit2/cmake/Modules/PkgBuildConfig.cmake
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# pkg-config file generation
|
||||
#
|
||||
|
||||
function(pkg_build_config)
|
||||
set(options)
|
||||
set(oneValueArgs NAME DESCRIPTION VERSION FILENAME LIBS_SELF)
|
||||
set(multiValueArgs LIBS PRIVATE_LIBS REQUIRES CFLAGS)
|
||||
|
||||
cmake_parse_arguments(PKGCONFIG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME AND DEFINED PKGCONFIG_NAME)
|
||||
set(PKGCONFIG_FILENAME ${PKGCONFIG_NAME})
|
||||
endif()
|
||||
if (NOT DEFINED PKGCONFIG_FILENAME)
|
||||
message(FATAL_ERROR "Missing FILENAME argument")
|
||||
endif()
|
||||
set(PKGCONFIG_FILE "${PROJECT_BINARY_DIR}/${PKGCONFIG_FILENAME}.pc")
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_DESCRIPTION)
|
||||
message(FATAL_ERROR "Missing DESCRIPTION argument")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PKGCONFIG_VERSION)
|
||||
message(FATAL_ERROR "Missing VERSION argument")
|
||||
endif()
|
||||
|
||||
# Write .pc "header"
|
||||
file(WRITE "${PKGCONFIG_FILE}"
|
||||
"prefix=\"${CMAKE_INSTALL_PREFIX}\"\n"
|
||||
"libdir=\"${CMAKE_INSTALL_FULL_LIBDIR}\"\n"
|
||||
"includedir=\"${CMAKE_INSTALL_FULL_INCLUDEDIR}\"\n"
|
||||
"\n"
|
||||
"Name: ${PKGCONFIG_NAME}\n"
|
||||
"Description: ${PKGCONFIG_DESCRIPTION}\n"
|
||||
"Version: ${PKGCONFIG_VERSION}\n"
|
||||
)
|
||||
|
||||
# Prepare Libs
|
||||
if(NOT DEFINED PKGCONFIG_LIBS_SELF)
|
||||
set(PKGCONFIG_LIBS_SELF "${PKGCONFIG_FILE}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PKGCONFIG_LIBS)
|
||||
set(PKGCONFIG_LIBS "-l${PKGCONFIG_LIBS_SELF}")
|
||||
else()
|
||||
list(INSERT PKGCONFIG_LIBS 0 "-l${PKGCONFIG_LIBS_SELF}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_LIBS "${PKGCONFIG_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs: -L\${libdir} ${PKGCONFIG_LIBS}\n")
|
||||
|
||||
# Prepare Libs.private
|
||||
if(DEFINED PKGCONFIG_PRIVATE_LIBS)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_PRIVATE_LIBS)
|
||||
string(REPLACE ";" " " PKGCONFIG_PRIVATE_LIBS "${PKGCONFIG_PRIVATE_LIBS}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Libs.private: ${PKGCONFIG_PRIVATE_LIBS}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Requires.private
|
||||
if(DEFINED PKGCONFIG_REQUIRES)
|
||||
list(REMOVE_DUPLICATES PKGCONFIG_REQUIRES)
|
||||
string(REPLACE ";" " " PKGCONFIG_REQUIRES "${PKGCONFIG_REQUIRES}")
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Requires.private: ${PKGCONFIG_REQUIRES}\n")
|
||||
endif()
|
||||
|
||||
# Prepare Cflags
|
||||
if(DEFINED PKGCONFIG_CFLAGS)
|
||||
string(REPLACE ";" " " PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS}")
|
||||
else()
|
||||
set(PKGCONFIG_CFLAGS "")
|
||||
endif()
|
||||
file(APPEND "${PKGCONFIG_FILE}" "Cflags: -I\${includedir} ${PKGCONFIG_CFLAGS}\n")
|
||||
|
||||
# Install .pc file
|
||||
install(FILES "${PKGCONFIG_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endfunction()
|
||||
20
godot-git-plugin/thirdparty/libgit2/cmake/Modules/SanitizeBool.cmake
vendored
Normal file
20
godot-git-plugin/thirdparty/libgit2/cmake/Modules/SanitizeBool.cmake
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
FUNCTION(SanitizeBool VAR)
|
||||
STRING(TOLOWER "${${VAR}}" VALUE)
|
||||
IF(VALUE STREQUAL "on")
|
||||
SET(${VAR} "ON" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "yes")
|
||||
SET(${VAR} "ON" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "true")
|
||||
SET(${VAR} "ON" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "1")
|
||||
SET(${VAR} "ON" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "off")
|
||||
SET(${VAR} "OFF" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "no")
|
||||
SET(${VAR} "OFF" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "false")
|
||||
SET(${VAR} "OFF" PARENT_SCOPE)
|
||||
ELSEIF(VALUE STREQUAL "0")
|
||||
SET(${VAR} "OFF" PARENT_SCOPE)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
56
godot-git-plugin/thirdparty/libgit2/cmake/Modules/SelectGSSAPI.cmake
vendored
Normal file
56
godot-git-plugin/thirdparty/libgit2/cmake/Modules/SelectGSSAPI.cmake
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Select the backend to use
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
|
||||
INCLUDE(SanitizeBool)
|
||||
|
||||
FIND_PACKAGE(GSSAPI)
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
INCLUDE(FindGSSFramework)
|
||||
ENDIF()
|
||||
|
||||
# Auto-select GSS backend
|
||||
SanitizeBool(USE_GSSAPI)
|
||||
IF (USE_GSSAPI STREQUAL ON)
|
||||
IF (GSSFRAMEWORK_FOUND)
|
||||
SET(GSS_BACKEND "GSS.framework")
|
||||
ELSEIF(GSSAPI_FOUND)
|
||||
SET(GSS_BACKEND "gssapi")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to autodetect a usable GSS backend."
|
||||
"Please pass the backend name explicitly (-DUSE_GSS=backend)")
|
||||
ENDIF()
|
||||
ELSEIF(USE_GSSAPI)
|
||||
# Backend was explicitly set
|
||||
SET(GSS_BACKEND ${USE_GSSAPI})
|
||||
ELSE()
|
||||
SET(GSS_BACKEND NO)
|
||||
ENDIF()
|
||||
|
||||
IF(GSS_BACKEND)
|
||||
# Check that we can find what's required for the selected backend
|
||||
IF (GSS_BACKEND STREQUAL "GSS.framework")
|
||||
IF (NOT GSSFRAMEWORK_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBGIT2_LIBS ${GSSFRAMEWORK_LIBRARIES})
|
||||
|
||||
SET(GIT_GSSFRAMEWORK 1)
|
||||
ADD_FEATURE_INFO(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${GSS_BACKEND})")
|
||||
ELSEIF (GSS_BACKEND STREQUAL "gssapi")
|
||||
IF (NOT GSSAPI_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES})
|
||||
|
||||
SET(GIT_GSSAPI 1)
|
||||
ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${GSS_BACKEND})")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Asked for backend ${GSS_BACKEND} but it wasn't found")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(GIT_GSSAPI 0)
|
||||
ADD_FEATURE_INFO(SPNEGO NO "SPNEGO authentication support")
|
||||
ENDIF()
|
||||
@@ -1,5 +1,7 @@
|
||||
# Select the backend to use
|
||||
|
||||
INCLUDE(SanitizeBool)
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
FIND_PACKAGE(mbedTLS)
|
||||
@@ -9,13 +11,13 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
ENDIF()
|
||||
|
||||
# Auto-select TLS backend
|
||||
SanitizeBool(USE_HTTPS)
|
||||
IF (USE_HTTPS STREQUAL ON)
|
||||
message(ON)
|
||||
IF (SECURITY_FOUND)
|
||||
IF (SECURITY_HAS_SSLCREATECONTEXT)
|
||||
SET(HTTPS_BACKEND "SecureTransport")
|
||||
ELSE()
|
||||
MESSAGE("-- Security framework is too old, falling back to OpenSSL")
|
||||
MESSAGE(STATUS "Security framework is too old, falling back to OpenSSL")
|
||||
SET(HTTPS_BACKEND "OpenSSL")
|
||||
ENDIF()
|
||||
ELSEIF (WINHTTP)
|
||||
@@ -29,7 +31,6 @@ IF (USE_HTTPS STREQUAL ON)
|
||||
"Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
|
||||
ENDIF()
|
||||
ELSEIF(USE_HTTPS)
|
||||
message(expl)
|
||||
# HTTPS backend was explicitly set
|
||||
SET(HTTPS_BACKEND ${USE_HTTPS})
|
||||
ELSE()
|
||||
@@ -51,7 +52,7 @@ IF(HTTPS_BACKEND)
|
||||
|
||||
SET(GIT_SECURE_TRANSPORT 1)
|
||||
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${SECURITY_INCLUDE_DIR})
|
||||
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES} ${SECURITY_LIBRARIES})
|
||||
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
|
||||
IF (NOT OPENSSL_FOUND)
|
||||
@@ -69,7 +70,7 @@ IF(HTTPS_BACKEND)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CERT_LOCATION)
|
||||
MESSAGE("Auto-detecting default certificates location")
|
||||
MESSAGE(STATUS "Auto-detecting default certificates location")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
# Check for an Homebrew installation
|
||||
SET(OPENSSL_CMD "/usr/local/opt/openssl/bin/openssl")
|
||||
@@ -93,7 +94,7 @@ IF(HTTPS_BACKEND)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
MESSAGE("Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION")
|
||||
MESSAGE(FATAL_ERROR "Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
# Select a hash backend
|
||||
|
||||
INCLUDE(SanitizeBool)
|
||||
|
||||
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
|
||||
|
||||
SanitizeBool(USE_SHA1)
|
||||
IF(USE_SHA1 STREQUAL ON OR USE_SHA1 STREQUAL "CollisionDetection")
|
||||
SET(SHA1_BACKEND "CollisionDetection")
|
||||
ELSEIF(USE_SHA1 STREQUAL "HTTPS")
|
||||
message("Checking HTTPS backend… ${HTTPS_BACKEND}")
|
||||
message(STATUS "Checking HTTPS backend… ${HTTPS_BACKEND}")
|
||||
IF(HTTPS_BACKEND STREQUAL "SecureTransport")
|
||||
SET(SHA1_BACKEND "CommonCrypto")
|
||||
ELSEIF(HTTPS_BACKEND STREQUAL "WinHTTP")
|
||||
|
||||
@@ -7,8 +7,11 @@ DISABLE_WARNINGS(implicit-fallthrough)
|
||||
IF (HTTPS_BACKEND STREQUAL "SecureTransport")
|
||||
ADD_DEFINITIONS(-DCRYPT_COMMONCRYPTO)
|
||||
SET(SRC_NTLMCLIENT_CRYPTO "crypt_commoncrypto.c")
|
||||
# CC_MD4 has been deprecated in macOS 10.15.
|
||||
SET_SOURCE_FILES_PROPERTIES("crypt_commoncrypto.c" COMPILE_FLAGS "-Wno-deprecated")
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
|
||||
ADD_DEFINITIONS(-DCRYPT_OPENSSL)
|
||||
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
||||
SET(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c")
|
||||
ELSEIF (HTTPS_BACKEND STREQUAL "mbedTLS")
|
||||
ADD_DEFINITIONS(-DCRYPT_MBEDTLS)
|
||||
|
||||
@@ -22,8 +22,30 @@
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
/* See man page endian(3) */
|
||||
# include <endian.h>
|
||||
# define htonll htobe64
|
||||
#elif defined(__OpenBSD__)
|
||||
/* See man page htobe64(3) */
|
||||
# include <endian.h>
|
||||
# define htonll htobe64
|
||||
#elif defined(__FreeBSD__)
|
||||
/* See man page bwaps64(9) */
|
||||
# include <sys/endian.h>
|
||||
# define htonll htobe64
|
||||
#elif defined(sun) || defined(__sun)
|
||||
/* See man page byteorder(3SOCKET) */
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <inttypes.h>
|
||||
|
||||
# if !defined(htonll)
|
||||
# if defined(_BIG_ENDIAN)
|
||||
# define htonll(x) (x)
|
||||
# else
|
||||
# define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((uint64_t)(x) >> 32))
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
|
||||
@@ -587,7 +587,9 @@ int ntlm_client_negotiate(
|
||||
size_t *out_len,
|
||||
ntlm_client *ntlm)
|
||||
{
|
||||
size_t hostname_len, hostname_offset, domain_len, domain_offset;
|
||||
size_t hostname_len, domain_len;
|
||||
size_t domain_offset = 0;
|
||||
size_t hostname_offset = 0;
|
||||
uint32_t flags = 0;
|
||||
|
||||
assert(out && out_len && ntlm);
|
||||
|
||||
@@ -1,5 +1,405 @@
|
||||
v0.28 + 1
|
||||
---------
|
||||
v1.0
|
||||
----
|
||||
|
||||
This is release v1.0 "Luftschloss", which is the first stabe release of
|
||||
libgit2. The API will stay compatible across all releases of the same major
|
||||
version. This release includes bugfixes only and supersedes v0.99, which will
|
||||
stop being maintained. Both v0.27 and v0.28 stay supported in accordance with
|
||||
our release policy.
|
||||
|
||||
### Changes or improvements
|
||||
|
||||
- CMake was converted to make use of the GNUInstallDirs module for both our
|
||||
pkgconfig and install targets in favor of our custom build options
|
||||
`BIN_INSTALL_DIR`, `LIB_INSTALL_DIR` and `INCLUDE_INSTALL_DIR`. Instead, you
|
||||
can now use CMakes standard variables `CMAKE_INSTALL_BINDIR`,
|
||||
`CMAKE_INSTALL_LIBDIR` and `CMAKE_INSTALL_INCLUDEDIR`.
|
||||
|
||||
- Some CMake build options accepted either a specific value or a boolean value
|
||||
to disable the option altogether or use automatic detection. We only accepted
|
||||
"ON" or "OFF", but none of the other values CMake recognizes as boolean. This
|
||||
was aligned with CMake's understanding of booleans.
|
||||
|
||||
- The installed pkgconfig file contained incorrect values for both `libdir` and
|
||||
`includedir` variables.
|
||||
|
||||
- If using pcre2 for regular expressions, then we incorrectly added "pcre2"
|
||||
instead of "pcre2-8" to our pkgconfig dependencies, which was corrected.
|
||||
|
||||
- Fixed building the bundled ntlmclient dependency on FreeBSD, OpenBSD and
|
||||
SunOS.
|
||||
|
||||
- When writing symlinks on Windows, we incorrectly handled relative symlink
|
||||
targets, which was corrected.
|
||||
|
||||
- When using the HTTP protocol via macOS' SecureTransport implementation, reads
|
||||
could stall at the end of the session and only continue after a timeout of 60
|
||||
seconds was reached.
|
||||
|
||||
- The filesystem-based reference callback didn't corectly initialize the backend
|
||||
version.
|
||||
|
||||
- A segmentation fault was fixed when calling `git_blame_buffer()` for files
|
||||
that were modified and added to the index.
|
||||
|
||||
- A backwards-incompatible change was introduced when we moved some structures
|
||||
from "git2/credentials.h" into "git2/sys/credentials.h". This was fixed in the
|
||||
case where you do not use hard deprecation.
|
||||
|
||||
- Improved error handling in various places.
|
||||
|
||||
|
||||
v0.99
|
||||
-----
|
||||
|
||||
This is v0.99 "Torschlusspanik". This will be the last minor release
|
||||
before libgit2 v1.0. We expect to only respond to bugs in this release,
|
||||
to stabilize it for next major release.
|
||||
|
||||
It contains significant refactorings, but is expected to be API-compatible
|
||||
with v0.28.0.
|
||||
|
||||
### Changes or improvements
|
||||
|
||||
* When fetching from an anonymous remote using a URL with authentication
|
||||
information provided in the URL (eg `https://foo:bar@example.com/repo`),
|
||||
we would erroneously include the literal URL in the FETCH_HEAD file.
|
||||
We now remove that to match git's behavior.
|
||||
|
||||
* Some credential structures, enums and values have been renamed:
|
||||
`git_cred` is now `git_credential`. `git_credtype_t` is now
|
||||
`git_credential_t`. Functions and types beginning with
|
||||
`git_cred_` now begin with `git_credential`, and constants beginning
|
||||
with `GIT_CREDTYPE` now begin with `GIT_CREDENTIAL`. The former names
|
||||
are deprecated.
|
||||
|
||||
* Several function signatures have been changed to return an `int` to
|
||||
indicate error conditions. We encourage you to check them for errors
|
||||
in the standard way.
|
||||
|
||||
* `git_attr_cache_flush`
|
||||
* `git_error_set_str`
|
||||
* `git_index_name_clear`
|
||||
* `git_index_reuc_clear`
|
||||
* `git_libgit2_version`
|
||||
* `git_mempack_reset`
|
||||
* `git_oid_cpy`
|
||||
* `git_oid_fmt`
|
||||
* `git_oid_fromraw`
|
||||
* `git_oid_nfmt`
|
||||
* `git_oid_pathfmt`
|
||||
* `git_remote_stop`
|
||||
* `git_remote_disconnect`
|
||||
* `git_repository__cleanup`
|
||||
* `git_repository_set_config`
|
||||
* `git_repository_set_index`
|
||||
* `git_repository_set_odb`
|
||||
* `git_repository_set_refdb`
|
||||
* `git_revwalk_reset`
|
||||
* `git_revwalk_simplify_first_parent`
|
||||
* `git_revwalk_sorting`
|
||||
* `git_treebuilder_clear`
|
||||
* `git_treebuilder_filter`
|
||||
|
||||
* The NTLM and Negotiate authentication mechanisms are now supported when
|
||||
talking to git implementations hosted on Apache or nginx servers.
|
||||
|
||||
* The `HEAD` symbolic reference can no longer be deleted.
|
||||
|
||||
* `git_merge_driver_source_repo` no longer returns a `const git_repository *`,
|
||||
it now returns a non-`const` `git_repository *`.
|
||||
|
||||
* Relative symbolic links are now supported on Windows when `core.symlinks`
|
||||
is enabled.
|
||||
|
||||
* Servers that provide query parameters with a redirect are now supported.
|
||||
|
||||
* `git_submodule_sync` will now resolve relative URLs.
|
||||
|
||||
* When creating git endpoint URLs, double-slashes are no longer used when
|
||||
the given git URL has a trailing slash.
|
||||
|
||||
* On Windows, a `DllMain` function is no longer included and thread-local
|
||||
storage has moved to fiber-local storage in order to prevent race
|
||||
conditions during shutdown.
|
||||
|
||||
* The tracing mechanism (`GIT_TRACE`) is now enabled by default and does
|
||||
not need to be explicitly enabled in CMake.
|
||||
|
||||
* The size of Git objects is now represented by `git_object_size_t`
|
||||
instead of `off_t`.
|
||||
|
||||
* Binary patches without data can now be parsed.
|
||||
|
||||
* A configuration snapshot can now be created from another configuration
|
||||
snapshot, not just a "true" configuration object.
|
||||
|
||||
* The `git_commit_with_signature` API will now ensure that referenced
|
||||
objects exist in the object database.
|
||||
|
||||
* Stash messages containing newlines will now be replaced with spaces;
|
||||
they will no longer be (erroneously) written to the repository.
|
||||
|
||||
* `git_commit_create_with_signature` now verifies the commit information
|
||||
to ensure that it points to a valid tree and valid parents.
|
||||
|
||||
* `git_apply` has an option `GIT_APPLY_CHECK` that will only do a dry-run.
|
||||
The index and working directory will remain unmodified, and application
|
||||
will report if it would have worked.
|
||||
|
||||
* Patches produced by Mercurial (those that lack some git extended headers)
|
||||
can now be parsed and applied.
|
||||
|
||||
* Reference locks are obeyed correctly on POSIX platforms, instead of
|
||||
being removed.
|
||||
|
||||
* Patches with empty new files can now be read and applied.
|
||||
|
||||
* `git_apply_to_tree` can now correctly apply patches that add new files.
|
||||
|
||||
* The program data configuration on Windows (`C:\ProgramData\Git\config`)
|
||||
must be owned by an administrator, a system account or the current user
|
||||
to be read.
|
||||
|
||||
* `git_blob_filtered_content` is now deprecated in favor of `git_blob_filter`.
|
||||
|
||||
* Configuration files can now be included conditionally using the
|
||||
`onbranch` conditional.
|
||||
|
||||
* Checkout can now properly create and remove symbolic links to directories
|
||||
on Windows.
|
||||
|
||||
* Stash no longer recomputes trees when committing a worktree, for
|
||||
improved performance.
|
||||
|
||||
* Repository templates can now include a `HEAD` file to default the
|
||||
initial default branch.
|
||||
|
||||
* Some configuration structures, enums and values have been renamed:
|
||||
`git_cvar_map` is now `git_configmap`, `git_cvar_t` is now
|
||||
`git_configmap_t`, `GIT_CVAR_FALSE` is now `GIT_CONFIGMAP_FALSE`,
|
||||
`GIT_CVAR_TRUE` is now `GIT_CONFIGMAP_TRUE`, `GIT_CVAR_INT32` is now
|
||||
`GIT_CONFIGMAP_INT32`, and `GIT_CVAR_STRING` is now `GIT_CONFIGMAP_STRING`.
|
||||
The former names are deprecated.
|
||||
|
||||
* Repositories can now be created at the root of a Windows drive.
|
||||
|
||||
* Configuration lookups are now more efficiently cached.
|
||||
|
||||
* `git_commit_create_with_signature` now supports a `NULL` signature,
|
||||
which will create a commit without adding a signature.
|
||||
|
||||
* When a repository lacks an `info` "common directory", we will no
|
||||
longer erroneously return `GIT_ENOTFOUND` for all attribute lookups.
|
||||
|
||||
* Several attribute macros have been renamed: `GIT_ATTR_TRUE` is now
|
||||
`GIT_ATTR_IS_TRUE`, `GIT_ATTR_FALSE` is now `GIT_ATTR_IS_FALSE`,
|
||||
`GIT_ATTR_UNSPECIFIED` is now `GIT_ATTR_IS_UNSPECIFIED`. The
|
||||
attribute enum `git_attr_t` is now `git_attr_value_t` and its
|
||||
values have been renamed: `GIT_ATTR_UNSPECIFIED_T` is now
|
||||
`GIT_ATTR_VALUE_UNSPECIFIED`, `GIT_ATTR_TRUE_T` is now
|
||||
`GIT_ATTR_VALUE_TRUE`, `GIT_ATTR_FALSE_T` is now `GIT_ATTR_VALUE_FALSE`,
|
||||
and `GIT_ATTR_VALUE_T` is now `GIT_ATTR_VALUE_STRING`. The
|
||||
former names are deprecated.
|
||||
|
||||
* `git_object__size` is now `git_object_size`. The former name is
|
||||
deprecated.
|
||||
|
||||
* `git_tag_create_frombuffer` is now `git_tag_create_from_buffer`. The
|
||||
former name is deprecated.
|
||||
|
||||
* Several blob creation functions have been renamed:
|
||||
`git_blob_create_frombuffer` is now named `git_blob_create_from_buffer`,
|
||||
`git_blob_create_fromdisk` is now named `git_blob_create_from_disk`,
|
||||
`git_blob_create_fromworkdir` is now named `git_blob_create_from_workdir`,
|
||||
`git_blob_create_fromstream` is now named `git_blob_create_from_stream`,
|
||||
and `git_blob_create_fromstream_commit` is now named
|
||||
`git_blob_create_from_stream_commit`. The former names are deprecated.
|
||||
|
||||
* The function `git_oid_iszero` is now named `git_oid_is_zero`. The
|
||||
former name is deprecated.
|
||||
|
||||
* Pattern matching is now done using `wildmatch` instead of `fnmatch`
|
||||
for compatibility with git.
|
||||
|
||||
* The option initialization functions suffixed by `init_options` are now
|
||||
suffixed with `options_init`. (For example, `git_checkout_init_options`
|
||||
is now `git_checkout_options_init`.) The former names are deprecated.
|
||||
|
||||
* NTLM2 authentication is now supported on non-Windows platforms.
|
||||
|
||||
* The `git_cred_sign_callback` callback is now named `git_cred_sign_cb`.
|
||||
The `git_cred_ssh_interactive_callback` callback is now named
|
||||
`git_cred_ssh_interactive_cb`.
|
||||
|
||||
* Ignore files now:
|
||||
|
||||
* honor escaped trailing whitespace.
|
||||
* do not incorrectly negate sibling paths of a negated pattern.
|
||||
* honor rules that stop ignoring files after a wildcard
|
||||
|
||||
* Attribute files now:
|
||||
|
||||
* honor leading and trailing whitespace.
|
||||
* treat paths beginning with `\` as absolute only on Windows.
|
||||
* properly handle escaped characters.
|
||||
* stop reading macros defined in subdirectories
|
||||
|
||||
* The C locale is now correctly used when parsing regular expressions.
|
||||
|
||||
* The system PCRE2 or PCRE regular expression libraries are now used
|
||||
when `regcomp_l` is not available on the system. If none of these
|
||||
are available on the system, an included version of PCRE is used.
|
||||
|
||||
* Wildcards in reference specifications are now supported beyond simply
|
||||
a bare wildcard (`*`) for compatibility with git.
|
||||
|
||||
* When `git_ignore_path_is_ignored` is provided a path with a trailing
|
||||
slash (eg, `dir/`), it will now treat it as a directory for the
|
||||
purposes of ignore matching.
|
||||
|
||||
* Patches that add or remove a file with a space in the path can now
|
||||
be correctly parsed.
|
||||
|
||||
* The `git_remote_completion_type` type is now `git_remote_completion_t`.
|
||||
The former name is deprecated.
|
||||
|
||||
* The `git_odb_backend_malloc` is now `git_odb_backend_data_alloc`. The
|
||||
former name is deprecated.
|
||||
|
||||
* The `git_transfer_progress_cb` callback is now `git_indexer_progress_cb`
|
||||
and the `git_transfer_progress` structure is now `git_indexer_progress`.
|
||||
The former names are deprecated.
|
||||
|
||||
* The example projects are now contained in a single `lg2` executable
|
||||
for ease of use.
|
||||
|
||||
* libgit2 now correctly handles more URLs, such as
|
||||
`http://example.com:/repo.git` (colon but no port),
|
||||
`http://example.com` (no path),
|
||||
and `http://example.com:8080/` (path is /, nonstandard port).
|
||||
|
||||
* A carefully constructed commit object with a very large number
|
||||
of parents may lead to potential out-of-bounds writes or
|
||||
potential denial of service.
|
||||
|
||||
* The ProgramData configuration file is always read for compatibility
|
||||
with Git for Windows and Portable Git installations. The ProgramData
|
||||
location is not necessarily writable only by administrators, so we
|
||||
now ensure that the configuration file is owned by the administrator
|
||||
or the current user.
|
||||
|
||||
### API additions
|
||||
|
||||
* The SSH host key now supports SHA-256 when `GIT_CERT_SSH_SHA256` is set.
|
||||
|
||||
* The diff format option `GIT_DIFF_FORMAT_PATCH_ID` can now be used to
|
||||
emit an output like `git patch-id`.
|
||||
|
||||
* The `git_apply_options_init` function will initialize a
|
||||
`git_apply_options` structure.
|
||||
|
||||
* The remote callbacks structure adds a `git_url_resolve_cb` callback
|
||||
that is invoked when connecting to a server, so that applications
|
||||
may edit or replace the URL before connection.
|
||||
|
||||
* The information about the original `HEAD` in a rebase operation is
|
||||
available with `git_rebase_orig_head_name`. Its ID is available with
|
||||
`git_rebase_orig_head_id`. The `onto` reference name is available with
|
||||
`git_rebase_onto_name` and its ID is available with `git_rebase_onto_id`.
|
||||
|
||||
* ODB backends can now free backend data when an error occurs during its
|
||||
backend data creation using `git_odb_backend_data_free`.
|
||||
|
||||
* Options may be specified to `git_repository_foreach_head` to control
|
||||
its behavior: `GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO` will not skip
|
||||
the main repository's HEAD reference, while
|
||||
`GIT_REPOSITORY_FOREACH_HEAD_SKIP_WORKTREES` will now skip the
|
||||
worktree HEAD references.
|
||||
|
||||
* The `GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS` option can be specified to
|
||||
`git_libgit2_opts()` to avoid looking for `.keep` files that correspond
|
||||
to packfiles. This setting can improve performance when packfiles are
|
||||
stored on high-latency filesystems like network filesystems.
|
||||
|
||||
* Blobs can now be filtered with `git_blob_filter`, which allows for
|
||||
options to be set with `git_blob_filter_options`, including
|
||||
`GIT_FILTER_NO_SYSTEM_ATTRIBUTES` to disable filtering with system-level
|
||||
attributes in `/etc/gitattributes` and `GIT_ATTR_CHECK_INCLUDE_HEAD` to
|
||||
enable filtering with `.gitattributes` files in the HEAD revision.
|
||||
|
||||
### API removals
|
||||
|
||||
* The unused `git_headlist_cb` function declaration was removed.
|
||||
|
||||
* The unused `git_time_monotonic` API is removed.
|
||||
|
||||
* The erroneously exported `inttypes.h` header was removed.
|
||||
|
||||
# Security Fixes
|
||||
|
||||
- CVE-2019-1348: the fast-import stream command "feature
|
||||
export-marks=path" allows writing to arbitrary file paths. As
|
||||
libgit2 does not offer any interface for fast-import, it is not
|
||||
susceptible to this vulnerability.
|
||||
|
||||
- CVE-2019-1349: by using NTFS 8.3 short names, backslashes or
|
||||
alternate filesystreams, it is possible to cause submodules to
|
||||
be written into pre-existing directories during a recursive
|
||||
clone using git. As libgit2 rejects cloning into non-empty
|
||||
directories by default, it is not susceptible to this
|
||||
vulnerability.
|
||||
|
||||
- CVE-2019-1350: recursive clones may lead to arbitrary remote
|
||||
code executing due to improper quoting of command line
|
||||
arguments. As libgit2 uses libssh2, which does not require us
|
||||
to perform command line parsing, it is not susceptible to this
|
||||
vulnerability.
|
||||
|
||||
- CVE-2019-1351: Windows provides the ability to substitute
|
||||
drive letters with arbitrary letters, including multi-byte
|
||||
Unicode letters. To fix any potential issues arising from
|
||||
interpreting such paths as relative paths, we have extended
|
||||
detection of DOS drive prefixes to accomodate for such cases.
|
||||
|
||||
- CVE-2019-1352: by using NTFS-style alternative file streams for
|
||||
the ".git" directory, it is possible to overwrite parts of the
|
||||
repository. While this has been fixed in the past for Windows,
|
||||
the same vulnerability may also exist on other systems that
|
||||
write to NTFS filesystems. We now reject any paths starting
|
||||
with ".git:" on all systems.
|
||||
|
||||
- CVE-2019-1353: by using NTFS-style 8.3 short names, it was
|
||||
possible to write to the ".git" directory and thus overwrite
|
||||
parts of the repository, leading to possible remote code
|
||||
execution. While this problem was already fixed in the past for
|
||||
Windows, other systems accessing NTFS filesystems are
|
||||
vulnerable to this issue too. We now enable NTFS protecions by
|
||||
default on all systems to fix this attack vector.
|
||||
|
||||
- CVE-2019-1354: on Windows, backslashes are not a valid part of
|
||||
a filename but are instead interpreted as directory separators.
|
||||
As other platforms allowed to use such paths, it was possible
|
||||
to write such invalid entries into a Git repository and was
|
||||
thus an attack vector to write into the ".git" dierctory. We
|
||||
now reject any entries starting with ".git\" on all systems.
|
||||
|
||||
- CVE-2019-1387: it is possible to let a submodule's git
|
||||
directory point into a sibling's submodule directory, which may
|
||||
result in overwriting parts of the Git repository and thus lead
|
||||
to arbitrary command execution. As libgit2 doesn't provide any
|
||||
way to do submodule clones natively, it is not susceptible to
|
||||
this vulnerability. Users of libgit2 that have implemented
|
||||
recursive submodule clones manually are encouraged to review
|
||||
their implementation for this vulnerability.
|
||||
|
||||
### Breaking API changes
|
||||
|
||||
* The "private" implementation details of the `git_cred` structure have been
|
||||
moved to a dedicated `git2/sys/cred.h` header, to clarify that the underlying
|
||||
structures are only provided for custom transport implementers.
|
||||
The breaking change is that the `username` member of the underlying struct
|
||||
is now hidden, and a new `git_cred_get_username` function has been provided.
|
||||
|
||||
### Breaking CMake configuration changes
|
||||
|
||||
@@ -17,10 +417,62 @@ v0.28 + 1
|
||||
"CollisionDetection". If you were using `SHA1_BACKEND` previously, you'll
|
||||
need to check the value you've used, or switch to the autodetection.
|
||||
|
||||
### Changes or improvements
|
||||
### Authors
|
||||
|
||||
* libgit2 can now correctly cope with URLs where the host contains a colon
|
||||
but a port is not specified. (eg `http://example.com:/repo.git`).
|
||||
The following individuals provided changes that were included in this
|
||||
release:
|
||||
|
||||
* Aaron Patterson
|
||||
* Alberto Fanjul
|
||||
* Anders Borum
|
||||
* Augie Fackler
|
||||
* Augustin Fabre
|
||||
* Ayush Shridhar
|
||||
* brian m. carlson
|
||||
* buddyspike
|
||||
* Carlos Martín Nieto
|
||||
* cheese1
|
||||
* Dan Skorupski
|
||||
* Daniel Cohen Gindi
|
||||
* Dave Lee
|
||||
* David Brooks
|
||||
* David Turner
|
||||
* Denis Laxalde
|
||||
* Dhruva Krishnamurthy
|
||||
* Dominik Ritter
|
||||
* Drew DeVault
|
||||
* Edward Thomson
|
||||
* Eric Huss
|
||||
* Erik Aigner
|
||||
* Etienne Samson
|
||||
* Gregory Herrero
|
||||
* Heiko Voigt
|
||||
* Ian Hattendorf
|
||||
* Jacques Germishuys
|
||||
* Janardhan Pulivarthi
|
||||
* Jason Haslam
|
||||
* Johannes Schindelin
|
||||
* Jordan Wallet
|
||||
* Josh Bleecher Snyder
|
||||
* kas
|
||||
* kdj0c
|
||||
* Laurence McGlashan
|
||||
* lhchavez
|
||||
* Lukas Berk
|
||||
* Max Kostyukevich
|
||||
* Patrick Steinhardt
|
||||
* pcpthm
|
||||
* Remy Suen
|
||||
* Robert Coup
|
||||
* romkatv
|
||||
* Scott Furry
|
||||
* Sebastian Henke
|
||||
* Stefan Widgren
|
||||
* Steve King Jr
|
||||
* Sven Strickroth
|
||||
* Tobias Nießen
|
||||
* Tyler Ang-Wanek
|
||||
* Tyler Wanek
|
||||
|
||||
v0.28
|
||||
-----
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
libgit2 is currently using [libFuzzer](https://libfuzzer.info) to perform
|
||||
automated fuzz testing. libFuzzer only works with clang.
|
||||
|
||||
## Prerequisites** for building fuzz targets:
|
||||
## Prerequisites for building fuzz targets:
|
||||
|
||||
1. All the prerequisites for [building libgit2](https://github.com/libgit2/libgit2).
|
||||
2. A recent version of clang. 6.0 is preferred. [pre-build Debian/Ubuntu
|
||||
@@ -27,14 +27,15 @@ automated fuzz testing. libFuzzer only works with clang.
|
||||
|
||||
## Run the fuzz targets
|
||||
|
||||
1. `ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolize-6.0
|
||||
1. `ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolize
|
||||
LSAN_OPTIONS=allocator_may_return_null=1
|
||||
ASAN_OPTIONS=allocator_may_return_null=1 ./build/fuzz/fuzz_packfile_raw
|
||||
fuzz/corpora/fuzz_packfile_raw/`
|
||||
ASAN_OPTIONS=allocator_may_return_null=1 ./build/fuzzers/packfile_fuzzer
|
||||
fuzzers/corpora/packfile/`
|
||||
|
||||
The `LSAN_OPTIONS` and `ASAN_OPTIONS` are there to allow `malloc(3)` to return
|
||||
`NULL`. The `LLVM_PROFILE_FILE` is there to override the path where libFuzzer
|
||||
will write the coverage report.
|
||||
`NULL`, which is expected if a huge chunk of memory is allocated. The
|
||||
`LLVM_PROFILE_FILE` environment string can also be added to override the path
|
||||
where libFuzzer will write the coverage report.
|
||||
|
||||
## Get coverage
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Here we do not use release candidates as the changes are supposed to be small an
|
||||
|
||||
This is the same as a maintenance release, except that the fix itself will most likely be developed in a private repository and will only be visible to a select group of people until the release.
|
||||
|
||||
Everything else remains the same. Occasionally we might opt to backport a security fix to the previous series, based on how recently we started the new series and how serious the issue is.
|
||||
We have committed to providing security fixes for the latest two released versions. E.g. if the latest version is v0.28.x, then we will provide security fixes for both v0.28.x and v0.27.y.
|
||||
|
||||
## Updating documentation
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
|
||||
INCLUDE_DIRECTORIES(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES})
|
||||
|
||||
FILE(GLOB LG2_SOURCES *.c)
|
||||
FILE(GLOB LG2_SOURCES *.c *.h)
|
||||
ADD_EXECUTABLE(lg2 ${LG2_SOURCES})
|
||||
SET_TARGET_PROPERTIES(lg2 PROPERTIES C_STANDARD 90)
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <assert.h>
|
||||
|
||||
/**
|
||||
* The following example demonstrates how to add files with libgit2.
|
||||
@@ -27,48 +26,50 @@
|
||||
* -u/--update: update the index instead of adding to it.
|
||||
*/
|
||||
|
||||
enum print_options {
|
||||
SKIP = 1,
|
||||
VERBOSE = 2,
|
||||
UPDATE = 4,
|
||||
enum index_mode {
|
||||
INDEX_NONE,
|
||||
INDEX_ADD,
|
||||
};
|
||||
|
||||
struct print_payload {
|
||||
enum print_options options;
|
||||
struct index_options {
|
||||
int dry_run;
|
||||
int verbose;
|
||||
git_repository *repo;
|
||||
enum index_mode mode;
|
||||
int add_update;
|
||||
};
|
||||
|
||||
/* Forward declarations for helpers */
|
||||
static void parse_opts(int *options, int *count, int argc, char *argv[]);
|
||||
void init_array(git_strarray *array, int argc, char **argv);
|
||||
static void parse_opts(const char **repo_path, struct index_options *opts, struct args_info *args);
|
||||
int print_matched_cb(const char *path, const char *matched_pathspec, void *payload);
|
||||
|
||||
int lg2_add(git_repository *repo, int argc, char** argv)
|
||||
int lg2_add(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
git_index_matched_path_cb matched_cb = NULL;
|
||||
git_index *index;
|
||||
git_strarray array = {0};
|
||||
int options = 0, count = 0;
|
||||
struct print_payload payload = {0};
|
||||
struct index_options options;
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
parse_opts(&options, &count, argc, argv);
|
||||
init_array(&array, argc-count, argv+count);
|
||||
/* Parse the options & arguments. */
|
||||
parse_opts(NULL, &options, &args);
|
||||
strarray_from_args(&array, &args);
|
||||
|
||||
/* Grab the repository's index. */
|
||||
check_lg2(git_repository_index(&index, repo), "Could not open repository index", NULL);
|
||||
|
||||
/* Setup a callback if the requested options need it */
|
||||
if ((options & VERBOSE) || (options & SKIP)) {
|
||||
if (options.verbose || options.dry_run) {
|
||||
matched_cb = &print_matched_cb;
|
||||
}
|
||||
|
||||
/* Perform the requested action with the index and files */
|
||||
payload.options = options;
|
||||
payload.repo = repo;
|
||||
options.repo = repo;
|
||||
|
||||
if (options & UPDATE) {
|
||||
git_index_update_all(index, &array, matched_cb, &payload);
|
||||
/* Perform the requested action with the index and files */
|
||||
if (options.add_update) {
|
||||
git_index_update_all(index, &array, matched_cb, &options);
|
||||
} else {
|
||||
git_index_add_all(index, &array, 0, matched_cb, &payload);
|
||||
git_index_add_all(index, &array, 0, matched_cb, &options);
|
||||
}
|
||||
|
||||
/* Cleanup memory */
|
||||
@@ -85,15 +86,14 @@ int lg2_add(git_repository *repo, int argc, char** argv)
|
||||
*/
|
||||
int print_matched_cb(const char *path, const char *matched_pathspec, void *payload)
|
||||
{
|
||||
struct print_payload p = *(struct print_payload*)(payload);
|
||||
struct index_options *opts = (struct index_options *)(payload);
|
||||
int ret;
|
||||
unsigned status;
|
||||
(void)matched_pathspec;
|
||||
|
||||
/* Get the file status */
|
||||
if (git_status_file(&status, p.repo, path)) {
|
||||
if (git_status_file(&status, opts->repo, path) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((status & GIT_STATUS_WT_MODIFIED) || (status & GIT_STATUS_WT_NEW)) {
|
||||
printf("add '%s'\n", path);
|
||||
@@ -102,9 +102,8 @@ int print_matched_cb(const char *path, const char *matched_pathspec, void *paylo
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if ((p.options & SKIP)) {
|
||||
if (opts->dry_run)
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -133,33 +132,39 @@ void print_usage(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void parse_opts(int *options, int *count, int argc, char *argv[])
|
||||
static void parse_opts(const char **repo_path, struct index_options *opts, struct args_info *args)
|
||||
{
|
||||
int i;
|
||||
if (args->argc <= 1)
|
||||
print_usage();
|
||||
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (argv[i][0] != '-')
|
||||
break;
|
||||
else if (!strcmp(argv[i], "--verbose") || !strcmp(argv[i], "-v"))
|
||||
*options |= VERBOSE;
|
||||
else if (!strcmp(argv[i], "--dry-run") || !strcmp(argv[i], "-n"))
|
||||
*options |= SKIP;
|
||||
else if (!strcmp(argv[i], "--update") || !strcmp(argv[i], "-u"))
|
||||
*options |= UPDATE;
|
||||
else if (!strcmp(argv[i], "-h")) {
|
||||
for (args->pos = 1; args->pos < args->argc; ++args->pos) {
|
||||
const char *curr = args->argv[args->pos];
|
||||
|
||||
if (curr[0] != '-') {
|
||||
if (!strcmp("add", curr)) {
|
||||
opts->mode = INDEX_ADD;
|
||||
continue;
|
||||
} else if (opts->mode == INDEX_NONE) {
|
||||
fprintf(stderr, "missing command: %s", curr);
|
||||
print_usage();
|
||||
break;
|
||||
} else {
|
||||
/* We might be looking at a filename */
|
||||
break;
|
||||
}
|
||||
} else if (match_bool_arg(&opts->verbose, args, "--verbose") ||
|
||||
match_bool_arg(&opts->dry_run, args, "--dry-run") ||
|
||||
match_str_arg(repo_path, args, "--git-dir") ||
|
||||
(opts->mode == INDEX_ADD && match_bool_arg(&opts->add_update, args, "--update"))) {
|
||||
continue;
|
||||
} else if (match_bool_arg(NULL, args, "--help")) {
|
||||
print_usage();
|
||||
break;
|
||||
} else if (!strcmp(argv[i], "--")) {
|
||||
i++;
|
||||
} else if (match_arg_separator(args)) {
|
||||
break;
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported option %s.\n", argv[i]);
|
||||
fprintf(stderr, "Unsupported option %s.\n", curr);
|
||||
print_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc <= i)
|
||||
print_usage();
|
||||
|
||||
*count = i;
|
||||
}
|
||||
|
||||
197
godot-git-plugin/thirdparty/libgit2/examples/args.c
vendored
Normal file
197
godot-git-plugin/thirdparty/libgit2/examples/args.c
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
#include "common.h"
|
||||
#include "args.h"
|
||||
|
||||
size_t is_prefixed(const char *str, const char *pfx)
|
||||
{
|
||||
size_t len = strlen(pfx);
|
||||
return strncmp(str, pfx, len) ? 0 : len;
|
||||
}
|
||||
|
||||
int optional_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt, const char *def)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc) {
|
||||
*out = def;
|
||||
return 1;
|
||||
}
|
||||
args->pos += 1;
|
||||
*out = args->argv[args->pos];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (found[len] == '=') {
|
||||
*out = found + len + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int match_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc)
|
||||
fatal("expected value following argument", opt);
|
||||
args->pos += 1;
|
||||
*out = args->argv[args->pos];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (found[len] == '=') {
|
||||
*out = found + len + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *match_numeric_arg(struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc)
|
||||
fatal("expected numeric value following argument", opt);
|
||||
args->pos += 1;
|
||||
found = args->argv[args->pos];
|
||||
} else {
|
||||
found = found + len;
|
||||
if (*found == '=')
|
||||
found++;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
int match_uint16_arg(
|
||||
uint16_t *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
uint16_t val;
|
||||
char *endptr = NULL;
|
||||
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
val = (uint16_t)strtoul(found, &endptr, 0);
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number after argument", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int match_uint32_arg(
|
||||
uint32_t *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
uint16_t val;
|
||||
char *endptr = NULL;
|
||||
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
val = (uint32_t)strtoul(found, &endptr, 0);
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number after argument", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int match_int_internal(
|
||||
int *out, const char *str, int allow_negative, const char *opt)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
int val = (int)strtol(str, &endptr, 10);
|
||||
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number", opt);
|
||||
else if (val < 0 && !allow_negative)
|
||||
fatal("negative values are not allowed", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int match_bool_arg(int *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
|
||||
if (!strcmp(found, opt)) {
|
||||
*out = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strncmp(found, "--no-", strlen("--no-")) &&
|
||||
!strcmp(found + strlen("--no-"), opt + 2)) {
|
||||
*out = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*out = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_integer(int *out, const char *str, int allow_negative)
|
||||
{
|
||||
return match_int_internal(out, str, allow_negative, NULL);
|
||||
}
|
||||
|
||||
int match_int_arg(
|
||||
int *out, struct args_info *args, const char *opt, int allow_negative)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
if (!found)
|
||||
return 0;
|
||||
return match_int_internal(out, found, allow_negative, opt);
|
||||
}
|
||||
|
||||
int match_arg_separator(struct args_info *args)
|
||||
{
|
||||
if (args->opts_done)
|
||||
return 1;
|
||||
|
||||
if (strcmp(args->argv[args->pos], "--") != 0)
|
||||
return 0;
|
||||
|
||||
args->opts_done = 1;
|
||||
args->pos++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void strarray_from_args(git_strarray *array, struct args_info *args)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
array->count = args->argc - args->pos;
|
||||
array->strings = calloc(array->count, sizeof(char *));
|
||||
assert(array->strings != NULL);
|
||||
|
||||
for (i = 0; args->pos < args->argc; ++args->pos) {
|
||||
array->strings[i++] = args->argv[args->pos];
|
||||
}
|
||||
args->pos = args->argc;
|
||||
}
|
||||
90
godot-git-plugin/thirdparty/libgit2/examples/args.h
vendored
Normal file
90
godot-git-plugin/thirdparty/libgit2/examples/args.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
#ifndef INCLUDE_examples_args_h__
|
||||
#define INCLUDE_examples_args_h__
|
||||
|
||||
/**
|
||||
* Argument-processing helper structure
|
||||
*/
|
||||
struct args_info {
|
||||
int argc;
|
||||
char **argv;
|
||||
int pos;
|
||||
int opts_done : 1; /**< Did we see a -- separator */
|
||||
};
|
||||
#define ARGS_INFO_INIT { argc, argv, 0, 0 }
|
||||
#define ARGS_CURRENT(args) args->argv[args->pos]
|
||||
|
||||
/**
|
||||
* Check if a string has the given prefix. Returns 0 if not prefixed
|
||||
* or the length of the prefix if it is.
|
||||
*/
|
||||
extern size_t is_prefixed(const char *str, const char *pfx);
|
||||
|
||||
/**
|
||||
* Match an integer string, returning 1 if matched, 0 if not.
|
||||
*/
|
||||
extern int is_integer(int *out, const char *str, int allow_negative);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string. If it matches
|
||||
* exactly, take the next arg as a string; if it matches as a prefix with
|
||||
* an equal sign, take the remainder as a string; if value not supplied,
|
||||
* default value `def` will be given. otherwise return 0.
|
||||
*/
|
||||
extern int optional_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt, const char *def);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string. If it matches
|
||||
* exactly, take the next arg as a string; if it matches as a prefix with
|
||||
* an equal sign, take the remainder as a string; otherwise return 0.
|
||||
*/
|
||||
extern int match_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as uint16. If
|
||||
* `opt` matches exactly, take the next arg as a uint16_t value; if `opt`
|
||||
* is a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* uint16_t value; otherwise return 0.
|
||||
*/
|
||||
extern int match_uint16_arg(
|
||||
uint16_t *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as uint32. If
|
||||
* `opt` matches exactly, take the next arg as a uint16_t value; if `opt`
|
||||
* is a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* uint32_t value; otherwise return 0.
|
||||
*/
|
||||
extern int match_uint32_arg(
|
||||
uint32_t *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as int. If
|
||||
* `opt` matches exactly, take the next arg as an int value; if it matches
|
||||
* as a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* int value; otherwise return 0.
|
||||
*/
|
||||
extern int match_int_arg(
|
||||
int *out, struct args_info *args, const char *opt, int allow_negative);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against a "bool" `opt` (ie. --[no-]progress).
|
||||
* If `opt` matches positively, out will be set to 1, or if `opt` matches
|
||||
* negatively, out will be set to 0, and in both cases 1 will be returned.
|
||||
* If neither the positive or the negative form of opt matched, out will be -1,
|
||||
* and 0 will be returned.
|
||||
*/
|
||||
extern int match_bool_arg(int *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check if we're processing past the single -- separator
|
||||
*/
|
||||
extern int match_arg_separator(struct args_info *args);
|
||||
|
||||
/**
|
||||
* Consume all remaining arguments in a git_strarray
|
||||
*/
|
||||
extern void strarray_from_args(git_strarray *array, struct args_info *args);
|
||||
|
||||
#endif
|
||||
@@ -19,7 +19,7 @@
|
||||
* simulate the output of `git blame` and a few of its command line arguments.
|
||||
*/
|
||||
|
||||
struct opts {
|
||||
struct blame_opts {
|
||||
char *path;
|
||||
char *commitspec;
|
||||
int C;
|
||||
@@ -28,14 +28,14 @@ struct opts {
|
||||
int end_line;
|
||||
int F;
|
||||
};
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[]);
|
||||
static void parse_opts(struct blame_opts *o, int argc, char *argv[]);
|
||||
|
||||
int lg2_blame(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
int line, break_on_null_hunk;
|
||||
git_off_t i, rawsize;
|
||||
git_object_size_t i, rawsize;
|
||||
char spec[1024] = {0};
|
||||
struct opts o = {0};
|
||||
struct blame_opts o = {0};
|
||||
const char *rawdata;
|
||||
git_revspec revspec = {0};
|
||||
git_blame_options blameopts = GIT_BLAME_OPTIONS_INIT;
|
||||
@@ -143,7 +143,7 @@ static void usage(const char *msg, const char *arg)
|
||||
}
|
||||
|
||||
/** Parse the arguments. */
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
static void parse_opts(struct blame_opts *o, int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char *bare_args[3] = {0};
|
||||
|
||||
@@ -102,27 +102,28 @@ static void show_tag(const git_tag *tag)
|
||||
printf("\n%s\n", git_tag_message(tag));
|
||||
}
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
SHOW_TYPE = 1,
|
||||
SHOW_SIZE = 2,
|
||||
SHOW_NONE = 3,
|
||||
SHOW_PRETTY = 4
|
||||
};
|
||||
} catfile_mode;
|
||||
|
||||
/* Forward declarations for option-parsing helper */
|
||||
struct opts {
|
||||
struct catfile_options {
|
||||
const char *dir;
|
||||
const char *rev;
|
||||
int action;
|
||||
catfile_mode action;
|
||||
int verbose;
|
||||
};
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[]);
|
||||
|
||||
static void parse_opts(struct catfile_options *o, int argc, char *argv[]);
|
||||
|
||||
|
||||
/** Entry point for this command */
|
||||
int lg2_cat_file(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
struct opts o = { ".", NULL, 0, 0 };
|
||||
struct catfile_options o = { ".", NULL, 0, 0 };
|
||||
git_object *obj = NULL;
|
||||
char oidstr[GIT_OID_HEXSZ + 1];
|
||||
|
||||
@@ -201,7 +202,7 @@ static void usage(const char *message, const char *arg)
|
||||
}
|
||||
|
||||
/** Parse the command-line options taken from git */
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
static void parse_opts(struct catfile_options *o, int argc, char *argv[])
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* Define the printf format specifer to use for size_t output */
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
@@ -66,7 +65,7 @@ static void parse_options(const char **repo_path, checkout_options *opts, struct
|
||||
const char *curr = args->argv[args->pos];
|
||||
int bool_arg;
|
||||
|
||||
if (strcmp(curr, "--") == 0) {
|
||||
if (match_arg_separator(args)) {
|
||||
break;
|
||||
} else if (!strcmp(curr, "--force")) {
|
||||
opts->force = 1;
|
||||
@@ -112,9 +111,10 @@ static void print_perf_data(const git_checkout_perfdata *perfdata, void *payload
|
||||
* This is the main "checkout <branch>" function, responsible for performing
|
||||
* a branch-based checkout.
|
||||
*/
|
||||
static int perform_checkout_ref(git_repository *repo, git_annotated_commit *target, checkout_options *opts)
|
||||
static int perform_checkout_ref(git_repository *repo, git_annotated_commit *target, const char *target_ref, checkout_options *opts)
|
||||
{
|
||||
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||
git_reference *ref = NULL, *branch = NULL;
|
||||
git_commit *target_commit = NULL;
|
||||
int err;
|
||||
|
||||
@@ -156,10 +156,25 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
|
||||
* we might need to detach HEAD.
|
||||
*/
|
||||
if (git_annotated_commit_ref(target)) {
|
||||
err = git_repository_set_head(repo, git_annotated_commit_ref(target));
|
||||
const char *target_head;
|
||||
|
||||
if ((err = git_reference_lookup(&ref, repo, git_annotated_commit_ref(target))) < 0)
|
||||
goto error;
|
||||
|
||||
if (git_reference_is_remote(ref)) {
|
||||
if ((err = git_branch_create_from_annotated(&branch, repo, target_ref, target, 0)) < 0)
|
||||
goto error;
|
||||
target_head = git_reference_name(branch);
|
||||
} else {
|
||||
target_head = git_annotated_commit_ref(target);
|
||||
}
|
||||
|
||||
err = git_repository_set_head(repo, target_head);
|
||||
} else {
|
||||
err = git_repository_set_head_detached_from_annotated(repo, target);
|
||||
}
|
||||
|
||||
error:
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "failed to update HEAD reference: %s\n", git_error_last()->message);
|
||||
goto cleanup;
|
||||
@@ -167,10 +182,67 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
|
||||
|
||||
cleanup:
|
||||
git_commit_free(target_commit);
|
||||
git_reference_free(branch);
|
||||
git_reference_free(ref);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* This corresponds to `git switch --guess`: if a given ref does
|
||||
* not exist, git will by default try to guess the reference by
|
||||
* seeing whether any remote has a branch called <ref>. If there
|
||||
* is a single remote only that has it, then it is assumed to be
|
||||
* the desired reference and a local branch is created for it.
|
||||
*
|
||||
* The following is a simplified implementation. It will not try
|
||||
* to check whether the ref is unique across all remotes.
|
||||
*/
|
||||
static int guess_refish(git_annotated_commit **out, git_repository *repo, const char *ref)
|
||||
{
|
||||
git_strarray remotes = { NULL, 0 };
|
||||
git_reference *remote_ref = NULL;
|
||||
int error;
|
||||
size_t i;
|
||||
|
||||
if ((error = git_remote_list(&remotes, repo)) < 0)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < remotes.count; i++) {
|
||||
char *refname = NULL;
|
||||
size_t reflen;
|
||||
|
||||
reflen = snprintf(refname, 0, "refs/remotes/%s/%s", remotes.strings[i], ref);
|
||||
if ((refname = malloc(reflen + 1)) == NULL) {
|
||||
error = -1;
|
||||
goto next;
|
||||
}
|
||||
snprintf(refname, reflen + 1, "refs/remotes/%s/%s", remotes.strings[i], ref);
|
||||
|
||||
if ((error = git_reference_lookup(&remote_ref, repo, refname)) < 0)
|
||||
goto next;
|
||||
|
||||
break;
|
||||
next:
|
||||
free(refname);
|
||||
if (error < 0 && error != GIT_ENOTFOUND)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!remote_ref) {
|
||||
error = GIT_ENOTFOUND;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((error = git_annotated_commit_from_ref(out, repo, remote_ref)) < 0)
|
||||
goto out;
|
||||
|
||||
out:
|
||||
git_reference_free(remote_ref);
|
||||
git_strarray_free(&remotes);
|
||||
return error;
|
||||
}
|
||||
|
||||
/** That example's entry point */
|
||||
int lg2_checkout(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
@@ -191,11 +263,7 @@ int lg2_checkout(git_repository *repo, int argc, char **argv)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (args.pos >= args.argc) {
|
||||
fprintf(stderr, "unhandled\n");
|
||||
err = -1;
|
||||
goto cleanup;
|
||||
} else if (strcmp("--", args.argv[args.pos])) {
|
||||
if (match_arg_separator(&args)) {
|
||||
/**
|
||||
* Try to checkout the given path
|
||||
*/
|
||||
@@ -207,12 +275,12 @@ int lg2_checkout(git_repository *repo, int argc, char **argv)
|
||||
/**
|
||||
* Try to resolve a "refish" argument to a target libgit2 can use
|
||||
*/
|
||||
err = resolve_refish(&checkout_target, repo, args.argv[args.pos]);
|
||||
if (err != 0) {
|
||||
if ((err = resolve_refish(&checkout_target, repo, args.argv[args.pos])) < 0 &&
|
||||
(err = guess_refish(&checkout_target, repo, args.argv[args.pos])) < 0) {
|
||||
fprintf(stderr, "failed to resolve %s: %s\n", args.argv[args.pos], git_error_last()->message);
|
||||
goto cleanup;
|
||||
}
|
||||
err = perform_checkout_ref(repo, checkout_target, &opts);
|
||||
err = perform_checkout_ref(repo, checkout_target, args.argv[args.pos], &opts);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
@@ -23,11 +23,11 @@ static void print_progress(const progress_data *pd)
|
||||
|
||||
if (pd->fetch_progress.total_objects &&
|
||||
pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
|
||||
printf("Resolving deltas %d/%d\r",
|
||||
printf("Resolving deltas %u/%u\r",
|
||||
pd->fetch_progress.indexed_deltas,
|
||||
pd->fetch_progress.total_deltas);
|
||||
} else {
|
||||
printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
|
||||
printf("net %3d%% (%4" PRIuZ " kb, %5u/%5u) / idx %3d%% (%5u/%5u) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ")%s\n",
|
||||
network_percent, kbytes,
|
||||
pd->fetch_progress.received_objects, pd->fetch_progress.total_objects,
|
||||
index_percent, pd->fetch_progress.indexed_objects, pd->fetch_progress.total_objects,
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
void check_lg2(int error, const char *message, const char *extra)
|
||||
{
|
||||
const git_error *lg2err;
|
||||
@@ -52,174 +53,6 @@ void fatal(const char *message, const char *extra)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
size_t is_prefixed(const char *str, const char *pfx)
|
||||
{
|
||||
size_t len = strlen(pfx);
|
||||
return strncmp(str, pfx, len) ? 0 : len;
|
||||
}
|
||||
|
||||
int optional_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt, const char *def)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc) {
|
||||
*out = def;
|
||||
return 1;
|
||||
}
|
||||
args->pos += 1;
|
||||
*out = args->argv[args->pos];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (found[len] == '=') {
|
||||
*out = found + len + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int match_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc)
|
||||
fatal("expected value following argument", opt);
|
||||
args->pos += 1;
|
||||
*out = args->argv[args->pos];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (found[len] == '=') {
|
||||
*out = found + len + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *match_numeric_arg(struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
size_t len = is_prefixed(found, opt);
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
if (!found[len]) {
|
||||
if (args->pos + 1 == args->argc)
|
||||
fatal("expected numeric value following argument", opt);
|
||||
args->pos += 1;
|
||||
found = args->argv[args->pos];
|
||||
} else {
|
||||
found = found + len;
|
||||
if (*found == '=')
|
||||
found++;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
int match_uint16_arg(
|
||||
uint16_t *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
uint16_t val;
|
||||
char *endptr = NULL;
|
||||
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
val = (uint16_t)strtoul(found, &endptr, 0);
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number after argument", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int match_uint32_arg(
|
||||
uint32_t *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
uint16_t val;
|
||||
char *endptr = NULL;
|
||||
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
val = (uint32_t)strtoul(found, &endptr, 0);
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number after argument", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int match_int_internal(
|
||||
int *out, const char *str, int allow_negative, const char *opt)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
int val = (int)strtol(str, &endptr, 10);
|
||||
|
||||
if (!endptr || *endptr != '\0')
|
||||
fatal("expected number", opt);
|
||||
else if (val < 0 && !allow_negative)
|
||||
fatal("negative values are not allowed", opt);
|
||||
|
||||
if (out)
|
||||
*out = val;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int match_bool_arg(int *out, struct args_info *args, const char *opt)
|
||||
{
|
||||
const char *found = args->argv[args->pos];
|
||||
|
||||
if (!strcmp(found, opt)) {
|
||||
*out = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strncmp(found, "--no-", strlen("--no-")) &&
|
||||
!strcmp(found + strlen("--no-"), opt + 2)) {
|
||||
*out = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*out = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_integer(int *out, const char *str, int allow_negative)
|
||||
{
|
||||
return match_int_internal(out, str, allow_negative, NULL);
|
||||
}
|
||||
|
||||
int match_int_arg(
|
||||
int *out, struct args_info *args, const char *opt, int allow_negative)
|
||||
{
|
||||
const char *found = match_numeric_arg(args, opt);
|
||||
if (!found)
|
||||
return 0;
|
||||
return match_int_internal(out, found, allow_negative, opt);
|
||||
}
|
||||
|
||||
int diff_output(
|
||||
const git_diff_delta *d,
|
||||
const git_diff_hunk *h,
|
||||
@@ -343,7 +176,7 @@ static int ask(char **out, const char *prompt, char optional)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cred_acquire_cb(git_cred **out,
|
||||
int cred_acquire_cb(git_credential **out,
|
||||
const char *url,
|
||||
const char *username_from_url,
|
||||
unsigned int allowed_types,
|
||||
@@ -362,7 +195,7 @@ int cred_acquire_cb(git_cred **out,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (allowed_types & GIT_CREDTYPE_SSH_KEY) {
|
||||
if (allowed_types & GIT_CREDENTIAL_SSH_KEY) {
|
||||
int n;
|
||||
|
||||
if ((error = ask(&privkey, "SSH Key:", 0)) < 0 ||
|
||||
@@ -374,14 +207,14 @@ int cred_acquire_cb(git_cred **out,
|
||||
(n = snprintf(pubkey, n + 1, "%s.pub", privkey)) < 0)
|
||||
goto out;
|
||||
|
||||
error = git_cred_ssh_key_new(out, username, pubkey, privkey, password);
|
||||
} else if (allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT) {
|
||||
error = git_credential_ssh_key_new(out, username, pubkey, privkey, password);
|
||||
} else if (allowed_types & GIT_CREDENTIAL_USERPASS_PLAINTEXT) {
|
||||
if ((error = ask(&password, "Password:", 1)) < 0)
|
||||
goto out;
|
||||
|
||||
error = git_cred_userpass_plaintext_new(out, username, password);
|
||||
} else if (allowed_types & GIT_CREDTYPE_USERNAME) {
|
||||
error = git_cred_username_new(out, username);
|
||||
error = git_credential_userpass_plaintext_new(out, username, password);
|
||||
} else if (allowed_types & GIT_CREDENTIAL_USERNAME) {
|
||||
error = git_credential_username_new(out, username);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -391,3 +224,37 @@ out:
|
||||
free(pubkey);
|
||||
return error;
|
||||
}
|
||||
|
||||
char *read_file(const char *path)
|
||||
{
|
||||
ssize_t total = 0;
|
||||
char *buf = NULL;
|
||||
struct stat st;
|
||||
int fd = -1;
|
||||
|
||||
if ((fd = open(path, O_RDONLY)) < 0 || fstat(fd, &st) < 0)
|
||||
goto out;
|
||||
|
||||
if ((buf = malloc(st.st_size + 1)) == NULL)
|
||||
goto out;
|
||||
|
||||
while (total < st.st_size) {
|
||||
ssize_t bytes = read(fd, buf + total, st.st_size - total);
|
||||
if (bytes <= 0) {
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
continue;
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
goto out;
|
||||
}
|
||||
total += bytes;
|
||||
}
|
||||
|
||||
buf[total] = '\0';
|
||||
|
||||
out:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,29 @@
|
||||
* with this software. If not, see
|
||||
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
#ifndef INCLUDE_examples_common_h__
|
||||
#define INCLUDE_examples_common_h__
|
||||
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <git2.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <io.h>
|
||||
# include <Windows.h>
|
||||
# define open _open
|
||||
# define read _read
|
||||
# define close _close
|
||||
# define ssize_t int
|
||||
# define sleep(a) Sleep(a * 1000)
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef PRIuZ
|
||||
/* Define the printf format specifer to use for size_t output */
|
||||
@@ -34,6 +52,8 @@
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x))
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
#include "args.h"
|
||||
|
||||
extern int lg2_add(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_blame(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_cat_file(git_repository *repo, int argc, char **argv);
|
||||
@@ -55,6 +75,7 @@ extern int lg2_remote(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_rev_list(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_rev_parse(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_show_index(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_stash(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_status(git_repository *repo, int argc, char **argv);
|
||||
extern int lg2_tag(git_repository *repo, int argc, char **argv);
|
||||
|
||||
@@ -64,82 +85,19 @@ extern int lg2_tag(git_repository *repo, int argc, char **argv);
|
||||
*/
|
||||
extern void check_lg2(int error, const char *message, const char *extra);
|
||||
|
||||
/**
|
||||
* Read a file into a buffer
|
||||
*
|
||||
* @param path The path to the file that shall be read
|
||||
* @return NUL-terminated buffer if the file was successfully read, NULL-pointer otherwise
|
||||
*/
|
||||
extern char *read_file(const char *path);
|
||||
|
||||
/**
|
||||
* Exit the program, printing error to stderr
|
||||
*/
|
||||
extern void fatal(const char *message, const char *extra);
|
||||
|
||||
/**
|
||||
* Check if a string has the given prefix. Returns 0 if not prefixed
|
||||
* or the length of the prefix if it is.
|
||||
*/
|
||||
extern size_t is_prefixed(const char *str, const char *pfx);
|
||||
|
||||
/**
|
||||
* Match an integer string, returning 1 if matched, 0 if not.
|
||||
*/
|
||||
extern int is_integer(int *out, const char *str, int allow_negative);
|
||||
|
||||
struct args_info {
|
||||
int argc;
|
||||
char **argv;
|
||||
int pos;
|
||||
};
|
||||
#define ARGS_INFO_INIT { argc, argv, 0 }
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string. If it matches
|
||||
* exactly, take the next arg as a string; if it matches as a prefix with
|
||||
* an equal sign, take the remainder as a string; if value not supplied,
|
||||
* default value `def` will be given. otherwise return 0.
|
||||
*/
|
||||
extern int optional_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt, const char *def);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string. If it matches
|
||||
* exactly, take the next arg as a string; if it matches as a prefix with
|
||||
* an equal sign, take the remainder as a string; otherwise return 0.
|
||||
*/
|
||||
extern int match_str_arg(
|
||||
const char **out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as uint16. If
|
||||
* `opt` matches exactly, take the next arg as a uint16_t value; if `opt`
|
||||
* is a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* uint16_t value; otherwise return 0.
|
||||
*/
|
||||
extern int match_uint16_arg(
|
||||
uint16_t *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as uint32. If
|
||||
* `opt` matches exactly, take the next arg as a uint16_t value; if `opt`
|
||||
* is a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* uint32_t value; otherwise return 0.
|
||||
*/
|
||||
extern int match_uint32_arg(
|
||||
uint32_t *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against `opt` string parsing as int. If
|
||||
* `opt` matches exactly, take the next arg as an int value; if it matches
|
||||
* as a prefix (equal sign optional), take the remainder of the arg as a
|
||||
* int value; otherwise return 0.
|
||||
*/
|
||||
extern int match_int_arg(
|
||||
int *out, struct args_info *args, const char *opt, int allow_negative);
|
||||
|
||||
/**
|
||||
* Check current `args` entry against a "bool" `opt` (ie. --[no-]progress).
|
||||
* If `opt` matches positively, out will be set to 1, or if `opt` matches
|
||||
* negatively, out will be set to 0, and in both cases 1 will be returned.
|
||||
* If neither the positive or the negative form of opt matched, out will be -1,
|
||||
* and 0 will be returned.
|
||||
*/
|
||||
extern int match_bool_arg(int *out, struct args_info *args, const char *opt);
|
||||
|
||||
/**
|
||||
* Basic output function for plain text diff output
|
||||
* Pass `FILE*` such as `stdout` or `stderr` as payload (or NULL == `stdout`)
|
||||
@@ -167,8 +125,10 @@ extern int resolve_refish(git_annotated_commit **commit, git_repository *repo, c
|
||||
/**
|
||||
* Acquire credentials via command line
|
||||
*/
|
||||
extern int cred_acquire_cb(git_cred **out,
|
||||
extern int cred_acquire_cb(git_credential **out,
|
||||
const char *url,
|
||||
const char *username_from_url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <assert.h>
|
||||
|
||||
/**
|
||||
* The following example partially reimplements the `git describe` command
|
||||
@@ -38,16 +37,14 @@
|
||||
*/
|
||||
|
||||
/** describe_options represents the parsed command line options */
|
||||
typedef struct {
|
||||
struct describe_options {
|
||||
const char **commits;
|
||||
size_t commit_count;
|
||||
git_describe_options describe_options;
|
||||
git_describe_format_options format_options;
|
||||
} describe_options;
|
||||
};
|
||||
|
||||
typedef struct args_info args_info;
|
||||
|
||||
static void opts_add_commit(describe_options *opts, const char *commit)
|
||||
static void opts_add_commit(struct describe_options *opts, const char *commit)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
@@ -58,7 +55,7 @@ static void opts_add_commit(describe_options *opts, const char *commit)
|
||||
opts->commits[opts->commit_count - 1] = commit;
|
||||
}
|
||||
|
||||
static void do_describe_single(git_repository *repo, describe_options *opts, const char *rev)
|
||||
static void do_describe_single(git_repository *repo, struct describe_options *opts, const char *rev)
|
||||
{
|
||||
git_object *commit;
|
||||
git_describe_result *describe_result;
|
||||
@@ -81,7 +78,7 @@ static void do_describe_single(git_repository *repo, describe_options *opts, con
|
||||
printf("%s\n", buf.ptr);
|
||||
}
|
||||
|
||||
static void do_describe(git_repository *repo, describe_options *opts)
|
||||
static void do_describe(git_repository *repo, struct describe_options *opts)
|
||||
{
|
||||
if (opts->commit_count == 0)
|
||||
do_describe_single(repo, opts, NULL);
|
||||
@@ -100,9 +97,9 @@ static void print_usage(void)
|
||||
}
|
||||
|
||||
/** Parse command line arguments */
|
||||
static void parse_options(describe_options *opts, int argc, char **argv)
|
||||
static void parse_options(struct describe_options *opts, int argc, char **argv)
|
||||
{
|
||||
args_info args = ARGS_INFO_INIT;
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
for (args.pos = 1; args.pos < argc; ++args.pos) {
|
||||
const char *curr = argv[args.pos];
|
||||
@@ -142,7 +139,7 @@ static void parse_options(describe_options *opts, int argc, char **argv)
|
||||
}
|
||||
|
||||
/** Initialize describe_options struct */
|
||||
static void describe_options_init(describe_options *opts)
|
||||
static void describe_options_init(struct describe_options *opts)
|
||||
{
|
||||
memset(opts, 0, sizeof(*opts));
|
||||
|
||||
@@ -154,7 +151,7 @@ static void describe_options_init(describe_options *opts)
|
||||
|
||||
int lg2_describe(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
describe_options opts;
|
||||
struct describe_options opts;
|
||||
|
||||
describe_options_init(&opts);
|
||||
parse_options(&opts, argc, argv);
|
||||
|
||||
128
godot-git-plugin/thirdparty/libgit2/examples/diff.c
vendored
128
godot-git-plugin/thirdparty/libgit2/examples/diff.c
vendored
@@ -47,11 +47,12 @@ enum {
|
||||
CACHE_NONE = 2
|
||||
};
|
||||
|
||||
/** The 'opts' struct captures all the various parsed command line options. */
|
||||
struct opts {
|
||||
/** The 'diff_options' struct captures all the various parsed command line options. */
|
||||
struct diff_options {
|
||||
git_diff_options diffopts;
|
||||
git_diff_find_options findopts;
|
||||
int color;
|
||||
int no_index;
|
||||
int cache;
|
||||
int output;
|
||||
git_diff_format_t format;
|
||||
@@ -62,18 +63,19 @@ struct opts {
|
||||
|
||||
/** These functions are implemented at the end */
|
||||
static void usage(const char *message, const char *arg);
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[]);
|
||||
static void parse_opts(struct diff_options *o, int argc, char *argv[]);
|
||||
static int color_printer(
|
||||
const git_diff_delta*, const git_diff_hunk*, const git_diff_line*, void*);
|
||||
static void diff_print_stats(git_diff *diff, struct opts *o);
|
||||
static void diff_print_stats(git_diff *diff, struct diff_options *o);
|
||||
static void compute_diff_no_index(git_diff **diff, struct diff_options *o);
|
||||
|
||||
int lg2_diff(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
git_tree *t1 = NULL, *t2 = NULL;
|
||||
git_diff *diff;
|
||||
struct opts o = {
|
||||
struct diff_options o = {
|
||||
GIT_DIFF_OPTIONS_INIT, GIT_DIFF_FIND_OPTIONS_INIT,
|
||||
-1, 0, 0, GIT_DIFF_FORMAT_PATCH, NULL, NULL, "."
|
||||
-1, -1, 0, 0, GIT_DIFF_FORMAT_PATCH, NULL, NULL, "."
|
||||
};
|
||||
|
||||
parse_opts(&o, argc, argv);
|
||||
@@ -86,49 +88,54 @@ int lg2_diff(git_repository *repo, int argc, char *argv[])
|
||||
* * <sha1>
|
||||
* * --cached
|
||||
* * --nocache (don't use index data in diff at all)
|
||||
* * --no-index <file1> <file2>
|
||||
* * nothing
|
||||
*
|
||||
* Currently ranged arguments like <sha1>..<sha2> and <sha1>...<sha2>
|
||||
* are not supported in this example
|
||||
*/
|
||||
|
||||
if (o.treeish1)
|
||||
treeish_to_tree(&t1, repo, o.treeish1);
|
||||
if (o.treeish2)
|
||||
treeish_to_tree(&t2, repo, o.treeish2);
|
||||
if (o.no_index >= 0) {
|
||||
compute_diff_no_index(&diff, &o);
|
||||
} else {
|
||||
if (o.treeish1)
|
||||
treeish_to_tree(&t1, repo, o.treeish1);
|
||||
if (o.treeish2)
|
||||
treeish_to_tree(&t2, repo, o.treeish2);
|
||||
|
||||
if (t1 && t2)
|
||||
check_lg2(
|
||||
git_diff_tree_to_tree(&diff, repo, t1, t2, &o.diffopts),
|
||||
"diff trees", NULL);
|
||||
else if (o.cache != CACHE_NORMAL) {
|
||||
if (!t1)
|
||||
treeish_to_tree(&t1, repo, "HEAD");
|
||||
|
||||
if (o.cache == CACHE_NONE)
|
||||
if (t1 && t2)
|
||||
check_lg2(
|
||||
git_diff_tree_to_workdir(&diff, repo, t1, &o.diffopts),
|
||||
git_diff_tree_to_tree(&diff, repo, t1, t2, &o.diffopts),
|
||||
"diff trees", NULL);
|
||||
else if (o.cache != CACHE_NORMAL) {
|
||||
if (!t1)
|
||||
treeish_to_tree(&t1, repo, "HEAD");
|
||||
|
||||
if (o.cache == CACHE_NONE)
|
||||
check_lg2(
|
||||
git_diff_tree_to_workdir(&diff, repo, t1, &o.diffopts),
|
||||
"diff tree to working directory", NULL);
|
||||
else
|
||||
check_lg2(
|
||||
git_diff_tree_to_index(&diff, repo, t1, NULL, &o.diffopts),
|
||||
"diff tree to index", NULL);
|
||||
}
|
||||
else if (t1)
|
||||
check_lg2(
|
||||
git_diff_tree_to_workdir_with_index(&diff, repo, t1, &o.diffopts),
|
||||
"diff tree to working directory", NULL);
|
||||
else
|
||||
check_lg2(
|
||||
git_diff_tree_to_index(&diff, repo, t1, NULL, &o.diffopts),
|
||||
"diff tree to index", NULL);
|
||||
git_diff_index_to_workdir(&diff, repo, NULL, &o.diffopts),
|
||||
"diff index to working directory", NULL);
|
||||
|
||||
/** Apply rename and copy detection if requested. */
|
||||
|
||||
if ((o.findopts.flags & GIT_DIFF_FIND_ALL) != 0)
|
||||
check_lg2(
|
||||
git_diff_find_similar(diff, &o.findopts),
|
||||
"finding renames and copies", NULL);
|
||||
}
|
||||
else if (t1)
|
||||
check_lg2(
|
||||
git_diff_tree_to_workdir_with_index(&diff, repo, t1, &o.diffopts),
|
||||
"diff tree to working directory", NULL);
|
||||
else
|
||||
check_lg2(
|
||||
git_diff_index_to_workdir(&diff, repo, NULL, &o.diffopts),
|
||||
"diff index to working directory", NULL);
|
||||
|
||||
/** Apply rename and copy detection if requested. */
|
||||
|
||||
if ((o.findopts.flags & GIT_DIFF_FIND_ALL) != 0)
|
||||
check_lg2(
|
||||
git_diff_find_similar(diff, &o.findopts),
|
||||
"finding renames and copies", NULL);
|
||||
|
||||
/** Generate simple output using libgit2 display helper. */
|
||||
|
||||
@@ -158,6 +165,38 @@ int lg2_diff(git_repository *repo, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void compute_diff_no_index(git_diff **diff, struct diff_options *o) {
|
||||
git_patch *patch = NULL;
|
||||
char *file1_str = NULL;
|
||||
char *file2_str = NULL;
|
||||
git_buf buf = {0};
|
||||
|
||||
if (!o->treeish1 || !o->treeish2) {
|
||||
usage("two files should be provided as arguments", NULL);
|
||||
}
|
||||
file1_str = read_file(o->treeish1);
|
||||
if (file1_str == NULL) {
|
||||
usage("file cannot be read", o->treeish1);
|
||||
}
|
||||
file2_str = read_file(o->treeish2);
|
||||
if (file2_str == NULL) {
|
||||
usage("file cannot be read", o->treeish2);
|
||||
}
|
||||
check_lg2(
|
||||
git_patch_from_buffers(&patch, file1_str, strlen(file1_str), o->treeish1, file2_str, strlen(file2_str), o->treeish2, &o->diffopts),
|
||||
"patch buffers", NULL);
|
||||
check_lg2(
|
||||
git_patch_to_buf(&buf, patch),
|
||||
"patch to buf", NULL);
|
||||
check_lg2(
|
||||
git_diff_from_buffer(diff, buf.ptr, buf.size),
|
||||
"diff from patch", NULL);
|
||||
git_patch_free(patch);
|
||||
git_buf_dispose(&buf);
|
||||
free(file1_str);
|
||||
free(file2_str);
|
||||
}
|
||||
|
||||
static void usage(const char *message, const char *arg)
|
||||
{
|
||||
if (message && arg)
|
||||
@@ -202,11 +241,10 @@ static int color_printer(
|
||||
}
|
||||
|
||||
/** Parse arguments as copied from git-diff. */
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
static void parse_opts(struct diff_options *o, int argc, char *argv[])
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
|
||||
for (args.pos = 1; args.pos < argc; ++args.pos) {
|
||||
const char *a = argv[args.pos];
|
||||
|
||||
@@ -223,9 +261,10 @@ static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
o->output |= OUTPUT_DIFF;
|
||||
o->format = GIT_DIFF_FORMAT_PATCH;
|
||||
}
|
||||
else if (!strcmp(a, "--cached"))
|
||||
else if (!strcmp(a, "--cached")) {
|
||||
o->cache = CACHE_ONLY;
|
||||
else if (!strcmp(a, "--nocache"))
|
||||
if (o->no_index >= 0) usage("--cached and --no-index are incompatible", NULL);
|
||||
} else if (!strcmp(a, "--nocache"))
|
||||
o->cache = CACHE_NONE;
|
||||
else if (!strcmp(a, "--name-only") || !strcmp(a, "--format=name"))
|
||||
o->format = GIT_DIFF_FORMAT_NAME_ONLY;
|
||||
@@ -238,7 +277,10 @@ static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
o->format = GIT_DIFF_FORMAT_RAW;
|
||||
o->diffopts.id_abbrev = 40;
|
||||
}
|
||||
else if (!strcmp(a, "--color"))
|
||||
else if (!strcmp(a, "--no-index")) {
|
||||
o->no_index = 0;
|
||||
if (o->cache == CACHE_ONLY) usage("--cached and --no-index are incompatible", NULL);
|
||||
} else if (!strcmp(a, "--color"))
|
||||
o->color = 0;
|
||||
else if (!strcmp(a, "--no-color"))
|
||||
o->color = -1;
|
||||
@@ -299,7 +341,7 @@ static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
}
|
||||
|
||||
/** Display diff output with "--stat", "--numstat", or "--shortstat" */
|
||||
static void diff_print_stats(git_diff *diff, struct opts *o)
|
||||
static void diff_print_stats(git_diff *diff, struct diff_options *o)
|
||||
{
|
||||
git_diff_stats *stats;
|
||||
git_buf b = GIT_BUF_INIT_CONST(NULL, 0);
|
||||
|
||||
@@ -43,10 +43,10 @@ static int transfer_progress_cb(const git_indexer_progress *stats, void *payload
|
||||
(void)payload;
|
||||
|
||||
if (stats->received_objects == stats->total_objects) {
|
||||
printf("Resolving deltas %d/%d\r",
|
||||
printf("Resolving deltas %u/%u\r",
|
||||
stats->indexed_deltas, stats->total_deltas);
|
||||
} else if (stats->total_objects > 0) {
|
||||
printf("Received %d/%d objects (%d) in %" PRIuZ " bytes\r",
|
||||
printf("Received %u/%u objects (%u) in %" PRIuZ " bytes\r",
|
||||
stats->received_objects, stats->total_objects,
|
||||
stats->indexed_objects, stats->received_bytes);
|
||||
}
|
||||
@@ -92,10 +92,10 @@ int lg2_fetch(git_repository *repo, int argc, char **argv)
|
||||
*/
|
||||
stats = git_remote_stats(remote);
|
||||
if (stats->local_objects > 0) {
|
||||
printf("\rReceived %d/%d objects in %" PRIuZ " bytes (used %d local objects)\n",
|
||||
printf("\rReceived %u/%u objects in %" PRIuZ " bytes (used %u local objects)\n",
|
||||
stats->indexed_objects, stats->total_objects, stats->received_bytes, stats->local_objects);
|
||||
} else{
|
||||
printf("\rReceived %d/%d objects in %" PRIuZ "bytes\n",
|
||||
printf("\rReceived %u/%u objects in %" PRIuZ "bytes\n",
|
||||
stats->indexed_objects, stats->total_objects, stats->received_bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +1,44 @@
|
||||
#include <git2.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
|
||||
static int show_ref(git_reference *ref, void *data)
|
||||
{
|
||||
git_repository *repo = data;
|
||||
git_reference *resolved = NULL;
|
||||
char hex[GIT_OID_HEXSZ+1];
|
||||
const git_oid *oid;
|
||||
git_object *obj;
|
||||
|
||||
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
|
||||
check_lg2(git_reference_resolve(&resolved, ref),
|
||||
"Unable to resolve symbolic reference",
|
||||
git_reference_name(ref));
|
||||
|
||||
oid = git_reference_target(resolved ? resolved : ref);
|
||||
git_oid_fmt(hex, oid);
|
||||
hex[GIT_OID_HEXSZ] = 0;
|
||||
check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY),
|
||||
"Unable to lookup object", hex);
|
||||
|
||||
printf("%s %-6s\t%s\n",
|
||||
hex,
|
||||
git_object_type2string(git_object_type(obj)),
|
||||
git_reference_name(ref));
|
||||
|
||||
if (resolved)
|
||||
git_reference_free(resolved);
|
||||
return 0;
|
||||
git_repository *repo = data;
|
||||
git_reference *resolved = NULL;
|
||||
char hex[GIT_OID_HEXSZ+1];
|
||||
const git_oid *oid;
|
||||
git_object *obj;
|
||||
|
||||
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
|
||||
check_lg2(git_reference_resolve(&resolved, ref),
|
||||
"Unable to resolve symbolic reference",
|
||||
git_reference_name(ref));
|
||||
|
||||
oid = git_reference_target(resolved ? resolved : ref);
|
||||
git_oid_fmt(hex, oid);
|
||||
hex[GIT_OID_HEXSZ] = 0;
|
||||
check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY),
|
||||
"Unable to lookup object", hex);
|
||||
|
||||
printf("%s %-6s\t%s\n",
|
||||
hex,
|
||||
git_object_type2string(git_object_type(obj)),
|
||||
git_reference_name(ref));
|
||||
|
||||
if (resolved)
|
||||
git_reference_free(resolved);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lg2_for_each_ref(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
UNUSED(argv);
|
||||
|
||||
if (argc != 1)
|
||||
fatal("Sorry, no for-each-ref options supported yet", NULL);
|
||||
|
||||
check_lg2(git_reference_foreach(repo, show_ref, repo),
|
||||
"Could not iterate over references", NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
if (argc != 1)
|
||||
fatal("Sorry, no for-each-ref options supported yet", NULL);
|
||||
|
||||
check_lg2(git_reference_foreach(repo, show_ref, repo),
|
||||
"Could not iterate over references", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
* [pg]: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* ### Includes
|
||||
*
|
||||
@@ -43,9 +45,7 @@
|
||||
* that you need. It should be the only thing you need to include in order
|
||||
* to compile properly and get all the libgit2 API.
|
||||
*/
|
||||
#include <git2.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "git2.h"
|
||||
|
||||
static void oid_parsing(git_oid *out);
|
||||
static void object_database(git_repository *repo, git_oid *oid);
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
# include <io.h>
|
||||
# include <Windows.h>
|
||||
|
||||
# define open _open
|
||||
# define read _read
|
||||
# define close _close
|
||||
|
||||
#define ssize_t int
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This could be run in the main loop whilst the application waits for
|
||||
* the indexing to finish in a worker thread
|
||||
@@ -23,7 +7,7 @@
|
||||
static int index_cb(const git_indexer_progress *stats, void *data)
|
||||
{
|
||||
(void)data;
|
||||
printf("\rProcessing %d of %d", stats->indexed_objects, stats->total_objects);
|
||||
printf("\rProcessing %u of %u", stats->indexed_objects, stats->total_objects);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -75,7 +59,7 @@ int lg2_index_pack(git_repository *repo, int argc, char **argv)
|
||||
if ((error = git_indexer_commit(idx, &stats)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
printf("\rIndexing %d of %d\n", stats.indexed_objects, stats.total_objects);
|
||||
printf("\rIndexing %u of %u\n", stats.indexed_objects, stats.total_objects);
|
||||
|
||||
git_oid_fmt(hash, git_indexer_hash(idx));
|
||||
puts(hash);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
/** Forward declarations of helpers */
|
||||
struct opts {
|
||||
struct init_opts {
|
||||
int no_options;
|
||||
int quiet;
|
||||
int bare;
|
||||
@@ -38,11 +38,11 @@ struct opts {
|
||||
const char *dir;
|
||||
};
|
||||
static void create_initial_commit(git_repository *repo);
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[]);
|
||||
static void parse_opts(struct init_opts *o, int argc, char *argv[]);
|
||||
|
||||
int lg2_init(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
struct opts o = { 1, 0, 0, 0, GIT_REPOSITORY_INIT_SHARED_UMASK, 0, 0, 0 };
|
||||
struct init_opts o = { 1, 0, 0, 0, GIT_REPOSITORY_INIT_SHARED_UMASK, 0, 0, 0 };
|
||||
|
||||
parse_opts(&o, argc, argv);
|
||||
|
||||
@@ -210,7 +210,7 @@ static uint32_t parse_shared(const char *shared)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
static void parse_opts(struct init_opts *o, int argc, char *argv[])
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
const char *sharedarg;
|
||||
|
||||
@@ -31,6 +31,7 @@ struct {
|
||||
{ "rev-list", lg2_rev_list, 1 },
|
||||
{ "rev-parse", lg2_rev_parse, 1 },
|
||||
{ "show-index", lg2_show_index, 0 },
|
||||
{ "stash", lg2_stash, 1 },
|
||||
{ "status", lg2_status, 1 },
|
||||
{ "tag", lg2_tag, 1 },
|
||||
};
|
||||
@@ -83,8 +84,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
} else if (optional_str_arg(&git_dir, &args, "--git-dir", ".git")) {
|
||||
continue;
|
||||
} else if (!strcmp(a, "--")) {
|
||||
/* arg separator */
|
||||
} else if (match_arg_separator(&args)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,8 +424,7 @@ static int parse_options(
|
||||
else
|
||||
/** Try failed revision parse as filename. */
|
||||
break;
|
||||
} else if (!strcmp(a, "--")) {
|
||||
++args.pos;
|
||||
} else if (!match_arg_separator(&args)) {
|
||||
break;
|
||||
}
|
||||
else if (!strcmp(a, "--date-order"))
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
* This currently supports the default behavior and the `--error-unmatch` option.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
struct ls_options {
|
||||
int error_unmatch;
|
||||
char *files[1024];
|
||||
size_t file_count;
|
||||
} ls_options;
|
||||
};
|
||||
|
||||
static void usage(const char *message, const char *arg)
|
||||
{
|
||||
@@ -41,12 +41,12 @@ static void usage(const char *message, const char *arg)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int parse_options(ls_options *opts, int argc, char *argv[])
|
||||
static int parse_options(struct ls_options *opts, int argc, char *argv[])
|
||||
{
|
||||
int parsing_files = 0;
|
||||
int i;
|
||||
|
||||
memset(opts, 0, sizeof(ls_options));
|
||||
memset(opts, 0, sizeof(struct ls_options));
|
||||
|
||||
if (argc < 2)
|
||||
return 0;
|
||||
@@ -78,7 +78,7 @@ static int parse_options(ls_options *opts, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_paths(ls_options *opts, git_index *index)
|
||||
static int print_paths(struct ls_options *opts, git_index *index)
|
||||
{
|
||||
size_t i;
|
||||
const git_index_entry *entry;
|
||||
@@ -113,7 +113,7 @@ static int print_paths(ls_options *opts, git_index *index)
|
||||
int lg2_ls_files(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
git_index *index = NULL;
|
||||
ls_options opts;
|
||||
struct ls_options opts;
|
||||
int error;
|
||||
|
||||
if ((error = parse_options(&opts, argc, argv)) < 0)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <assert.h>
|
||||
|
||||
/** The following example demonstrates how to do merges with libgit2.
|
||||
*
|
||||
@@ -24,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
struct merge_options {
|
||||
const char **heads;
|
||||
size_t heads_count;
|
||||
|
||||
@@ -32,7 +31,7 @@ typedef struct {
|
||||
size_t annotated_count;
|
||||
|
||||
int no_commit : 1;
|
||||
} merge_options;
|
||||
};
|
||||
|
||||
static void print_usage(void)
|
||||
{
|
||||
@@ -40,7 +39,7 @@ static void print_usage(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void merge_options_init(merge_options *opts)
|
||||
static void merge_options_init(struct merge_options *opts)
|
||||
{
|
||||
memset(opts, 0, sizeof(*opts));
|
||||
|
||||
@@ -50,7 +49,7 @@ static void merge_options_init(merge_options *opts)
|
||||
opts->annotated_count = 0;
|
||||
}
|
||||
|
||||
static void opts_add_refish(merge_options *opts, const char *refish)
|
||||
static void opts_add_refish(struct merge_options *opts, const char *refish)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
@@ -61,7 +60,7 @@ static void opts_add_refish(merge_options *opts, const char *refish)
|
||||
opts->heads[opts->heads_count - 1] = refish;
|
||||
}
|
||||
|
||||
static void parse_options(const char **repo_path, merge_options *opts, int argc, char **argv)
|
||||
static void parse_options(const char **repo_path, struct merge_options *opts, int argc, char **argv)
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
@@ -83,7 +82,7 @@ static void parse_options(const char **repo_path, merge_options *opts, int argc,
|
||||
}
|
||||
}
|
||||
|
||||
static int resolve_heads(git_repository *repo, merge_options *opts)
|
||||
static int resolve_heads(git_repository *repo, struct merge_options *opts)
|
||||
{
|
||||
git_annotated_commit **annotated = calloc(opts->heads_count, sizeof(git_annotated_commit *));
|
||||
size_t annotated_count = 0, i;
|
||||
@@ -201,7 +200,7 @@ static void output_conflicts(git_index *index)
|
||||
git_index_conflict_iterator_free(conflicts);
|
||||
}
|
||||
|
||||
static int create_merge_commit(git_repository *repo, git_index *index, merge_options *opts)
|
||||
static int create_merge_commit(git_repository *repo, git_index *index, struct merge_options *opts)
|
||||
{
|
||||
git_oid tree_oid, commit_oid;
|
||||
git_tree *tree;
|
||||
@@ -277,7 +276,7 @@ cleanup:
|
||||
|
||||
int lg2_merge(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
merge_options opts;
|
||||
struct merge_options opts;
|
||||
git_index *index;
|
||||
git_repository_state_t state;
|
||||
git_merge_analysis_t analysis;
|
||||
|
||||
@@ -30,7 +30,7 @@ enum subcmd {
|
||||
subcmd_show,
|
||||
};
|
||||
|
||||
struct opts {
|
||||
struct remote_opts {
|
||||
enum subcmd cmd;
|
||||
|
||||
/* for command-specific args */
|
||||
@@ -38,20 +38,20 @@ struct opts {
|
||||
char **argv;
|
||||
};
|
||||
|
||||
static int cmd_add(git_repository *repo, struct opts *o);
|
||||
static int cmd_remove(git_repository *repo, struct opts *o);
|
||||
static int cmd_rename(git_repository *repo, struct opts *o);
|
||||
static int cmd_seturl(git_repository *repo, struct opts *o);
|
||||
static int cmd_show(git_repository *repo, struct opts *o);
|
||||
static int cmd_add(git_repository *repo, struct remote_opts *o);
|
||||
static int cmd_remove(git_repository *repo, struct remote_opts *o);
|
||||
static int cmd_rename(git_repository *repo, struct remote_opts *o);
|
||||
static int cmd_seturl(git_repository *repo, struct remote_opts *o);
|
||||
static int cmd_show(git_repository *repo, struct remote_opts *o);
|
||||
|
||||
static void parse_subcmd(
|
||||
struct opts *opt, int argc, char **argv);
|
||||
struct remote_opts *opt, int argc, char **argv);
|
||||
static void usage(const char *msg, const char *arg);
|
||||
|
||||
int lg2_remote(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
int retval = 0;
|
||||
struct opts opt = {0};
|
||||
struct remote_opts opt = {0};
|
||||
|
||||
parse_subcmd(&opt, argc, argv);
|
||||
|
||||
@@ -77,7 +77,7 @@ int lg2_remote(git_repository *repo, int argc, char *argv[])
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int cmd_add(git_repository *repo, struct opts *o)
|
||||
static int cmd_add(git_repository *repo, struct remote_opts *o)
|
||||
{
|
||||
char *name, *url;
|
||||
git_remote *remote = {0};
|
||||
@@ -94,7 +94,7 @@ static int cmd_add(git_repository *repo, struct opts *o)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_remove(git_repository *repo, struct opts *o)
|
||||
static int cmd_remove(git_repository *repo, struct remote_opts *o)
|
||||
{
|
||||
char *name;
|
||||
|
||||
@@ -109,7 +109,7 @@ static int cmd_remove(git_repository *repo, struct opts *o)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_rename(git_repository *repo, struct opts *o)
|
||||
static int cmd_rename(git_repository *repo, struct remote_opts *o)
|
||||
{
|
||||
int i, retval;
|
||||
char *old, *new;
|
||||
@@ -134,7 +134,7 @@ static int cmd_rename(git_repository *repo, struct opts *o)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int cmd_seturl(git_repository *repo, struct opts *o)
|
||||
static int cmd_seturl(git_repository *repo, struct remote_opts *o)
|
||||
{
|
||||
int i, retval, push = 0;
|
||||
char *name = NULL, *url = NULL;
|
||||
@@ -166,7 +166,7 @@ static int cmd_seturl(git_repository *repo, struct opts *o)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_show(git_repository *repo, struct opts *o)
|
||||
static int cmd_show(git_repository *repo, struct remote_opts *o)
|
||||
{
|
||||
int i;
|
||||
const char *arg, *name, *fetch, *push;
|
||||
@@ -213,7 +213,7 @@ static int cmd_show(git_repository *repo, struct opts *o)
|
||||
}
|
||||
|
||||
static void parse_subcmd(
|
||||
struct opts *opt, int argc, char **argv)
|
||||
struct remote_opts *opt, int argc, char **argv)
|
||||
{
|
||||
char *arg = argv[1];
|
||||
enum subcmd cmd = 0;
|
||||
|
||||
@@ -15,16 +15,24 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static int revwalk_parseopts(git_repository *repo, git_revwalk *walk, int nopts, char **opts);
|
||||
#include <assert.h>
|
||||
|
||||
static int revwalk_parse_options(git_sort_t *sort, struct args_info *args);
|
||||
static int revwalk_parse_revs(git_repository *repo, git_revwalk *walk, struct args_info *args);
|
||||
|
||||
int lg2_rev_list(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
git_revwalk *walk;
|
||||
git_oid oid;
|
||||
git_sort_t sort;
|
||||
char buf[GIT_OID_HEXSZ+1];
|
||||
|
||||
check_lg2(revwalk_parse_options(&sort, &args), "parsing options", NULL);
|
||||
|
||||
check_lg2(git_revwalk_new(&walk, repo), "allocating revwalk", NULL);
|
||||
check_lg2(revwalk_parseopts(repo, walk, argc-1, argv+1), "parsing options", NULL);
|
||||
git_revwalk_sorting(walk, sort);
|
||||
check_lg2(revwalk_parse_revs(repo, walk, &args), "parsing revs", NULL);
|
||||
|
||||
while (!git_revwalk_next(&oid, walk)) {
|
||||
git_oid_fmt(buf, &oid);
|
||||
@@ -32,6 +40,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv)
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
|
||||
git_revwalk_free(walk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -80,33 +89,60 @@ out:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int revwalk_parseopts(git_repository *repo, git_revwalk *walk, int nopts, char **opts)
|
||||
static void print_usage(void)
|
||||
{
|
||||
int hide, i, error;
|
||||
unsigned int sorting = GIT_SORT_NONE;
|
||||
fprintf(stderr, "rev-list [--git-dir=dir] [--topo-order|--date-order] [--reverse] <revspec>\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static int revwalk_parse_options(git_sort_t *sort, struct args_info *args)
|
||||
{
|
||||
assert(sort && args);
|
||||
*sort = GIT_SORT_NONE;
|
||||
|
||||
if (args->argc < 1)
|
||||
print_usage();
|
||||
|
||||
for (args->pos = 1; args->pos < args->argc; ++args->pos) {
|
||||
const char *curr = args->argv[args->pos];
|
||||
|
||||
if (!strcmp(curr, "--topo-order")) {
|
||||
*sort |= GIT_SORT_TOPOLOGICAL;
|
||||
} else if (!strcmp(curr, "--date-order")) {
|
||||
*sort |= GIT_SORT_TIME;
|
||||
} else if (!strcmp(curr, "--reverse")) {
|
||||
*sort |= (*sort & ~GIT_SORT_REVERSE) ^ GIT_SORT_REVERSE;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int revwalk_parse_revs(git_repository *repo, git_revwalk *walk, struct args_info *args)
|
||||
{
|
||||
int hide, error;
|
||||
git_oid oid;
|
||||
|
||||
hide = 0;
|
||||
for (i = 0; i < nopts; i++) {
|
||||
if (!strcmp(opts[i], "--topo-order")) {
|
||||
sorting = GIT_SORT_TOPOLOGICAL | (sorting & GIT_SORT_REVERSE);
|
||||
git_revwalk_sorting(walk, sorting);
|
||||
} else if (!strcmp(opts[i], "--date-order")) {
|
||||
sorting = GIT_SORT_TIME | (sorting & GIT_SORT_REVERSE);
|
||||
git_revwalk_sorting(walk, sorting);
|
||||
} else if (!strcmp(opts[i], "--reverse")) {
|
||||
sorting = (sorting & ~GIT_SORT_REVERSE)
|
||||
| ((sorting & GIT_SORT_REVERSE) ? 0 : GIT_SORT_REVERSE);
|
||||
git_revwalk_sorting(walk, sorting);
|
||||
} else if (!strcmp(opts[i], "--not")) {
|
||||
for (; args->pos < args->argc; ++args->pos) {
|
||||
const char *curr = args->argv[args->pos];
|
||||
|
||||
if (!strcmp(curr, "--not")) {
|
||||
hide = !hide;
|
||||
} else if (opts[i][0] == '^') {
|
||||
if ((error = push_spec(repo, walk, opts[i] + 1, !hide)))
|
||||
} else if (curr[0] == '^') {
|
||||
if ((error = push_spec(repo, walk, curr + 1, !hide)))
|
||||
return error;
|
||||
} else if (strstr(opts[i], "..")) {
|
||||
if ((error = push_range(repo, walk, opts[i], hide)))
|
||||
} else if (strstr(curr, "..")) {
|
||||
if ((error = push_range(repo, walk, curr, hide)))
|
||||
return error;
|
||||
} else {
|
||||
if ((error = push_spec(repo, walk, opts[i], hide)))
|
||||
if (push_spec(repo, walk, curr, hide) == 0)
|
||||
continue;
|
||||
|
||||
if ((error = git_oid_fromstr(&oid, curr)))
|
||||
return error;
|
||||
if ((error = push_commit(walk, &oid, hide)))
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
int lg2_show_index(git_repository *repo, int argc, char** argv)
|
||||
int lg2_show_index(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
git_index *index;
|
||||
size_t i, ecount;
|
||||
|
||||
157
godot-git-plugin/thirdparty/libgit2/examples/stash.c
vendored
Normal file
157
godot-git-plugin/thirdparty/libgit2/examples/stash.c
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* libgit2 "stash" example - shows how to use the stash API
|
||||
*
|
||||
* Written by the libgit2 contributors
|
||||
*
|
||||
* To the extent possible under law, the author(s) have dedicated all copyright
|
||||
* and related and neighboring rights to this software to the public domain
|
||||
* worldwide. This software is distributed without any warranty.
|
||||
*
|
||||
* You should have received a copy of the CC0 Public Domain Dedication along
|
||||
* with this software. If not, see
|
||||
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
enum subcmd {
|
||||
SUBCMD_APPLY,
|
||||
SUBCMD_LIST,
|
||||
SUBCMD_POP,
|
||||
SUBCMD_PUSH
|
||||
};
|
||||
|
||||
struct opts {
|
||||
enum subcmd cmd;
|
||||
int argc;
|
||||
char **argv;
|
||||
};
|
||||
|
||||
static void usage(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fputs("usage: git stash list\n", stderr);
|
||||
fputs(" or: git stash ( pop | apply )\n", stderr);
|
||||
fputs(" or: git stash [push]\n", stderr);
|
||||
fputs("\n", stderr);
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void parse_subcommand(struct opts *opts, int argc, char *argv[])
|
||||
{
|
||||
char *arg = (argc < 2) ? "push" : argv[1];
|
||||
enum subcmd cmd;
|
||||
|
||||
if (!strcmp(arg, "apply")) {
|
||||
cmd = SUBCMD_APPLY;
|
||||
} else if (!strcmp(arg, "list")) {
|
||||
cmd = SUBCMD_LIST;
|
||||
} else if (!strcmp(arg, "pop")) {
|
||||
cmd = SUBCMD_POP;
|
||||
} else if (!strcmp(arg, "push")) {
|
||||
cmd = SUBCMD_PUSH;
|
||||
} else {
|
||||
usage("invalid command %s", arg);
|
||||
return;
|
||||
}
|
||||
|
||||
opts->cmd = cmd;
|
||||
opts->argc = (argc < 2) ? argc - 1 : argc - 2;
|
||||
opts->argv = argv;
|
||||
}
|
||||
|
||||
static int cmd_apply(git_repository *repo, struct opts *opts)
|
||||
{
|
||||
if (opts->argc)
|
||||
usage("apply does not accept any parameters");
|
||||
|
||||
check_lg2(git_stash_apply(repo, 0, NULL),
|
||||
"Unable to apply stash", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_stash_cb(size_t index, const char *message,
|
||||
const git_oid *stash_id, void *payload)
|
||||
{
|
||||
UNUSED(stash_id);
|
||||
UNUSED(payload);
|
||||
printf("stash@{%"PRIuZ"}: %s\n", index, message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_list(git_repository *repo, struct opts *opts)
|
||||
{
|
||||
if (opts->argc)
|
||||
usage("list does not accept any parameters");
|
||||
|
||||
check_lg2(git_stash_foreach(repo, list_stash_cb, NULL),
|
||||
"Unable to list stashes", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_push(git_repository *repo, struct opts *opts)
|
||||
{
|
||||
git_signature *signature;
|
||||
git_commit *stash;
|
||||
git_oid stashid;
|
||||
|
||||
if (opts->argc)
|
||||
usage("push does not accept any parameters");
|
||||
|
||||
check_lg2(git_signature_default(&signature, repo),
|
||||
"Unable to get signature", NULL);
|
||||
check_lg2(git_stash_save(&stashid, repo, signature, NULL, GIT_STASH_DEFAULT),
|
||||
"Unable to save stash", NULL);
|
||||
check_lg2(git_commit_lookup(&stash, repo, &stashid),
|
||||
"Unable to lookup stash commit", NULL);
|
||||
|
||||
printf("Saved working directory %s\n", git_commit_summary(stash));
|
||||
|
||||
git_signature_free(signature);
|
||||
git_commit_free(stash);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_pop(git_repository *repo, struct opts *opts)
|
||||
{
|
||||
if (opts->argc)
|
||||
usage("pop does not accept any parameters");
|
||||
|
||||
check_lg2(git_stash_pop(repo, 0, NULL),
|
||||
"Unable to pop stash", NULL);
|
||||
|
||||
printf("Dropped refs/stash@{0}\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lg2_stash(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
struct opts opts = { 0 };
|
||||
|
||||
parse_subcommand(&opts, argc, argv);
|
||||
|
||||
switch (opts.cmd) {
|
||||
case SUBCMD_APPLY:
|
||||
return cmd_apply(repo, &opts);
|
||||
case SUBCMD_LIST:
|
||||
return cmd_list(repo, &opts);
|
||||
case SUBCMD_PUSH:
|
||||
return cmd_push(repo, &opts);
|
||||
case SUBCMD_POP:
|
||||
return cmd_pop(repo, &opts);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -13,12 +13,6 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
# define sleep(a) Sleep(a * 1000)
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This example demonstrates the use of the libgit2 status APIs,
|
||||
@@ -49,7 +43,7 @@ enum {
|
||||
|
||||
#define MAX_PATHSPEC 8
|
||||
|
||||
struct opts {
|
||||
struct status_opts {
|
||||
git_status_options statusopt;
|
||||
char *repodir;
|
||||
char *pathspec[MAX_PATHSPEC];
|
||||
@@ -61,7 +55,7 @@ struct opts {
|
||||
int repeat;
|
||||
};
|
||||
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[]);
|
||||
static void parse_opts(struct status_opts *o, int argc, char *argv[]);
|
||||
static void show_branch(git_repository *repo, int format);
|
||||
static void print_long(git_status_list *status);
|
||||
static void print_short(git_repository *repo, git_status_list *status);
|
||||
@@ -70,7 +64,7 @@ static int print_submod(git_submodule *sm, const char *name, void *payload);
|
||||
int lg2_status(git_repository *repo, int argc, char *argv[])
|
||||
{
|
||||
git_status_list *status;
|
||||
struct opts o = { GIT_STATUS_OPTIONS_INIT, "." };
|
||||
struct status_opts o = { GIT_STATUS_OPTIONS_INIT, "." };
|
||||
|
||||
o.statusopt.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
||||
o.statusopt.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
||||
@@ -441,7 +435,7 @@ static int print_submod(git_submodule *sm, const char *name, void *payload)
|
||||
/**
|
||||
* Parse options that git's status command supports.
|
||||
*/
|
||||
static void parse_opts(struct opts *o, int argc, char *argv[])
|
||||
static void parse_opts(struct status_opts *o, int argc, char *argv[])
|
||||
{
|
||||
struct args_info args = ARGS_INFO_INIT;
|
||||
|
||||
|
||||
@@ -31,19 +31,19 @@
|
||||
*/
|
||||
|
||||
/** tag_options represents the parsed command line options */
|
||||
typedef struct {
|
||||
struct tag_options {
|
||||
const char *message;
|
||||
const char *pattern;
|
||||
const char *tag_name;
|
||||
const char *target;
|
||||
int num_lines;
|
||||
int force;
|
||||
} tag_options;
|
||||
};
|
||||
|
||||
/** tag_state represents the current program state for dragging around */
|
||||
typedef struct {
|
||||
git_repository *repo;
|
||||
tag_options *opts;
|
||||
struct tag_options *opts;
|
||||
} tag_state;
|
||||
|
||||
/** An action to execute based on the command line arguments */
|
||||
@@ -167,7 +167,7 @@ static void action_list_tags(tag_state *state)
|
||||
|
||||
static void action_delete_tag(tag_state *state)
|
||||
{
|
||||
tag_options *opts = state->opts;
|
||||
struct tag_options *opts = state->opts;
|
||||
git_object *obj;
|
||||
git_buf abbrev_oid = {0};
|
||||
|
||||
@@ -191,7 +191,7 @@ static void action_delete_tag(tag_state *state)
|
||||
static void action_create_lighweight_tag(tag_state *state)
|
||||
{
|
||||
git_repository *repo = state->repo;
|
||||
tag_options *opts = state->opts;
|
||||
struct tag_options *opts = state->opts;
|
||||
git_oid oid;
|
||||
git_object *target;
|
||||
|
||||
@@ -213,7 +213,7 @@ static void action_create_lighweight_tag(tag_state *state)
|
||||
static void action_create_tag(tag_state *state)
|
||||
{
|
||||
git_repository *repo = state->repo;
|
||||
tag_options *opts = state->opts;
|
||||
struct tag_options *opts = state->opts;
|
||||
git_signature *tagger;
|
||||
git_oid oid;
|
||||
git_object *target;
|
||||
@@ -243,7 +243,7 @@ static void print_usage(void)
|
||||
}
|
||||
|
||||
/** Parse command line arguments and choose action to run when done */
|
||||
static void parse_options(tag_action *action, tag_options *opts, int argc, char **argv)
|
||||
static void parse_options(tag_action *action, struct tag_options *opts, int argc, char **argv)
|
||||
{
|
||||
args_info args = ARGS_INFO_INIT;
|
||||
*action = &action_list_tags;
|
||||
@@ -281,7 +281,7 @@ static void parse_options(tag_action *action, tag_options *opts, int argc, char
|
||||
}
|
||||
|
||||
/** Initialize tag_options struct */
|
||||
static void tag_options_init(tag_options *opts)
|
||||
static void tag_options_init(struct tag_options *opts)
|
||||
{
|
||||
memset(opts, 0, sizeof(*opts));
|
||||
|
||||
@@ -295,7 +295,7 @@ static void tag_options_init(tag_options *opts)
|
||||
|
||||
int lg2_tag(git_repository *repo, int argc, char **argv)
|
||||
{
|
||||
tag_options opts;
|
||||
struct tag_options opts;
|
||||
tag_action action;
|
||||
tag_state state;
|
||||
|
||||
|
||||
13
godot-git-plugin/thirdparty/libgit2/fuzzers/corpora/patch_parse/edit-file.diff
vendored
Normal file
13
godot-git-plugin/thirdparty/libgit2/fuzzers/corpora/patch_parse/edit-file.diff
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/fuzzers/patch_fuzzer.c b/fuzzers/patch_fuzzer.c
|
||||
index 76186b6fb..f7ce73ac8 100644
|
||||
--- a/fuzzers/patch_fuzzer.c
|
||||
+++ b/fuzzers/patch_fuzzer.c
|
||||
@@ -32,7 +32,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
git_patch* patch;
|
||||
git_patch_options opts = {(uint32_t)data[0]};
|
||||
int status = git_patch_from_buffer(&patch, (const char*)data+1, size-1, &opts);
|
||||
- if (status == 0 && patch) {
|
||||
+ if (patch) {
|
||||
git_patch_free(patch);
|
||||
}
|
||||
return 0;
|
||||
45
godot-git-plugin/thirdparty/libgit2/fuzzers/corpora/patch_parse/patch_fuzzer-patch.diff
vendored
Normal file
45
godot-git-plugin/thirdparty/libgit2/fuzzers/corpora/patch_parse/patch_fuzzer-patch.diff
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
diff --git a/fuzzers/patch_fuzzer.c b/fuzzers/patch_fuzzer.c
|
||||
new file mode 100644
|
||||
index 000000000..76186b6fb
|
||||
--- /dev/null
|
||||
+++ b/fuzzers/patch_fuzzer.c
|
||||
@@ -0,0 +1,39 @@
|
||||
+/*
|
||||
+ * libgit2 patch fuzzer target.
|
||||
+ *
|
||||
+ * Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
+ *
|
||||
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
+ * a Linking Exception. For full terms see the included COPYING file.
|
||||
+ */
|
||||
+
|
||||
+#include "git2.h"
|
||||
+#include "patch.h"
|
||||
+#include "patch_parse.h"
|
||||
+
|
||||
+#define UNUSED(x) (void)(x)
|
||||
+
|
||||
+int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
+{
|
||||
+ UNUSED(argc);
|
||||
+ UNUSED(argv);
|
||||
+
|
||||
+ if (git_libgit2_init() < 0)
|
||||
+ abort();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
+{
|
||||
+ if (size < 1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ git_patch* patch;
|
||||
+ git_patch_options opts = {(uint32_t)data[0]};
|
||||
+ int status = git_patch_from_buffer(&patch, (const char*)data+1, size-1, &opts);
|
||||
+ if (status == 0 && patch) {
|
||||
+ git_patch_free(patch);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
38
godot-git-plugin/thirdparty/libgit2/fuzzers/patch_parse_fuzzer.c
vendored
Normal file
38
godot-git-plugin/thirdparty/libgit2/fuzzers/patch_parse_fuzzer.c
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* libgit2 patch parser fuzzer target.
|
||||
*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
|
||||
#include "git2.h"
|
||||
#include "patch.h"
|
||||
#include "patch_parse.h"
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
{
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
if (git_libgit2_init() < 0)
|
||||
abort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (size) {
|
||||
git_patch *patch = NULL;
|
||||
git_patch_options opts = GIT_PATCH_OPTIONS_INIT;
|
||||
opts.prefix_len = (uint32_t)data[0];
|
||||
git_patch_from_buffer(&patch, (const char *)data + 1, size - 1,
|
||||
&opts);
|
||||
git_patch_free(patch);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -15,12 +15,14 @@
|
||||
#include "git2/blame.h"
|
||||
#include "git2/branch.h"
|
||||
#include "git2/buffer.h"
|
||||
#include "git2/cert.h"
|
||||
#include "git2/checkout.h"
|
||||
#include "git2/cherrypick.h"
|
||||
#include "git2/clone.h"
|
||||
#include "git2/commit.h"
|
||||
#include "git2/common.h"
|
||||
#include "git2/config.h"
|
||||
#include "git2/credential.h"
|
||||
#include "git2/deprecated.h"
|
||||
#include "git2/describe.h"
|
||||
#include "git2/diff.h"
|
||||
|
||||
@@ -53,6 +53,15 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
|
||||
const git_diff_hunk *hunk,
|
||||
void *payload);
|
||||
|
||||
/** Flags controlling the behavior of git_apply */
|
||||
typedef enum {
|
||||
/**
|
||||
* Don't actually make changes, just test that the patch applies.
|
||||
* This is the equivalent of `git apply --check`.
|
||||
*/
|
||||
GIT_APPLY_CHECK = (1 << 0),
|
||||
} git_apply_flags_t;
|
||||
|
||||
/**
|
||||
* Apply options structure
|
||||
*
|
||||
@@ -72,6 +81,9 @@ typedef struct {
|
||||
|
||||
/** Payload passed to both delta_cb & hunk_cb. */
|
||||
void *payload;
|
||||
|
||||
/** Bitmask of git_apply_flags_t */
|
||||
unsigned int flags;
|
||||
} git_apply_options;
|
||||
|
||||
#define GIT_APPLY_OPTIONS_VERSION 1
|
||||
|
||||
@@ -119,13 +119,20 @@ GIT_EXTERN(git_attr_value_t) git_attr_value(const char *attr);
|
||||
#define GIT_ATTR_CHECK_INDEX_ONLY 2
|
||||
|
||||
/**
|
||||
* Check attribute flags: Using the system attributes file.
|
||||
* Check attribute flags: controlling extended attribute behavior.
|
||||
*
|
||||
* Normally, attribute checks include looking in the /etc (or system
|
||||
* equivalent) directory for a `gitattributes` file. Passing this
|
||||
* flag will cause attribute checks to ignore that file.
|
||||
* equivalent) directory for a `gitattributes` file. Passing the
|
||||
* `GIT_ATTR_CHECK_NO_SYSTEM` flag will cause attribute checks to
|
||||
* ignore that file.
|
||||
*
|
||||
* Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
|
||||
* from a `.gitattributes` file in the repository at the HEAD revision.
|
||||
*/
|
||||
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
|
||||
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
|
||||
#define GIT_ATTR_CHECK_INCLUDE_HEAD (1 << 3)
|
||||
|
||||
/**
|
||||
* Look up the value of one git attribute for path.
|
||||
@@ -231,8 +238,11 @@ GIT_EXTERN(int) git_attr_foreach(
|
||||
* disk no longer match the cached contents of memory. This will cause
|
||||
* the attributes files to be reloaded the next time that an attribute
|
||||
* access function is called.
|
||||
*
|
||||
* @param repo The repository containing the gitattributes cache
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_attr_cache_flush(
|
||||
GIT_EXTERN(int) git_attr_cache_flush(
|
||||
git_repository *repo);
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,7 +94,40 @@ GIT_EXTERN(const void *) git_blob_rawcontent(const git_blob *blob);
|
||||
* @param blob pointer to the blob
|
||||
* @return size on bytes
|
||||
*/
|
||||
GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
|
||||
GIT_EXTERN(git_object_size_t) git_blob_rawsize(const git_blob *blob);
|
||||
|
||||
/**
|
||||
* Flags to control the functionality of `git_blob_filter`.
|
||||
*/
|
||||
typedef enum {
|
||||
/** When set, filters will not be applied to binary files. */
|
||||
GIT_BLOB_FILTER_CHECK_FOR_BINARY = (1 << 0),
|
||||
|
||||
/**
|
||||
* When set, filters will not load configuration from the
|
||||
* system-wide `gitattributes` in `/etc` (or system equivalent).
|
||||
*/
|
||||
GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES = (1 << 1),
|
||||
|
||||
/**
|
||||
* When set, filters will be loaded from a `.gitattributes` file
|
||||
* in the HEAD commit.
|
||||
*/
|
||||
GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD = (1 << 2),
|
||||
} git_blob_filter_flag_t;
|
||||
|
||||
/**
|
||||
* The options used when applying filter options to a file.
|
||||
*/
|
||||
typedef struct {
|
||||
int version;
|
||||
|
||||
/** Flags to control the filtering process, see `git_blob_filter_flag_t` above */
|
||||
uint32_t flags;
|
||||
} git_blob_filter_options;
|
||||
|
||||
#define GIT_BLOB_FILTER_OPTIONS_VERSION 1
|
||||
#define GIT_BLOB_FILTER_OPTIONS_INIT {GIT_BLOB_FILTER_OPTIONS_VERSION, GIT_BLOB_FILTER_CHECK_FOR_BINARY}
|
||||
|
||||
/**
|
||||
* Get a buffer with the filtered content of a blob.
|
||||
@@ -115,15 +148,14 @@ GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
|
||||
* @param out The git_buf to be filled in
|
||||
* @param blob Pointer to the blob
|
||||
* @param as_path Path used for file attribute lookups, etc.
|
||||
* @param check_for_binary_data Should this test if blob content contains
|
||||
* NUL bytes / looks like binary data before applying filters?
|
||||
* @param opts Options to use for filtering the blob
|
||||
* @return 0 on success or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_filtered_content(
|
||||
GIT_EXTERN(int) git_blob_filter(
|
||||
git_buf *out,
|
||||
git_blob *blob,
|
||||
const char *as_path,
|
||||
int check_for_binary_data);
|
||||
git_blob_filter_options *opts);
|
||||
|
||||
/**
|
||||
* Read a file from the working folder of a repository
|
||||
|
||||
@@ -75,9 +75,9 @@ GIT_EXTERN(int) git_branch_create_from_annotated(
|
||||
/**
|
||||
* Delete an existing branch reference.
|
||||
*
|
||||
* If the branch is successfully deleted, the passed reference
|
||||
* object will be invalidated. The reference must be freed manually
|
||||
* by the user.
|
||||
* Note that if the deletion succeeds, the reference object will not
|
||||
* be valid anymore, and should be freed immediately by the user using
|
||||
* `git_reference_free()`.
|
||||
*
|
||||
* @param branch A valid reference representing a branch
|
||||
* @return 0 on success, or an error code.
|
||||
@@ -126,6 +126,12 @@ GIT_EXTERN(void) git_branch_iterator_free(git_branch_iterator *iter);
|
||||
* The new branch name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* Note that if the move succeeds, the old reference object will not
|
||||
+ be valid anymore, and should be freed immediately by the user using
|
||||
+ `git_reference_free()`.
|
||||
*
|
||||
* @param out New reference object for the updated name.
|
||||
*
|
||||
* @param branch Current underlying reference of the branch.
|
||||
*
|
||||
* @param new_branch_name Target name of the branch once the move
|
||||
@@ -145,17 +151,14 @@ GIT_EXTERN(int) git_branch_move(
|
||||
* Lookup a branch by its name in a repository.
|
||||
*
|
||||
* The generated reference must be freed by the user.
|
||||
*
|
||||
* The branch name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @see git_tag_create for rules about valid names.
|
||||
*
|
||||
* @param out pointer to the looked-up branch reference
|
||||
*
|
||||
* @param repo the repository to look up the branch
|
||||
*
|
||||
* @param branch_name Name of the branch to be looked-up;
|
||||
* this name is validated for consistency.
|
||||
*
|
||||
* @param branch_type Type of the considered branch. This should
|
||||
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
|
||||
*
|
||||
@@ -169,65 +172,74 @@ GIT_EXTERN(int) git_branch_lookup(
|
||||
git_branch_t branch_type);
|
||||
|
||||
/**
|
||||
* Return the name of the given local or remote branch.
|
||||
* Get the branch name
|
||||
*
|
||||
* The name of the branch matches the definition of the name
|
||||
* for git_branch_lookup. That is, if the returned name is given
|
||||
* to git_branch_lookup() then the reference is returned that
|
||||
* was given to this function.
|
||||
* Given a reference object, this will check that it really is a branch (ie.
|
||||
* it lives under "refs/heads/" or "refs/remotes/"), and return the branch part
|
||||
* of it.
|
||||
*
|
||||
* @param out where the pointer of branch name is stored;
|
||||
* this is valid as long as the ref is not freed.
|
||||
* @param ref the reference ideally pointing to a branch
|
||||
* @param out Pointer to the abbreviated reference name.
|
||||
* Owned by ref, do not free.
|
||||
*
|
||||
* @return 0 on success; otherwise an error code (e.g., if the
|
||||
* ref is no local or remote branch).
|
||||
* @param ref A reference object, ideally pointing to a branch
|
||||
*
|
||||
* @return 0 on success; GIT_EINVALID if the reference isn't either a local or
|
||||
* remote branch, otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_name(
|
||||
const char **out,
|
||||
const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Return the reference supporting the remote tracking branch,
|
||||
* given a local branch reference.
|
||||
* Get the upstream of a branch
|
||||
*
|
||||
* @param out Pointer where to store the retrieved
|
||||
* reference.
|
||||
* Given a reference, this will return a new reference object corresponding
|
||||
* to its remote tracking branch. The reference must be a local branch.
|
||||
*
|
||||
* @see git_branch_upstream_name for details on the resolution.
|
||||
*
|
||||
* @param out Pointer where to store the retrieved reference.
|
||||
* @param branch Current underlying reference of the branch.
|
||||
*
|
||||
* @return 0 on success; GIT_ENOTFOUND when no remote tracking
|
||||
* reference exists, otherwise an error code.
|
||||
* reference exists, otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_upstream(
|
||||
git_reference **out,
|
||||
const git_reference *branch);
|
||||
|
||||
/**
|
||||
* Set the upstream configuration for a given local branch
|
||||
* Set a branch's upstream branch
|
||||
*
|
||||
* This will update the configuration to set the branch named `branch_name` as the upstream of `branch`.
|
||||
* Pass a NULL name to unset the upstream information.
|
||||
*
|
||||
* @note the actual tracking reference must have been already created for the
|
||||
* operation to succeed.
|
||||
*
|
||||
* @param branch the branch to configure
|
||||
* @param branch_name remote-tracking or local branch to set as upstream.
|
||||
*
|
||||
* @param upstream_name remote-tracking or local branch to set as
|
||||
* upstream. Pass NULL to unset.
|
||||
*
|
||||
* @return 0 or an error code
|
||||
* @return 0 on success; GIT_ENOTFOUND if there's no branch named `branch_name`
|
||||
* or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_set_upstream(git_reference *branch, const char *upstream_name);
|
||||
GIT_EXTERN(int) git_branch_set_upstream(
|
||||
git_reference *branch,
|
||||
const char *branch_name);
|
||||
|
||||
/**
|
||||
* Return the name of the reference supporting the remote tracking branch,
|
||||
* given the name of a local branch reference.
|
||||
* Get the upstream name of a branch
|
||||
*
|
||||
* @param out Pointer to the user-allocated git_buf which will be
|
||||
* filled with the name of the reference.
|
||||
*
|
||||
* @param repo the repository where the branches live
|
||||
* Given a local branch, this will return its remote-tracking branch information,
|
||||
* as a full reference name, ie. "feature/nice" would become
|
||||
* "refs/remote/origin/feature/nice", depending on that branch's configuration.
|
||||
*
|
||||
* @param out the buffer into which the name will be written.
|
||||
* @param repo the repository where the branches live.
|
||||
* @param refname reference name of the local branch.
|
||||
*
|
||||
* @return 0, GIT_ENOTFOUND when no remote tracking reference exists,
|
||||
* otherwise an error code.
|
||||
* @return 0 on success, GIT_ENOTFOUND when no remote tracking reference exists,
|
||||
* or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_upstream_name(
|
||||
git_buf *out,
|
||||
@@ -235,50 +247,55 @@ GIT_EXTERN(int) git_branch_upstream_name(
|
||||
const char *refname);
|
||||
|
||||
/**
|
||||
* Determine if the current local branch is pointed at by HEAD.
|
||||
* Determine if HEAD points to the given branch
|
||||
*
|
||||
* @param branch Current underlying reference of the branch.
|
||||
* @param branch A reference to a local branch.
|
||||
*
|
||||
* @return 1 if HEAD points at the branch, 0 if it isn't,
|
||||
* error code otherwise.
|
||||
* @return 1 if HEAD points at the branch, 0 if it isn't, or a negative value
|
||||
* as an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_is_head(
|
||||
const git_reference *branch);
|
||||
|
||||
/**
|
||||
* Determine if the current branch is checked out in any linked
|
||||
* repository.
|
||||
* Determine if any HEAD points to the current branch
|
||||
*
|
||||
* @param branch Reference to the branch.
|
||||
* This will iterate over all known linked repositories (usually in the form of
|
||||
* worktrees) and report whether any HEAD is pointing at the current branch.
|
||||
*
|
||||
* @return 1 if branch is checked out, 0 if it isn't,
|
||||
* error code otherwise.
|
||||
* @param branch A reference to a local branch.
|
||||
*
|
||||
* @return 1 if branch is checked out, 0 if it isn't, an error code otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_is_checked_out(
|
||||
const git_reference *branch);
|
||||
|
||||
/**
|
||||
* Return the name of remote that the remote tracking branch belongs to.
|
||||
* Find the remote name of a remote-tracking branch
|
||||
*
|
||||
* @param out Pointer to the user-allocated git_buf which will be filled with the name of the remote.
|
||||
* This will return the name of the remote whose fetch refspec is matching
|
||||
* the given branch. E.g. given a branch "refs/remotes/test/master", it will
|
||||
* extract the "test" part. If refspecs from multiple remotes match,
|
||||
* the function will return GIT_EAMBIGUOUS.
|
||||
*
|
||||
* @param out The buffer into which the name will be written.
|
||||
* @param repo The repository where the branch lives.
|
||||
* @param refname complete name of the remote tracking branch.
|
||||
*
|
||||
* @param canonical_branch_name name of the remote tracking branch.
|
||||
*
|
||||
* @return 0, GIT_ENOTFOUND
|
||||
* when no remote matching remote was found,
|
||||
* GIT_EAMBIGUOUS when the branch maps to several remotes,
|
||||
* otherwise an error code.
|
||||
* @return 0 on success, GIT_ENOTFOUND when no matching remote was found,
|
||||
* GIT_EAMBIGUOUS when the branch maps to several remotes,
|
||||
* otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_remote_name(
|
||||
git_buf *out,
|
||||
git_repository *repo,
|
||||
const char *canonical_branch_name);
|
||||
|
||||
const char *refname);
|
||||
|
||||
/**
|
||||
* Retrieve the name of the upstream remote of a local branch
|
||||
* Retrieve the upstream remote of a local branch
|
||||
*
|
||||
* This will return the currently configured "branch.*.remote" for a given
|
||||
* branch. This branch must be local.
|
||||
*
|
||||
* @param buf the buffer into which to write the name
|
||||
* @param repo the repository in which to look
|
||||
|
||||
135
godot-git-plugin/thirdparty/libgit2/include/git2/cert.h
vendored
Normal file
135
godot-git-plugin/thirdparty/libgit2/include/git2/cert.h
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_cert_h__
|
||||
#define INCLUDE_git_cert_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/cert.h
|
||||
* @brief Git certificate objects
|
||||
* @defgroup git_cert Certificate objects
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Type of host certificate structure that is passed to the check callback
|
||||
*/
|
||||
typedef enum git_cert_t {
|
||||
/**
|
||||
* No information about the certificate is available. This may
|
||||
* happen when using curl.
|
||||
*/
|
||||
GIT_CERT_NONE,
|
||||
/**
|
||||
* The `data` argument to the callback will be a pointer to
|
||||
* the DER-encoded data.
|
||||
*/
|
||||
GIT_CERT_X509,
|
||||
/**
|
||||
* The `data` argument to the callback will be a pointer to a
|
||||
* `git_cert_hostkey` structure.
|
||||
*/
|
||||
GIT_CERT_HOSTKEY_LIBSSH2,
|
||||
/**
|
||||
* The `data` argument to the callback will be a pointer to a
|
||||
* `git_strarray` with `name:content` strings containing
|
||||
* information about the certificate. This is used when using
|
||||
* curl.
|
||||
*/
|
||||
GIT_CERT_STRARRAY,
|
||||
} git_cert_t;
|
||||
|
||||
/**
|
||||
* Parent type for `git_cert_hostkey` and `git_cert_x509`.
|
||||
*/
|
||||
struct git_cert {
|
||||
/**
|
||||
* Type of certificate. A `GIT_CERT_` value.
|
||||
*/
|
||||
git_cert_t cert_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for the user's custom certificate checks.
|
||||
*
|
||||
* @param cert The host certificate
|
||||
* @param valid Whether the libgit2 checks (OpenSSL or WinHTTP) think
|
||||
* this certificate is valid
|
||||
* @param host Hostname of the host libgit2 connected to
|
||||
* @param payload Payload provided by the caller
|
||||
* @return 0 to proceed with the connection, < 0 to fail the connection
|
||||
* or > 0 to indicate that the callback refused to act and that
|
||||
* the existing validity determination should be honored
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_transport_certificate_check_cb)(git_cert *cert, int valid, const char *host, void *payload);
|
||||
|
||||
/**
|
||||
* Type of SSH host fingerprint
|
||||
*/
|
||||
typedef enum {
|
||||
/** MD5 is available */
|
||||
GIT_CERT_SSH_MD5 = (1 << 0),
|
||||
/** SHA-1 is available */
|
||||
GIT_CERT_SSH_SHA1 = (1 << 1),
|
||||
/** SHA-256 is available */
|
||||
GIT_CERT_SSH_SHA256 = (1 << 2),
|
||||
} git_cert_ssh_t;
|
||||
|
||||
/**
|
||||
* Hostkey information taken from libssh2
|
||||
*/
|
||||
typedef struct {
|
||||
git_cert parent; /**< The parent cert */
|
||||
|
||||
/**
|
||||
* A hostkey type from libssh2, either
|
||||
* `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
|
||||
*/
|
||||
git_cert_ssh_t type;
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
|
||||
* have the MD5 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_md5[16];
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
|
||||
* have the SHA-1 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_sha1[20];
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_SHA256` set, this will
|
||||
* have the SHA-256 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_sha256[32];
|
||||
} git_cert_hostkey;
|
||||
|
||||
/**
|
||||
* X.509 certificate information
|
||||
*/
|
||||
typedef struct {
|
||||
git_cert parent; /**< The parent cert */
|
||||
|
||||
/**
|
||||
* Pointer to the X.509 certificate data
|
||||
*/
|
||||
void *data;
|
||||
|
||||
/**
|
||||
* Length of the memory block pointed to by `data`.
|
||||
*/
|
||||
size_t len;
|
||||
} git_cert_x509;
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -59,8 +59,8 @@ GIT_EXTERN(int) git_cherrypick_options_init(
|
||||
* @param out pointer to store the index result in
|
||||
* @param repo the repository that contains the given commits
|
||||
* @param cherrypick_commit the commit to cherry-pick
|
||||
* @param our_commit the commit to revert against (eg, HEAD)
|
||||
* @param mainline the parent of the revert commit, if it is a merge
|
||||
* @param our_commit the commit to cherry-pick against (eg, HEAD)
|
||||
* @param mainline the parent of the `cherrypick_commit`, if it is a merge
|
||||
* @param merge_options the merge options (or null for defaults)
|
||||
* @return zero on success, -1 on failure.
|
||||
*/
|
||||
|
||||
@@ -480,7 +480,8 @@ GIT_EXTERN(int) git_commit_create_buffer(
|
||||
*
|
||||
* @param out the resulting commit id
|
||||
* @param commit_content the content of the unsigned commit object
|
||||
* @param signature the signature to add to the commit
|
||||
* @param signature the signature to add to the commit. Leave `NULL`
|
||||
* to create a commit without adding a signature field.
|
||||
* @param signature_field which header field should contain this
|
||||
* signature. Leave `NULL` for the default of "gpgsig"
|
||||
* @return 0 or an error code
|
||||
@@ -501,6 +502,27 @@ GIT_EXTERN(int) git_commit_create_with_signature(
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
|
||||
|
||||
/**
|
||||
* Commit signing callback.
|
||||
*
|
||||
* The callback will be called with the commit content, giving a user an
|
||||
* opportunity to sign the commit content. The signature_field
|
||||
* buf may be left empty to specify the default field "gpgsig".
|
||||
*
|
||||
* Signatures can take the form of any string, and can be created on an arbitrary
|
||||
* header field. Signatures are most commonly used for verifying authorship of a
|
||||
* commit using GPG or a similar cryptographically secure signing algorithm.
|
||||
* See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work for more
|
||||
* details.
|
||||
*
|
||||
* When the callback:
|
||||
* - returns GIT_PASSTHROUGH, no signature will be added to the commit.
|
||||
* - returns < 0, commit creation will be aborted.
|
||||
* - returns GIT_OK, the signature parameter is expected to be filled.
|
||||
*/
|
||||
typedef int (*git_commit_signing_cb)(
|
||||
git_buf *signature, git_buf *signature_field, const char *commit_content, void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
||||
@@ -117,8 +117,9 @@ GIT_BEGIN_DECL
|
||||
* @param major Store the major version number
|
||||
* @param minor Store the minor version number
|
||||
* @param rev Store the revision (patch) number
|
||||
* @return 0 on success or an error code on failure
|
||||
*/
|
||||
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
|
||||
GIT_EXTERN(int) git_libgit2_version(int *major, int *minor, int *rev);
|
||||
|
||||
/**
|
||||
* Combinations of these values describe the features with which libgit2
|
||||
@@ -203,7 +204,8 @@ typedef enum {
|
||||
GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY,
|
||||
GIT_OPT_GET_PACK_MAX_OBJECTS,
|
||||
GIT_OPT_SET_PACK_MAX_OBJECTS,
|
||||
GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS
|
||||
GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS,
|
||||
GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE
|
||||
} git_libgit2_opt_t;
|
||||
|
||||
/**
|
||||
@@ -397,6 +399,11 @@ typedef enum {
|
||||
* > This will cause .keep file existence checks to be skipped when
|
||||
* > accessing packfiles, which can help performance with remote filesystems.
|
||||
*
|
||||
* opts(GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE, int enabled)
|
||||
* > When connecting to a server using NTLM or Negotiate
|
||||
* > authentication, use expect/continue when POSTing data.
|
||||
* > This option is not available on Windows.
|
||||
*
|
||||
* @param option Option key
|
||||
* @param ... value to set the option
|
||||
* @return 0 on success, <0 on failure
|
||||
|
||||
@@ -7,47 +7,9 @@
|
||||
#ifndef INCLUDE_git_cred_helpers_h__
|
||||
#define INCLUDE_git_cred_helpers_h__
|
||||
|
||||
#include "transport.h"
|
||||
|
||||
/**
|
||||
* @file git2/cred_helpers.h
|
||||
* @brief Utility functions for credential management
|
||||
* @defgroup git_cred_helpers credential management helpers
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Payload for git_cred_stock_userpass_plaintext.
|
||||
*/
|
||||
typedef struct git_cred_userpass_payload {
|
||||
const char *username;
|
||||
const char *password;
|
||||
} git_cred_userpass_payload;
|
||||
|
||||
|
||||
/**
|
||||
* Stock callback usable as a git_cred_acquire_cb. This calls
|
||||
* git_cred_userpass_plaintext_new unless the protocol has not specified
|
||||
* `GIT_CREDTYPE_USERPASS_PLAINTEXT` as an allowed type.
|
||||
*
|
||||
* @param cred The newly created credential object.
|
||||
* @param url The resource for which we are demanding a credential.
|
||||
* @param user_from_url The username that was embedded in a "user\@host"
|
||||
* remote url, or NULL if not included.
|
||||
* @param allowed_types A bitmask stating which cred types are OK to return.
|
||||
* @param payload The payload provided when specifying this callback. (This is
|
||||
* interpreted as a `git_cred_userpass_payload*`.)
|
||||
*/
|
||||
GIT_EXTERN(int) git_cred_userpass(
|
||||
git_cred **cred,
|
||||
const char *url,
|
||||
const char *user_from_url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
/* These declarations have moved. */
|
||||
#ifndef GIT_DEPRECATE_HARD
|
||||
# include "git2/credential_helpers.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
314
godot-git-plugin/thirdparty/libgit2/include/git2/credential.h
vendored
Normal file
314
godot-git-plugin/thirdparty/libgit2/include/git2/credential.h
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_credential_h__
|
||||
#define INCLUDE_git_credential_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/credential.h
|
||||
* @brief Git authentication & credential management
|
||||
* @defgroup git_credential Authentication & credential management
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Supported credential types
|
||||
*
|
||||
* This represents the various types of authentication methods supported by
|
||||
* the library.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* A vanilla user/password request
|
||||
* @see git_credential_userpass_plaintext_new
|
||||
*/
|
||||
GIT_CREDENTIAL_USERPASS_PLAINTEXT = (1u << 0),
|
||||
|
||||
/**
|
||||
* An SSH key-based authentication request
|
||||
* @see git_credential_ssh_key_new
|
||||
*/
|
||||
GIT_CREDENTIAL_SSH_KEY = (1u << 1),
|
||||
|
||||
/**
|
||||
* An SSH key-based authentication request, with a custom signature
|
||||
* @see git_credential_ssh_custom_new
|
||||
*/
|
||||
GIT_CREDENTIAL_SSH_CUSTOM = (1u << 2),
|
||||
|
||||
/**
|
||||
* An NTLM/Negotiate-based authentication request.
|
||||
* @see git_credential_default
|
||||
*/
|
||||
GIT_CREDENTIAL_DEFAULT = (1u << 3),
|
||||
|
||||
/**
|
||||
* An SSH interactive authentication request
|
||||
* @see git_credential_ssh_interactive_new
|
||||
*/
|
||||
GIT_CREDENTIAL_SSH_INTERACTIVE = (1u << 4),
|
||||
|
||||
/**
|
||||
* Username-only authentication request
|
||||
*
|
||||
* Used as a pre-authentication step if the underlying transport
|
||||
* (eg. SSH, with no username in its URL) does not know which username
|
||||
* to use.
|
||||
*
|
||||
* @see git_credential_username_new
|
||||
*/
|
||||
GIT_CREDENTIAL_USERNAME = (1u << 5),
|
||||
|
||||
/**
|
||||
* An SSH key-based authentication request
|
||||
*
|
||||
* Allows credentials to be read from memory instead of files.
|
||||
* Note that because of differences in crypto backend support, it might
|
||||
* not be functional.
|
||||
*
|
||||
* @see git_credential_ssh_key_memory_new
|
||||
*/
|
||||
GIT_CREDENTIAL_SSH_MEMORY = (1u << 6),
|
||||
} git_credential_t;
|
||||
|
||||
/**
|
||||
* The base structure for all credential types
|
||||
*/
|
||||
typedef struct git_credential git_credential;
|
||||
|
||||
typedef struct git_credential_userpass_plaintext git_credential_userpass_plaintext;
|
||||
|
||||
/** Username-only credential information */
|
||||
typedef struct git_credential_username git_credential_username;
|
||||
|
||||
/** A key for NTLM/Kerberos "default" credentials */
|
||||
typedef struct git_credential git_credential_default;
|
||||
|
||||
/**
|
||||
* A ssh key from disk
|
||||
*/
|
||||
typedef struct git_credential_ssh_key git_credential_ssh_key;
|
||||
|
||||
/**
|
||||
* Keyboard-interactive based ssh authentication
|
||||
*/
|
||||
typedef struct git_credential_ssh_interactive git_credential_ssh_interactive;
|
||||
|
||||
/**
|
||||
* A key with a custom signature function
|
||||
*/
|
||||
typedef struct git_credential_ssh_custom git_credential_ssh_custom;
|
||||
|
||||
/**
|
||||
* Credential acquisition callback.
|
||||
*
|
||||
* This callback is usually involved any time another system might need
|
||||
* authentication. As such, you are expected to provide a valid
|
||||
* git_credential object back, depending on allowed_types (a
|
||||
* git_credential_t bitmask).
|
||||
*
|
||||
* Note that most authentication details are your responsibility - this
|
||||
* callback will be called until the authentication succeeds, or you report
|
||||
* an error. As such, it's easy to get in a loop if you fail to stop providing
|
||||
* the same incorrect credentials.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param url The resource for which we are demanding a credential.
|
||||
* @param username_from_url The username that was embedded in a "user\@host"
|
||||
* remote url, or NULL if not included.
|
||||
* @param allowed_types A bitmask stating which credential types are OK to return.
|
||||
* @param payload The payload provided when specifying this callback.
|
||||
* @return 0 for success, < 0 to indicate an error, > 0 to indicate
|
||||
* no credential was acquired
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_credential_acquire_cb)(
|
||||
git_credential **out,
|
||||
const char *url,
|
||||
const char *username_from_url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Free a credential.
|
||||
*
|
||||
* This is only necessary if you own the object; that is, if you are a
|
||||
* transport.
|
||||
*
|
||||
* @param cred the object to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_credential_free(git_credential *cred);
|
||||
|
||||
/**
|
||||
* Check whether a credential object contains username information.
|
||||
*
|
||||
* @param cred object to check
|
||||
* @return 1 if the credential object has non-NULL username, 0 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_has_username(git_credential *cred);
|
||||
|
||||
/**
|
||||
* Return the username associated with a credential object.
|
||||
*
|
||||
* @param cred object to check
|
||||
* @return the credential username, or NULL if not applicable
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_credential_get_username(git_credential *cred);
|
||||
|
||||
/**
|
||||
* Create a new plain-text username and password credential object.
|
||||
* The supplied credential parameter will be internally duplicated.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username The username of the credential.
|
||||
* @param password The password of the credential.
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_userpass_plaintext_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
/**
|
||||
* Create a "default" credential usable for Negotiate mechanisms like NTLM
|
||||
* or Kerberos authentication.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_default_new(git_credential **out);
|
||||
|
||||
/**
|
||||
* Create a credential to specify a username.
|
||||
*
|
||||
* This is used with ssh authentication to query for the username if
|
||||
* none is specified in the url.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username The username to authenticate with
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_username_new(git_credential **out, const char *username);
|
||||
|
||||
/**
|
||||
* Create a new passphrase-protected ssh key credential object.
|
||||
* The supplied credential parameter will be internally duplicated.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username username to use to authenticate
|
||||
* @param publickey The path to the public key of the credential.
|
||||
* @param privatekey The path to the private key of the credential.
|
||||
* @param passphrase The passphrase of the credential.
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_ssh_key_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
|
||||
/**
|
||||
* Create a new ssh key credential object reading the keys from memory.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username username to use to authenticate.
|
||||
* @param publickey The public key of the credential.
|
||||
* @param privatekey The private key of the credential.
|
||||
* @param passphrase The passphrase of the credential.
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_ssh_key_memory_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
|
||||
/*
|
||||
* If the user hasn't included libssh2.h before git2.h, we need to
|
||||
* define a few types for the callback signatures.
|
||||
*/
|
||||
#ifndef LIBSSH2_VERSION
|
||||
typedef struct _LIBSSH2_SESSION LIBSSH2_SESSION;
|
||||
typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT LIBSSH2_USERAUTH_KBDINT_PROMPT;
|
||||
typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE LIBSSH2_USERAUTH_KBDINT_RESPONSE;
|
||||
#endif
|
||||
|
||||
typedef void GIT_CALLBACK(git_credential_ssh_interactive_cb)(
|
||||
const char *name,
|
||||
int name_len,
|
||||
const char *instruction, int instruction_len,
|
||||
int num_prompts, const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||
void **abstract);
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ssh keyboard-interactive based credential object.
|
||||
* The supplied credential parameter will be internally duplicated.
|
||||
*
|
||||
* @param username Username to use to authenticate.
|
||||
* @param prompt_callback The callback method used for prompts.
|
||||
* @param payload Additional data to pass to the callback.
|
||||
* @return 0 for success or an error code for failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_ssh_interactive_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
git_credential_ssh_interactive_cb prompt_callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Create a new ssh key credential object used for querying an ssh-agent.
|
||||
* The supplied credential parameter will be internally duplicated.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username username to use to authenticate
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_ssh_key_from_agent(
|
||||
git_credential **out,
|
||||
const char *username);
|
||||
|
||||
typedef int GIT_CALLBACK(git_credential_sign_cb)(
|
||||
LIBSSH2_SESSION *session,
|
||||
unsigned char **sig, size_t *sig_len,
|
||||
const unsigned char *data, size_t data_len,
|
||||
void **abstract);
|
||||
|
||||
/**
|
||||
* Create an ssh key credential with a custom signing function.
|
||||
*
|
||||
* This lets you use your own function to sign the challenge.
|
||||
*
|
||||
* This function and its credential type is provided for completeness
|
||||
* and wraps `libssh2_userauth_publickey()`, which is undocumented.
|
||||
*
|
||||
* The supplied credential parameter will be internally duplicated.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username username to use to authenticate
|
||||
* @param publickey The bytes of the public key.
|
||||
* @param publickey_len The length of the public key in bytes.
|
||||
* @param sign_callback The callback method to sign the data during the challenge.
|
||||
* @param payload Additional data to pass to the callback.
|
||||
* @return 0 for success or an error code for failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_ssh_custom_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
size_t publickey_len,
|
||||
git_credential_sign_cb sign_callback,
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
52
godot-git-plugin/thirdparty/libgit2/include/git2/credential_helpers.h
vendored
Normal file
52
godot-git-plugin/thirdparty/libgit2/include/git2/credential_helpers.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_credential_helpers_h__
|
||||
#define INCLUDE_git_credential_helpers_h__
|
||||
|
||||
#include "transport.h"
|
||||
|
||||
/**
|
||||
* @file git2/credential_helpers.h
|
||||
* @brief Utility functions for credential management
|
||||
* @defgroup git_credential_helpers credential management helpers
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Payload for git_credential_userpass_plaintext.
|
||||
*/
|
||||
typedef struct git_credential_userpass_payload {
|
||||
const char *username;
|
||||
const char *password;
|
||||
} git_credential_userpass_payload;
|
||||
|
||||
|
||||
/**
|
||||
* Stock callback usable as a git_credential_acquire_cb. This calls
|
||||
* git_cred_userpass_plaintext_new unless the protocol has not specified
|
||||
* `GIT_CREDENTIAL_USERPASS_PLAINTEXT` as an allowed type.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param url The resource for which we are demanding a credential.
|
||||
* @param user_from_url The username that was embedded in a "user\@host"
|
||||
* remote url, or NULL if not included.
|
||||
* @param allowed_types A bitmask stating which credential types are OK to return.
|
||||
* @param payload The payload provided when specifying this callback. (This is
|
||||
* interpreted as a `git_credential_userpass_payload*`.)
|
||||
*/
|
||||
GIT_EXTERN(int) git_credential_userpass(
|
||||
git_credential **out,
|
||||
const char *url,
|
||||
const char *user_from_url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -7,6 +7,7 @@
|
||||
#ifndef INCLUDE_git_deprecated_h__
|
||||
#define INCLUDE_git_deprecated_h__
|
||||
|
||||
#include "attr.h"
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "blame.h"
|
||||
@@ -32,12 +33,21 @@
|
||||
#include "status.h"
|
||||
#include "submodule.h"
|
||||
#include "worktree.h"
|
||||
#include "credential.h"
|
||||
#include "credential_helpers.h"
|
||||
|
||||
/*
|
||||
* Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
|
||||
*/
|
||||
#ifndef GIT_DEPRECATE_HARD
|
||||
|
||||
/*
|
||||
* The credential structures are now opaque by default, and their
|
||||
* definition has moved into the `sys/credential.h` header; include
|
||||
* them here for backward compatibility.
|
||||
*/
|
||||
#include "sys/credential.h"
|
||||
|
||||
/**
|
||||
* @file git2/deprecated.h
|
||||
* @brief libgit2 deprecated functions and values
|
||||
@@ -66,6 +76,8 @@ GIT_BEGIN_DECL
|
||||
#define GIT_ATTR_FALSE(attr) GIT_ATTR_IS_FALSE(attr)
|
||||
#define GIT_ATTR_UNSPECIFIED(attr) GIT_ATTR_IS_UNSPECIFIED(attr)
|
||||
|
||||
typedef git_attr_value_t git_attr_t;
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Blob Functions
|
||||
@@ -90,6 +102,13 @@ GIT_EXTERN(int) git_blob_create_fromstream_commit(
|
||||
GIT_EXTERN(int) git_blob_create_frombuffer(
|
||||
git_oid *id, git_repository *repo, const void *buffer, size_t len);
|
||||
|
||||
/** Deprecated in favor of @see git_blob_filter */
|
||||
GIT_EXTERN(int) git_blob_filtered_content(
|
||||
git_buf *out,
|
||||
git_blob *blob,
|
||||
const char *as_path,
|
||||
int check_for_binary_data);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Buffer Functions
|
||||
@@ -349,7 +368,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Credential Callback Types
|
||||
/** @name Deprecated Credential Types
|
||||
*
|
||||
* These types are retained for backward compatibility. The newer
|
||||
* versions of these values should be preferred in all new code.
|
||||
@@ -358,8 +377,77 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
|
||||
* this time.
|
||||
*/
|
||||
|
||||
typedef git_cred_sign_cb git_cred_sign_callback;
|
||||
typedef git_cred_ssh_interactive_cb git_cred_ssh_interactive_callback;
|
||||
typedef git_credential git_cred;
|
||||
typedef git_credential_userpass_plaintext git_cred_userpass_plaintext;
|
||||
typedef git_credential_username git_cred_username;
|
||||
typedef git_credential_default git_cred_default;
|
||||
typedef git_credential_ssh_key git_cred_ssh_key;
|
||||
typedef git_credential_ssh_interactive git_cred_ssh_interactive;
|
||||
typedef git_credential_ssh_custom git_cred_ssh_custom;
|
||||
|
||||
typedef git_credential_acquire_cb git_cred_acquire_cb;
|
||||
typedef git_credential_sign_cb git_cred_sign_callback;
|
||||
typedef git_credential_sign_cb git_cred_sign_cb;
|
||||
typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_callback;
|
||||
typedef git_credential_ssh_interactive_cb git_cred_ssh_interactive_cb;
|
||||
|
||||
#define git_credtype_t git_credential_t
|
||||
|
||||
#define GIT_CREDTYPE_USERPASS_PLAINTEXT GIT_CREDENTIAL_USERPASS_PLAINTEXT
|
||||
#define GIT_CREDTYPE_SSH_KEY GIT_CREDENTIAL_SSH_KEY
|
||||
#define GIT_CREDTYPE_SSH_CUSTOM GIT_CREDENTIAL_SSH_CUSTOM
|
||||
#define GIT_CREDTYPE_DEFAULT GIT_CREDENTIAL_DEFAULT
|
||||
#define GIT_CREDTYPE_SSH_INTERACTIVE GIT_CREDENTIAL_SSH_INTERACTIVE
|
||||
#define GIT_CREDTYPE_USERNAME GIT_CREDENTIAL_USERNAME
|
||||
#define GIT_CREDTYPE_SSH_MEMORY GIT_CREDENTIAL_SSH_MEMORY
|
||||
|
||||
GIT_EXTERN(void) git_cred_free(git_credential *cred);
|
||||
GIT_EXTERN(int) git_cred_has_username(git_credential *cred);
|
||||
GIT_EXTERN(const char *) git_cred_get_username(git_credential *cred);
|
||||
GIT_EXTERN(int) git_cred_userpass_plaintext_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *password);
|
||||
GIT_EXTERN(int) git_cred_default_new(git_credential **out);
|
||||
GIT_EXTERN(int) git_cred_username_new(git_credential **out, const char *username);
|
||||
GIT_EXTERN(int) git_cred_ssh_key_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
GIT_EXTERN(int) git_cred_ssh_key_memory_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
GIT_EXTERN(int) git_cred_ssh_interactive_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
git_credential_ssh_interactive_cb prompt_callback,
|
||||
void *payload);
|
||||
GIT_EXTERN(int) git_cred_ssh_key_from_agent(
|
||||
git_credential **out,
|
||||
const char *username);
|
||||
GIT_EXTERN(int) git_cred_ssh_custom_new(
|
||||
git_credential **out,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
size_t publickey_len,
|
||||
git_credential_sign_cb sign_callback,
|
||||
void *payload);
|
||||
|
||||
/* Deprecated Credential Helper Types */
|
||||
|
||||
typedef git_credential_userpass_payload git_cred_userpass_payload;
|
||||
|
||||
GIT_EXTERN(int) git_cred_userpass(
|
||||
git_credential **out,
|
||||
const char *url,
|
||||
const char *user_from_url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
@@ -258,12 +258,12 @@ typedef enum {
|
||||
* abbreviated to something reasonable, like 7 characters.
|
||||
*/
|
||||
typedef struct {
|
||||
git_oid id;
|
||||
const char *path;
|
||||
git_off_t size;
|
||||
uint32_t flags;
|
||||
uint16_t mode;
|
||||
uint16_t id_abbrev;
|
||||
git_oid id;
|
||||
const char *path;
|
||||
git_object_size_t size;
|
||||
uint32_t flags;
|
||||
uint16_t mode;
|
||||
uint16_t id_abbrev;
|
||||
} git_diff_file;
|
||||
|
||||
/**
|
||||
@@ -1093,6 +1093,7 @@ typedef enum {
|
||||
GIT_DIFF_FORMAT_RAW = 3u, /**< like git diff --raw */
|
||||
GIT_DIFF_FORMAT_NAME_ONLY = 4u, /**< like git diff --name-only */
|
||||
GIT_DIFF_FORMAT_NAME_STATUS = 5u, /**< like git diff --name-status */
|
||||
GIT_DIFF_FORMAT_PATCH_ID = 6u, /**< git diff as used by git patch-id */
|
||||
} git_diff_format_t;
|
||||
|
||||
/**
|
||||
@@ -1378,7 +1379,8 @@ typedef enum {
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
git_diff_format_email_flags_t flags;
|
||||
/** see `git_diff_format_email_flags_t` above */
|
||||
uint32_t flags;
|
||||
|
||||
/** This patch number */
|
||||
size_t patch_no;
|
||||
@@ -1435,7 +1437,7 @@ GIT_EXTERN(int) git_diff_commit_as_email(
|
||||
git_commit *commit,
|
||||
size_t patch_no,
|
||||
size_t total_patches,
|
||||
git_diff_format_email_flags_t flags,
|
||||
uint32_t flags,
|
||||
const git_diff_options *diff_opts);
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,8 @@ typedef enum {
|
||||
GIT_ERROR_FILESYSTEM,
|
||||
GIT_ERROR_PATCH,
|
||||
GIT_ERROR_WORKTREE,
|
||||
GIT_ERROR_SHA1
|
||||
GIT_ERROR_SHA1,
|
||||
GIT_ERROR_HTTP
|
||||
} git_error_t;
|
||||
|
||||
/**
|
||||
@@ -142,8 +143,9 @@ GIT_EXTERN(void) git_error_clear(void);
|
||||
* @param error_class One of the `git_error_t` enum above describing the
|
||||
* general subsystem that is responsible for the error.
|
||||
* @param string The formatted error message to keep
|
||||
* @return 0 on success or -1 on failure
|
||||
*/
|
||||
GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
|
||||
GIT_EXTERN(int) git_error_set_str(int error_class, const char *string);
|
||||
|
||||
/**
|
||||
* Set the error message to a special value for memory allocation failure.
|
||||
|
||||
@@ -40,7 +40,15 @@ typedef enum {
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_FILTER_DEFAULT = 0u,
|
||||
|
||||
/** Don't error for `safecrlf` violations, allow them to continue. */
|
||||
GIT_FILTER_ALLOW_UNSAFE = (1u << 0),
|
||||
|
||||
/** Don't load `/etc/gitattributes` (or the system equivalent) */
|
||||
GIT_FILTER_NO_SYSTEM_ATTRIBUTES = (1u << 1),
|
||||
|
||||
/** Load attributes from `.gitattributes` in the root of HEAD */
|
||||
GIT_FILTER_ATTRIBUTES_FROM_HEAD = (1u << 2),
|
||||
} git_filter_flag_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -192,7 +192,7 @@ typedef struct {
|
||||
git_merge_file_favor_t favor;
|
||||
|
||||
/** see `git_merge_file_flag_t` above */
|
||||
git_merge_file_flag_t flags;
|
||||
uint32_t flags;
|
||||
|
||||
/** The size of conflict markers (eg, "<<<<<<<"). Default is
|
||||
* GIT_MERGE_CONFLICT_MARKER_SIZE. */
|
||||
@@ -247,7 +247,7 @@ typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
/** See `git_merge_flag_t` above */
|
||||
git_merge_flag_t flags;
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* Similarity to consider a file renamed (default 50). If
|
||||
@@ -291,7 +291,7 @@ typedef struct {
|
||||
git_merge_file_favor_t file_favor;
|
||||
|
||||
/** see `git_merge_file_flag_t` above */
|
||||
git_merge_file_flag_t file_flags;
|
||||
uint32_t file_flags;
|
||||
} git_merge_options;
|
||||
|
||||
#define GIT_MERGE_OPTIONS_VERSION 1
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
#define GIT_OBJECT_SIZE_MAX UINT64_MAX
|
||||
|
||||
/**
|
||||
* Lookup a reference to one of the objects in a repository.
|
||||
*
|
||||
|
||||
@@ -294,7 +294,7 @@ GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size
|
||||
* @param type type of the object that will be written
|
||||
* @return 0 if the stream was created; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_object_t type);
|
||||
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_object_size_t size, git_object_t type);
|
||||
|
||||
/**
|
||||
* Write to an odb stream
|
||||
|
||||
@@ -87,8 +87,8 @@ struct git_odb_stream {
|
||||
unsigned int mode;
|
||||
void *hash_ctx;
|
||||
|
||||
git_off_t declared_size;
|
||||
git_off_t received_bytes;
|
||||
git_object_size_t declared_size;
|
||||
git_object_size_t received_bytes;
|
||||
|
||||
/**
|
||||
* Write at most `len` bytes into `buffer` and advance the stream.
|
||||
|
||||
@@ -73,8 +73,9 @@ GIT_EXTERN(int) git_oid_fromstrn(git_oid *out, const char *str, size_t length);
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param raw the raw input bytes to be copied.
|
||||
* @return 0 on success or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
|
||||
GIT_EXTERN(int) git_oid_fromraw(git_oid *out, const unsigned char *raw);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a hex string.
|
||||
@@ -85,8 +86,9 @@ GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
|
||||
* oid digits are written; a '\\0' terminator must be added
|
||||
* by the caller if it is required.
|
||||
* @param id oid structure to format.
|
||||
* @return 0 on success or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
|
||||
GIT_EXTERN(int) git_oid_fmt(char *out, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a partial hex string.
|
||||
@@ -96,8 +98,9 @@ GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
|
||||
* will be zeroed; if not, a '\0' terminator is NOT added.
|
||||
* @param n number of characters to write into out string
|
||||
* @param id oid structure to format.
|
||||
* @return 0 on success or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
|
||||
GIT_EXTERN(int) git_oid_nfmt(char *out, size_t n, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a loose-object path string.
|
||||
@@ -111,8 +114,9 @@ GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
|
||||
* oid digits are written; a '\\0' terminator must be added
|
||||
* by the caller if it is required.
|
||||
* @param id oid structure to format.
|
||||
* @return 0 on success, non-zero callback return value, or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id);
|
||||
GIT_EXTERN(int) git_oid_pathfmt(char *out, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a statically allocated c-string.
|
||||
@@ -151,8 +155,9 @@ GIT_EXTERN(char *) git_oid_tostr(char *out, size_t n, const git_oid *id);
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param src oid structure to copy from.
|
||||
* @return 0 on success or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
|
||||
GIT_EXTERN(int) git_oid_cpy(git_oid *out, const git_oid *src);
|
||||
|
||||
/**
|
||||
* Compare two oid structures.
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#define INCLUDE_git_proxy_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "transport.h"
|
||||
|
||||
#include "cert.h"
|
||||
#include "credential.h"
|
||||
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
@@ -59,7 +61,7 @@ typedef struct {
|
||||
* Returning GIT_PASSTHROUGH will make libgit2 behave as
|
||||
* though this field isn't set.
|
||||
*/
|
||||
git_cred_acquire_cb credentials;
|
||||
git_credential_acquire_cb credentials;
|
||||
|
||||
/**
|
||||
* If cert verification fails, this will be called to let the
|
||||
@@ -67,7 +69,7 @@ typedef struct {
|
||||
* connection to proceed. Returns 0 to allow the connection
|
||||
* or a negative value to indicate an error.
|
||||
*/
|
||||
git_transport_certificate_check_cb certificate_check;
|
||||
git_transport_certificate_check_cb certificate_check;
|
||||
|
||||
/**
|
||||
* Payload to be provided to the credentials and certificate
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "annotated_commit.h"
|
||||
#include "merge.h"
|
||||
#include "checkout.h"
|
||||
#include "commit.h"
|
||||
|
||||
/**
|
||||
* @file git2/rebase.h
|
||||
@@ -72,6 +73,21 @@ typedef struct {
|
||||
* `abort` to match git semantics.
|
||||
*/
|
||||
git_checkout_options checkout_options;
|
||||
|
||||
/**
|
||||
* If provided, this will be called with the commit content, allowing
|
||||
* a signature to be added to the rebase commit. Can be skipped with
|
||||
* GIT_PASSTHROUGH. If GIT_PASSTHROUGH is returned, a commit will be made
|
||||
* without a signature.
|
||||
* This field is only used when performing git_rebase_commit.
|
||||
*/
|
||||
git_commit_signing_cb signing_cb;
|
||||
|
||||
/**
|
||||
* This will be passed to each of the callbacks in this struct
|
||||
* as the last parameter.
|
||||
*/
|
||||
void *payload;
|
||||
} git_rebase_options;
|
||||
|
||||
/**
|
||||
@@ -118,7 +134,7 @@ typedef enum {
|
||||
#define GIT_REBASE_OPTIONS_VERSION 1
|
||||
#define GIT_REBASE_OPTIONS_INIT \
|
||||
{ GIT_REBASE_OPTIONS_VERSION, 0, 0, NULL, GIT_MERGE_OPTIONS_INIT, \
|
||||
GIT_CHECKOUT_OPTIONS_INIT}
|
||||
GIT_CHECKOUT_OPTIONS_INIT, NULL, NULL }
|
||||
|
||||
/** Indicates that a rebase operation is not (yet) in progress. */
|
||||
#define GIT_REBASE_NO_OPERATION SIZE_MAX
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user