Skip to content

Commit

Permalink
Update libgit2 to 9042693
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed May 17, 2015
1 parent b444ff3 commit 5b506be
Show file tree
Hide file tree
Showing 30 changed files with 362 additions and 161 deletions.
10 changes: 10 additions & 0 deletions LibGit2Sharp/Configuration.cs
Expand Up @@ -151,6 +151,16 @@ public virtual void Unset(string key, ConfigurationLevel level)
}
}

internal void UnsetMultivar(string key, ConfigurationLevel level)
{
Ensure.ArgumentNotNullOrEmptyString(key, "key");

using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true, configHandle))
{
Proxy.git_config_delete_multivar(h, key);
}
}

/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitCheckoutOpts.cs
Expand Up @@ -158,6 +158,7 @@ internal struct GitCheckoutOpts
public GitStrArray paths;

public IntPtr baseline;
public IntPtr baseline_index;
public IntPtr target_directory;

public IntPtr ancestor_label;
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitCloneOptions.cs
Expand Up @@ -17,7 +17,7 @@ internal struct GitCloneOptions
public uint Version;

public GitCheckoutOpts CheckoutOpts;
public GitRemoteCallbacks RemoteCallbacks;
public GitFetchOptions FetchOpts;

public int Bare;
public GitCloneLocal Local;
Expand Down
7 changes: 7 additions & 0 deletions LibGit2Sharp/Core/GitDiff.cs
Expand Up @@ -80,6 +80,13 @@ internal enum GitDiffOptionFlags
/// </summary>
GIT_DIFF_IGNORE_CASE = (1 << 10),


/// <summary>
/// May be combined with `GIT_DIFF_IGNORE_CASE` to specify that a file
/// that has changed case will be returned as an add/delete pair.
/// </summary>
GIT_DIFF_INCLUDE_CASECHANGE = (1 << 11),

/// <summary>
/// If the pathspec is set in the diff options, this flags means to
/// apply it as an exact match instead of as an fnmatch pattern.
Expand Down
19 changes: 19 additions & 0 deletions LibGit2Sharp/Core/GitFetchOptions.cs
@@ -0,0 +1,19 @@
using System.Runtime.InteropServices;

namespace LibGit2Sharp.Core
{
[StructLayout(LayoutKind.Sequential)]
internal class GitFetchOptions
{
public int Version = 1;
public GitRemoteCallbacks RemoteCallbacks;
public FetchPruneStrategy prune;
public bool update_fetchhead = true;
public TagFetchMode download_tags;

public GitFetchOptions()
{
download_tags = TagFetchMode.Auto;
}
}
}
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitIndexEntry.cs
Expand Up @@ -15,7 +15,7 @@ internal class GitIndexEntry
public uint Mode;
public uint Uid;
public uint Gid;
public Int64 file_size;
public uint file_size;
public GitOid Id;
public ushort Flags;
public ushort ExtendedFlags;
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitIndexTime.cs
Expand Up @@ -5,7 +5,7 @@ namespace LibGit2Sharp.Core
[StructLayout(LayoutKind.Sequential)]
internal class GitIndexTime
{
public long seconds;
public int seconds;
public uint nanoseconds;
}
}
61 changes: 56 additions & 5 deletions LibGit2Sharp/Core/GitMergeOpts.cs
Expand Up @@ -31,6 +31,8 @@ internal struct GitMergeOpts
/// Flags for automerging content.
/// </summary>
public MergeFileFavor MergeFileFavorFlags;

public GitMergeFileFlags file_flags;
}

/// <summary>
Expand Down Expand Up @@ -63,11 +65,11 @@ internal enum GitMergeAnalysis
/// </summary>
GIT_MERGE_ANALYSIS_FASTFORWARD = (1 << 2),

/**
* The HEAD of the current repository is "unborn" and does not point to
* a valid commit. No merge can be performed, but the caller may wish
* to simply set HEAD to the target commit(s).
*/
/// <summary>
/// The HEAD of the current repository is "unborn" and does not point to
/// a valid commit. No merge can be performed, but the caller may wish
/// to simply set HEAD to the target commit(s).
/// </summary>
GIT_MERGE_ANALYSIS_UNBORN = (1 << 3),
}

