Skip to content

Commit bafa05c

Browse files
committed
Upgrade libgit2 binaries to a0ce87c51
1 parent 38ec24f commit bafa05c

File tree

14 files changed

+75
-25
lines changed

14 files changed

+75
-25
lines changed

Lib/NativeBinaries/amd64/git2.dll

9.5 KB
Binary file not shown.

Lib/NativeBinaries/amd64/git2.pdb

520 KB
Binary file not shown.

Lib/NativeBinaries/x86/git2.dll

7 KB
Binary file not shown.

Lib/NativeBinaries/x86/git2.pdb

64 KB
Binary file not shown.

LibGit2Sharp/Configuration.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.IO;
5+
using System.Runtime.InteropServices;
56
using LibGit2Sharp.Core;
67
using LibGit2Sharp.Core.Handles;
78

@@ -409,11 +410,15 @@ private static Action<string, object, ConfigurationSafeHandle> GetUpdater<T>(Act
409410

410411
IEnumerator<ConfigurationEntry> IEnumerable<ConfigurationEntry>.GetEnumerator()
411412
{
412-
return Proxy.git_config_foreach(LocalHandle, (namePtr, valuePtr) => {
413-
var name = Utf8Marshaler.FromNative(namePtr);
414-
var value = Utf8Marshaler.FromNative(valuePtr);
415-
return new ConfigurationEntry(name, value);
416-
}).GetEnumerator();
413+
return Proxy.git_config_foreach(LocalHandle,
414+
(entryPtr) =>
415+
{
416+
var entry = (GitConfigEntry)Marshal.PtrToStructure(entryPtr, typeof(GitConfigEntry));
417+
return new ConfigurationEntry(Utf8Marshaler.FromNative(entry.namePtr),
418+
Utf8Marshaler.FromNative(entry.valuePtr),
419+
(ConfigurationLevel) entry.level);
420+
})
421+
.GetEnumerator();
417422
}
418423

419424
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()

LibGit2Sharp/ConfigurationEntry.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,23 @@ public class ConfigurationEntry
1515
/// </summary>
1616
public string Value { get; private set; }
1717

18+
19+
/// <summary>
20+
/// The origin store.
21+
/// </summary>
22+
public ConfigurationLevel Level { get; private set; }
23+
1824
/// <summary>
1925
/// Initializes a new instance of the <see cref="ConfigurationEntry"/> class with a given key and value
2026
/// </summary>
2127
/// <param name="key">The option name</param>
2228
/// <param name="value">The option value, as a string</param>
23-
public ConfigurationEntry(string key, string value)
29+
/// <param name="level">The origin store</param>
30+
public ConfigurationEntry(string key, string value, ConfigurationLevel level)
2431
{
2532
Key = key;
2633
Value = value;
34+
Level = level;
2735
}
2836
}
2937
}

LibGit2Sharp/ConfigurationLevel.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ public enum ConfigurationLevel
88
/// <summary>
99
/// The local .git/config of the current repository.
1010
/// </summary>
11-
Local,
11+
Local = 4,
1212

1313
/// <summary>
1414
/// The global ~/.gitconfig of the current user.
1515
/// </summary>
16-
Global,
16+
Global = 3,
17+
18+
/// <summary>
19+
/// The global ~/.config/git/config of the current user
20+
/// </summary>
21+
XDG = 2,
1722

1823
/// <summary>
1924
/// The system wide .gitconfig.
2025
/// </summary>
21-
System
26+
System = 1,
2227
}
2328
}

LibGit2Sharp/Core/GitConfigEntry.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace LibGit2Sharp.Core
5+
{
6+
[StructLayout(LayoutKind.Sequential)]
7+
internal struct GitConfigEntry
8+
{
9+
public IntPtr namePtr;
10+
public IntPtr valuePtr;
11+
public uint level;
12+
}
13+
}
14+

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ internal static extern int git_config_get_string(
226226
internal static extern int git_config_add_file_ondisk(
227227
ConfigurationSafeHandle cfg,
228228
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
229-
int priority);
229+
uint level,
230+
bool force);
230231

231232
[DllImport(libgit2)]
232233
internal static extern int git_config_new(out ConfigurationSafeHandle cfg);
@@ -261,8 +262,7 @@ internal static extern int git_config_set_string(
261262
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string value);
262263

263264
internal delegate int config_foreach_callback(
264-
IntPtr var_name,
265-
IntPtr value,
265+
IntPtr entry,
266266
IntPtr payload);
267267

