Skip to content

Commit 1d8f4da

Browse files
committed
WIP
1 parent fb0e1a6 commit 1d8f4da

17 files changed

+141
-33
lines changed

LibGit2Sharp/Core/GitCheckoutOpts.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ internal struct GitCheckoutOpts
158158
public GitStrArray paths;
159159

160160
public IntPtr baseline;
161+
public IntPtr baseline_index;
161162
public IntPtr target_directory;
162163

163164
public IntPtr ancestor_label;

LibGit2Sharp/Core/GitCloneOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal struct GitCloneOptions
1717
public uint Version;
1818

1919
public GitCheckoutOpts CheckoutOpts;
20-
public GitRemoteCallbacks RemoteCallbacks;
20+
public GitFetchOpts FetchOpts;
2121

2222
public int Bare;
2323
public GitCloneLocal Local;

LibGit2Sharp/Core/GitDiff.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ internal enum GitDiffOptionFlags
8080
/// </summary>
8181
GIT_DIFF_IGNORE_CASE = (1 << 10),
8282

83+
84+
/// <summary>
85+
/// May be combined with `GIT_DIFF_IGNORE_CASE` to specify that a file
86+
/// that has changed case will be returned as an add/delete pair.
87+
/// </summary>
88+
GIT_DIFF_INCLUDE_CASECHANGE = (1 << 11),
89+
8390
/// <summary>
8491
/// If the pathspec is set in the diff options, this flags means to
8592
/// apply it as an exact match instead of as an fnmatch pattern.

LibGit2Sharp/Core/GitFetchOpts.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace LibGit2Sharp.Core
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
internal class GitFetchOpts
7+
{
8+
public int Version = 1;
9+
public GitRemoteCallbacks RemoteCallbacks;
10+
public GitFetchPrune prune;
11+
public bool update_fetchhead = true;
12+
public TagFetchMode download_tags;
13+
}
14+
15+
internal enum GitFetchPrune
16+
{
17+
/// <summary>
18+
/// Use the setting from the configuration
19+
/// </summary>
20+
GIT_FETCH_PRUNE_FALLBACK = 0,
21+
22+
/// <summary>
23+
/// Force pruning on
24+
/// </summary>
25+
GIT_FETCH_PRUNE,
26+
27+
/// <summary>
28+
/// Force pruning off
29+
/// </summary>
30+
GIT_FETCH_NO_PRUNE,
31+
}
32+
}

LibGit2Sharp/Core/GitIndexEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class GitIndexEntry
1515
public uint Mode;
1616
public uint Uid;
1717
public uint Gid;
18-
public Int64 file_size;
18+
public uint file_size;
1919
public GitOid Id;
2020
public ushort Flags;
2121
public ushort ExtendedFlags;

LibGit2Sharp/Core/GitIndexTime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace LibGit2Sharp.Core
55
[StructLayout(LayoutKind.Sequential)]
66
internal class GitIndexTime
77
{
8-
public long seconds;
8+
public int seconds;
99
public uint nanoseconds;
1010
}
1111
}

LibGit2Sharp/Core/GitMergeOpts.cs

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ internal struct GitMergeOpts
3131
/// Flags for automerging content.
3232
/// </summary>
3333
public MergeFileFavor MergeFileFavorFlags;
34+
35+
public GitMergeFileFlags file_flags;
3436
}
3537

3638
/// <summary>
@@ -63,11 +65,11 @@ internal enum GitMergeAnalysis
6365
/// </summary>
6466
GIT_MERGE_ANALYSIS_FASTFORWARD = (1 << 2),
6567

66-
/**
67-
* The HEAD of the current repository is "unborn" and does not point to
68-
* a valid commit. No merge can be performed, but the caller may wish
69-
* to simply set HEAD to the target commit(s).
70-
*/
68+
/// <summary>
69+
/// The HEAD of the current repository is "unborn" and does not point to
70+
/// a valid commit. No merge can be performed, but the caller may wish
71+
/// to simply set HEAD to the target commit(s).
72+
/// </summary>
7173
GIT_MERGE_ANALYSIS_UNBORN = (1 << 3),
7274
}
7375