Expand Down Expand Up @@ -105,4 +107,53 @@ internal enum GitMergeTreeFlags
/// </summary>
GIT_MERGE_TREE_FIND_RENAMES = (1 << 0),
}

[Flags]
internal enum GitMergeFileFlags
{
/// <summary>
/// Defaults
/// </summary>
GIT_MERGE_FILE_DEFAULT = 0,

/// <summary>
/// Create standard conflicted merge files
/// </summary>
GIT_MERGE_FILE_STYLE_MERGE = (1 << 0),

/// <summary>
/// Create diff3-style files
/// </summary>
GIT_MERGE_FILE_STYLE_DIFF3 = (1 << 1),

/// <summary>
/// Condense non-alphanumeric regions for simplified diff file
/// </summary>
GIT_MERGE_FILE_SIMPLIFY_ALNUM = (1 << 2),

/// <summary>
/// Ignore all whitespace
/// </summary>
GIT_MERGE_FILE_IGNORE_WHITESPACE = (1 << 3),

/// <summary>
/// Ignore changes in amount of whitespace
/// </summary>
GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE = (1 << 4),

/// <summary>
/// Ignore whitespace at end of line
/// </summary>
GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = (1 << 5),

/// <summary>
/// Use the "patience diff" algorithm
/// </summary>
GIT_MERGE_FILE_DIFF_PATIENCE = (1 << 6),

/// <summary>
/// Take extra time to find minimal diff
/// </summary>
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
}
}
4 changes: 2 additions & 2 deletions LibGit2Sharp/Core/GitOdbBackend.cs
Expand Up @@ -114,7 +114,7 @@ static GitOdbBackend()
IntPtr backend,
ref GitOid oid,
IntPtr data,
UIntPtr len,
Int64 len,
GitObjectType type);

/// <summary>
Expand All @@ -130,7 +130,7 @@ static GitOdbBackend()
public delegate int writestream_callback(
out IntPtr stream_out,
IntPtr backend,
UIntPtr length,
Int64 length,
GitObjectType type);

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp/Core/GitOdbBackendStream.cs
Expand Up @@ -22,8 +22,8 @@ static GitOdbBackendStream()
public GitOdbBackendStreamMode Mode;
public IntPtr HashCtx;

public UIntPtr DeclaredSize;
public UIntPtr ReceivedBytes;
public Int64 DeclaredSize;
public Int64 ReceivedBytes;

public read_callback Read;
public write_callback Write;
Expand Down
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitPushOptions.cs
Expand Up @@ -7,5 +7,6 @@ internal class GitPushOptions
{
public int Version = 1;
public int PackbuilderDegreeOfParallelism;
public GitRemoteCallbacks RemoteCallbacks;
}
}
14 changes: 14 additions & 0 deletions LibGit2Sharp/Core/GitPushUpdate.cs
@@ -0,0 +1,14 @@
using System;
using System.Runtime.InteropServices;

namespace LibGit2Sharp.Core
{
[StructLayout(LayoutKind.Sequential)]
internal class GitPushUpdate
{
IntPtr src_refname;
IntPtr dst_refname;
GitOid src;
GitOid dst;
}
}
4 changes: 4 additions & 0 deletions LibGit2Sharp/Core/GitRemoteCallbacks.cs
Expand Up @@ -29,6 +29,10 @@ internal struct GitRemoteCallbacks

internal NativeMethods.push_update_reference_callback push_update_reference;

internal NativeMethods.push_negotiation_callback push_negotiation;

internal IntPtr transport;

internal IntPtr payload;
}
}
4 changes: 3 additions & 1 deletion LibGit2Sharp/Core/GitSmartSubtransportRegistration.cs
Expand Up @@ -8,9 +8,11 @@ internal class GitSmartSubtransportRegistration
{
public IntPtr SubtransportCallback;
public uint Rpc;
public uint Param;

public delegate int create_callback(
out IntPtr subtransport,
IntPtr transport);
IntPtr owner,
IntPtr param);
}
}
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitSubmoduleOptions.cs
Expand Up @@ -9,7 +9,7 @@ internal struct GitSubmoduleOptions