268268
[DllImport(libgit2)]
@@ -591,13 +591,18 @@ internal static extern int git_remote_new(
591591
internal static extern void git_remote_disconnect(RemoteSafeHandle remote);
592592

593593
[DllImport(libgit2)]
594-
internal static extern int git_remote_download(RemoteSafeHandle remote, ref long bytes, ref GitIndexerStats stats);
594+
internal static extern int git_remote_download(
595+
RemoteSafeHandle remote,
596+
git_transfer_progress_callback progress_cb,
597+
IntPtr progress_payload);
595598

596599
[DllImport(libgit2)]
597600
internal static extern void git_remote_set_autotag(RemoteSafeHandle remote, TagFetchMode option);
598601

599602
[DllImport(libgit2)]
600-
internal static extern void git_remote_set_callbacks(RemoteSafeHandle remote, ref GitRemoteCallbacks callbacks);
603+
internal static extern void git_remote_set_callbacks(
604+
RemoteSafeHandle remote,
605+
ref GitRemoteCallbacks callbacks);
601606

602607
internal delegate void remote_progress_callback(IntPtr str, int len, IntPtr data);
603608

@@ -776,6 +781,8 @@ internal static extern int git_tag_delete(
776781
[DllImport(libgit2)]
777782
internal static extern void git_threads_shutdown();
778783

784+
internal delegate void git_transfer_progress_callback(IntPtr stats, IntPtr payload);
785+
779786
[DllImport(libgit2)]
780787
internal static extern int git_tree_create_fromindex(out GitOid treeOid, IndexSafeHandle index);
781788

LibGit2Sharp/Core/Proxy.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ public static ObjectId git_commit_tree_oid(GitObjectSafeHandle obj)
264264

265265
#region git_config_
266266

267-
public static void git_config_add_file_ondisk(ConfigurationSafeHandle config, FilePath path, int priority)
267+
public static void git_config_add_file_ondisk(ConfigurationSafeHandle config, FilePath path, uint level)
268268
{
269269
using (ThreadAffinity())
270270
{
271-
int res = NativeMethods.git_config_add_file_ondisk(config, path, priority);
271+
int res = NativeMethods.git_config_add_file_ondisk(config, path, level, true);
272272
Ensure.Success(res);
273273
}
274274
}
@@ -430,9 +430,9 @@ public static void git_config_set_string(ConfigurationSafeHandle config, string
430430

431431
public static ICollection<TResult> git_config_foreach<TResult>(
432432
ConfigurationSafeHandle config,
433-
Func<IntPtr, IntPtr, TResult> resultSelector)
433+
Func<IntPtr, TResult> resultSelector)
434434
{
435-
return git_foreach(resultSelector, c => NativeMethods.git_config_foreach(config, (x, y, p) => c(x, y, p), IntPtr.Zero));
435+
return git_foreach(resultSelector, c => NativeMethods.git_config_foreach(config, (e, p) => c(e, p), IntPtr.Zero));
436436
}
437437

438438
#endregion
@@ -1041,11 +1041,12 @@ public static void git_remote_disconnect(RemoteSafeHandle remote)
10411041
}
10421042
}
10431043

1044+
// TODO: callback & payload
10441045
public static void git_remote_download(RemoteSafeHandle remote, ref long bytes, ref GitIndexerStats indexerStats)
10451046
{
10461047
using (ThreadAffinity())
10471048
{
1048-
int res = NativeMethods.git_remote_download(remote, ref bytes, ref indexerStats);
1049+
int res = NativeMethods.git_remote_download(remote, null, IntPtr.Zero);
10491050
Ensure.Success(res);
10501051
}
10511052
}

LibGit2Sharp/FileStatus.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,33 @@ public enum FileStatus
3333
/// </summary>
3434
Removed = (1 << 2), /* GIT_STATUS_INDEX_DELETED */
3535

36+
/// <summary>
37+
/// The renaming of a file has been promoted from the working directory to the Index. A previous version exists in the Head.
38+
/// </summary>
39+
Renamed = (1 << 3), /* GIT_STATUS_INDEX_RENAMED */
40+
41+
TypeChangedInIndex = (1 << 4), /* GIT_STATUS_INDEX_TYPECHANGE */
42+
3643
/// <summary>
3744
/// New file in the working directory, unknown from the Index and the Head.
3845
/// </summary>
39-
Untracked = (1 << 3), /* GIT_STATUS_WT_NEW */
46+
Untracked = (1 << 7), /* GIT_STATUS_WT_NEW */
4047

4148
/// <summary>
4249
/// The file has been updated in the working directory. A previous version exists in the Index.
4350
/// </summary>
44-
Modified = (1 << 4), /* GIT_STATUS_WT_MODIFIED */
51+
Modified = (1 << 8), /* GIT_STATUS_WT_MODIFIED */
4552

4653
/// <summary>
4754
/// The file has been deleted from the working directory. A previous version exists in the Index.
4855
/// </summary>
49-
Missing = (1 << 5), /* GIT_STATUS_WT_DELETED */
56+
Missing = (1 << 9), /* GIT_STATUS_WT_DELETED */
57+
58+
TypeChangedInWorkdir = (1 << 10),
5059

5160
/// <summary>
5261
/// The file is <see cref="Untracked"/> but its name and/or path matches an exclude pattern in a <c>gitignore</c> file.
5362
/// </summary>
54-
Ignored = (1 << 6), /* GIT_STATUS_IGNORED */
63+
Ignored = (1 << 14), /* GIT_STATUS_IGNORED */
5564
}
5665
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<Compile Include="ConfigurationEntry.cs" />
7070
<Compile Include="ContentChanges.cs" />
7171
<Compile Include="Core\GitCheckoutOpts.cs" />
72+
<Compile Include="Core\GitConfigEntry.cs" />
7273
<Compile Include="Core\Proxy.cs" />
7374
<Compile Include="Handlers.cs" />
7475
<Compile Include="ReferenceCollectionExtensions.cs" />

LibGit2Sharp/libgit2_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
03452b347ef51f3400e40fb7b33adcb4508dcbe8
1+
a0ce87c51c1a3b1b3b674902148ad28d8e5fa32d

libgit2

Submodule libgit2 updated 225 files

0 commit comments

Comments
 (0)