@@ -105,4 +107,53 @@ internal enum GitMergeTreeFlags
105107
/// </summary>
106108
GIT_MERGE_TREE_FIND_RENAMES = (1 << 0),
107109
}
110+
111+
[Flags]
112+
internal enum GitMergeFileFlags
113+
{
114+
/// <summary>
115+
/// Defaults
116+
/// </summary>
117+
GIT_MERGE_FILE_DEFAULT = 0,
118+
119+
/// <summary>
120+
/// Create standard conflicted merge files
121+
/// </summary>
122+
GIT_MERGE_FILE_STYLE_MERGE = (1 << 0),
123+
124+
/// <summary>
125+
/// Create diff3-style files
126+
/// </summary>
127+
GIT_MERGE_FILE_STYLE_DIFF3 = (1 << 1),
128+
129+
/// <summary>
130+
/// Condense non-alphanumeric regions for simplified diff file
131+
/// </summary>
132+
GIT_MERGE_FILE_SIMPLIFY_ALNUM = (1 << 2),
133+
134+
/// <summary>
135+
/// Ignore all whitespace
136+
/// </summary>
137+
GIT_MERGE_FILE_IGNORE_WHITESPACE = (1 << 3),
138+
139+
/// <summary>
140+
/// Ignore changes in amount of whitespace
141+
/// </summary>
142+
GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE = (1 << 4),
143+
144+
/// <summary>
145+
/// Ignore whitespace at end of line
146+
/// </summary>
147+
GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = (1 << 5),
148+
149+
/// <summary>
150+
/// Use the "patience diff" algorithm
151+
/// </summary>
152+
GIT_MERGE_FILE_DIFF_PATIENCE = (1 << 6),
153+
154+
/// <summary>
155+
/// Take extra time to find minimal diff
156+
/// </summary>
157+
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
158+
}
108159
}

LibGit2Sharp/Core/GitOdbBackend.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public delegate int write_callback(
114114
IntPtr backend,
115115
ref GitOid oid,
116116
IntPtr data,
117-
UIntPtr len,
117+
Int64 len,
118118
GitObjectType type);
119119

120120
/// <summary>

LibGit2Sharp/Core/GitOdbBackendStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ static GitOdbBackendStream()
2222
public GitOdbBackendStreamMode Mode;
2323
public IntPtr HashCtx;
2424

25-
public UIntPtr DeclaredSize;
26-
public UIntPtr ReceivedBytes;
25+
public Int64 DeclaredSize;
26+
public Int64 ReceivedBytes;
2727

2828
public read_callback Read;
2929
public write_callback Write;

LibGit2Sharp/Core/GitPushOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ internal class GitPushOptions
77
{
88
public int Version = 1;
99
public int PackbuilderDegreeOfParallelism;
10+
public GitRemoteCallbacks RemoteCallbacks;
1011
}
1112
}

LibGit2Sharp/Core/GitRemoteCallbacks.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ internal struct GitRemoteCallbacks
2929

3030
internal NativeMethods.push_update_reference_callback push_update_reference;
3131

32+
internal NativeMethods.push_negotiation_callback push_negotiation;
33+
34+
internal IntPtr transport;
35+
3236
internal IntPtr payload;
3337
}
3438
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ internal static extern int git_note_remove(
744744

745745
[DllImport(libgit2)]
746746
internal static extern int git_note_default_ref(
747-
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] out string notes_ref,
747+
GitBuf notes_ref,
748748
RepositorySafeHandle repo);
749749