public GitCheckoutOpts CheckoutOptions;

public GitRemoteCallbacks RemoteCallbacks;
public GitFetchOptions FetchOptions;

public CheckoutStrategy CloneCheckoutStrategy;
}
Expand Down
53 changes: 39 additions & 14 deletions LibGit2Sharp/Core/NativeMethods.cs
Expand Up @@ -276,6 +276,12 @@ static NativeMethods()
ConfigurationSafeHandle cfg,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (StrictUtf8Marshaler))] string name);

[DllImport(libgit2)]
internal static extern int git_config_delete_multivar(
ConfigurationSafeHandle cfg,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (StrictUtf8Marshaler))] string name,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string regexp);

[DllImport(libgit2)]
internal static extern int git_config_find_global(GitBuf global_config_path);

Expand Down Expand Up @@ -746,7 +752,7 @@ static NativeMethods()

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

internal delegate int git_note_foreach_cb(
Expand Down Expand Up @@ -781,7 +787,7 @@ static NativeMethods()
IntPtr payload);

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

[DllImport(libgit2)]
internal static extern void git_odb_free(IntPtr odb);
Expand Down Expand Up @@ -998,7 +1004,10 @@ static NativeMethods()
internal static extern int git_remote_autotag(RemoteSafeHandle remote);

[DllImport(libgit2)]
internal static extern int git_remote_connect(RemoteSafeHandle remote, GitDirection direction);
internal static extern int git_remote_connect(
RemoteSafeHandle remote,
GitDirection direction,
ref GitRemoteCallbacks callbacks);

[DllImport(libgit2)]
internal static extern int git_remote_create(
Expand Down Expand Up @@ -1035,6 +1044,7 @@ static NativeMethods()
internal static extern int git_remote_fetch(
RemoteSafeHandle remote,
ref GitStrArray refspecs,
GitFetchOptions fetch_opts,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);

[DllImport(libgit2)]
Expand Down Expand Up @@ -1066,12 +1076,26 @@ static NativeMethods()

[DllImport(libgit2)]
internal static extern int git_remote_set_url(
RemoteSafeHandle remote,
RepositorySafeHandle repo,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);

[DllImport(libgit2)]
internal static extern int git_remote_add_fetch(
RepositorySafeHandle repo,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);

[DllImport(libgit2)]
internal static extern int git_remote_set_pushurl(
RemoteSafeHandle remote,
RepositorySafeHandle repo,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);

[DllImport(libgit2)]
internal static extern int git_remote_add_push(
RepositorySafeHandle repo,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);

[DllImport(libgit2)]
Expand All @@ -1096,9 +1120,6 @@ static NativeMethods()
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
internal static extern string git_remote_name(RemoteSafeHandle remote);

[DllImport(libgit2)]
internal static extern int git_remote_save(RemoteSafeHandle remote);

[DllImport(libgit2)]
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
internal static extern string git_remote_url(RemoteSafeHandle remote);
Expand All @@ -1108,12 +1129,10 @@ static NativeMethods()
internal static extern string git_remote_pushurl(RemoteSafeHandle remote);

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

[DllImport(libgit2)]
internal static extern int git_remote_set_callbacks(
RemoteSafeHandle remote,
ref GitRemoteCallbacks callbacks);
internal static extern void git_remote_set_autotag(
RepositorySafeHandle repo,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
TagFetchMode option);

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

Expand All @@ -1125,6 +1144,12 @@ static NativeMethods()
ref GitOid newId,
IntPtr data);

internal delegate int push_negotiation_callback(
IntPtr updates, // GitPushUpdate?
UIntPtr len,
IntPtr payload
);

internal delegate int push_update_reference_callback(
IntPtr refName,
IntPtr status,
Expand Down

0 comments on commit 5b506be

Please sign in to comment.