750750
internal delegate int git_note_foreach_cb(
@@ -779,7 +779,7 @@ internal static extern int git_odb_foreach(
779779
IntPtr payload);
780780

781781
[DllImport(libgit2)]
782-
internal static extern int git_odb_open_wstream(out OdbStreamSafeHandle stream, ObjectDatabaseSafeHandle odb, UIntPtr size, GitObjectType type);
782+
internal static extern int git_odb_open_wstream(out OdbStreamSafeHandle stream, ObjectDatabaseSafeHandle odb, Int64 size, GitObjectType type);
783783

784784
[DllImport(libgit2)]
785785
internal static extern void git_odb_free(IntPtr odb);
@@ -996,7 +996,10 @@ internal static extern string git_refspec_src(
996996
internal static extern int git_remote_autotag(RemoteSafeHandle remote);
997997

998998
[DllImport(libgit2)]
999-
internal static extern int git_remote_connect(RemoteSafeHandle remote, GitDirection direction);
999+
internal static extern int git_remote_connect(
1000+
RemoteSafeHandle remote,
1001+
GitDirection direction,
1002+
ref GitRemoteCallbacks callbacks);
10001003

10011004
[DllImport(libgit2)]
10021005
internal static extern int git_remote_create(
@@ -1033,6 +1036,7 @@ internal static extern int git_remote_delete(
10331036
internal static extern int git_remote_fetch(
10341037
RemoteSafeHandle remote,
10351038
ref GitStrArray refspecs,
1039+
GitFetchOpts fetch_opts,
10361040
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
10371041

10381042
[DllImport(libgit2)]
@@ -1064,12 +1068,14 @@ internal static extern int git_remote_push(
10641068

10651069
[DllImport(libgit2)]
10661070
internal static extern int git_remote_set_url(
1067-
RemoteSafeHandle remote,
1071+
RepositorySafeHandle repo,
1072+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
10681073
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
10691074

10701075
[DllImport(libgit2)]
10711076
internal static extern int git_remote_set_pushurl(
1072-
RemoteSafeHandle remote,
1077+
RepositorySafeHandle repo,
1078+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
10731079
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
10741080

10751081
[DllImport(libgit2)]
@@ -1094,9 +1100,6 @@ internal static extern int git_remote_lookup(
10941100
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
10951101
internal static extern string git_remote_name(RemoteSafeHandle remote);
10961102

1097-
[DllImport(libgit2)]
1098-
internal static extern int git_remote_save(RemoteSafeHandle remote);
1099-
11001103
[DllImport(libgit2)]
11011104
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
11021105
internal static extern string git_remote_url(RemoteSafeHandle remote);
@@ -1106,7 +1109,10 @@ internal static extern int git_remote_lookup(
11061109
internal static extern string git_remote_pushurl(RemoteSafeHandle remote);
11071110

11081111
[DllImport(libgit2)]
1109-
internal static extern void git_remote_set_autotag(RemoteSafeHandle remote, TagFetchMode option);
1112+
internal static extern void git_remote_set_autotag(
1113+
RepositorySafeHandle repo,
1114+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
1115+
TagFetchMode option);
11101116

11111117
[DllImport(libgit2)]
11121118
internal static extern int git_remote_set_callbacks(
@@ -1123,6 +1129,12 @@ internal delegate int remote_update_tips_callback(
11231129
ref GitOid newId,
11241130
IntPtr data);
11251131

1132+
internal delegate int push_negotiation_callback(
1133+
IntPtr updates,
1134+
IntPtr len,
1135+
IntPtr payload
1136+
);
1137+
11261138
internal delegate int push_update_reference_callback(
11271139
IntPtr refName,
11281140
IntPtr status,

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<Compile Include="CommitSortStrategies.cs" />
7171
<Compile Include="CompareOptions.cs" />
7272
<Compile Include="Core\FileHistory.cs" />
73+
<Compile Include="Core\GitFetchOpts.cs" />
7374
<Compile Include="Core\Platform.cs" />
7475
<Compile Include="Core\Handles\ConflictIteratorSafeHandle.cs" />
7576
<Compile Include="DescribeOptions.cs" />

LibGit2Sharp/MergeOptionsBase.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using LibGit2Sharp.Core;
2-
using LibGit2Sharp.Handlers;
3-
using System;
4-
5-
namespace LibGit2Sharp
1+
namespace LibGit2Sharp
62
{
73
/// <summary>
84
/// Options controlling the behavior of actions that use merge (merge
@@ -14,7 +10,7 @@ public abstract class MergeOptionsBase
1410
/// Initializes a new instance of the <see cref="MergeOptionsBase"/> class.
1511
/// The default behavior is to attempt to find renames.
1612
/// </summary>
17-
public MergeOptionsBase()
13+
protected MergeOptionsBase()
1814
{
1915
FindRenames = true;
2016
RenameThreshold = 50;

LibGit2Sharp/OdbBackend.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,9 @@ private static unsafe int Write(
412412
IntPtr backend,
413413
ref GitOid oid,
414414
IntPtr data,
415-
UIntPtr len,
415+
Int64 length,
416416
GitObjectType type)
417417
{
418-
long length = ConverToLong(len);
419-
420418
OdbBackend odbBackend = MarshalOdbBackend(backend);
421419
if (odbBackend == null)
422420
{

LibGit2Sharp/TagFetchMode.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
public enum TagFetchMode
88
{
99
/// <summary>
10-
/// Default behavior. Will automatically retrieve tags that
10+
/// Use the setting from the configuration.
11+
/// </summary>
12+
Fallback = 0, // GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK
13+
14+
/// <summary>
15+
/// Will automatically retrieve tags that
1116
/// point to objects retrieved during this fetch.
1217
/// </summary>
13-
Auto = 0, // GIT_REMOTE_DOWNLOAD_TAGS_AUTO
18+
Auto, // GIT_REMOTE_DOWNLOAD_TAGS_AUTO
1419

1520
/// <summary>
1621
/// No tag will be retrieved.

LibGit2Sharp/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="LibGit2Sharp.NativeBinaries" version="1.0.25" targetFramework="net40" allowedVersions="[1.0.25]" />
4-
</packages>
3+
<package id="LibGit2Sharp.NativeBinaries" version="1.0.27-pre20150515092631" targetFramework="net40" allowedVersions="[1.0.27-pre20150515092631]" />
4+
</packages>

0 commit comments

Comments
 (0)