Skip to content

Commit

Permalink
Merge pull request #1049 from libgit2/ntk/upgrade_nuget
Browse files Browse the repository at this point in the history
Upgrade to libgit2 ff8d635
  • Loading branch information
nulltoken committed May 29, 2015
2 parents 73740ff + 6c12de4 commit 27abed1
Show file tree
Hide file tree
Showing 32 changed files with 372 additions and 194 deletions.
12 changes: 12 additions & 0 deletions LibGit2Sharp.Tests/FetchFixture.cs
Expand Up @@ -134,6 +134,18 @@ public void CanFetchCustomRefSpecsIntoAnEmptyRepository(string url, string local
var expectedFetchState = new ExpectedFetchState(remoteName);
expectedFetchState.AddExpectedBranch(localBranchName, ObjectId.Zero, remoteInfo.BranchTips[remoteBranchName]);

// Let's account for opportunistic updates during the Fetch() call
if (!string.Equals("master", localBranchName, StringComparison.OrdinalIgnoreCase))
{
expectedFetchState.AddExpectedBranch("master", ObjectId.Zero, remoteInfo.BranchTips["master"]);
}

if (string.Equals("master", localBranchName, StringComparison.OrdinalIgnoreCase)
&& !string.Equals("master", remoteBranchName, StringComparison.OrdinalIgnoreCase))
{
expectedFetchState.AddExpectedBranch(remoteBranchName, ObjectId.Zero, remoteInfo.BranchTips[remoteBranchName]);
}

// Perform the actual fetch
repo.Network.Fetch(remote, new string[] { refSpec }, new FetchOptions {
TagFetchMode = TagFetchMode.None,
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/RefSpecFixture.cs
Expand Up @@ -183,7 +183,7 @@ public void SettingInvalidRefSpecsThrows(string refSpec)
var remote = repo.Network.Remotes["origin"];
var oldRefSpecs = remote.RefSpecs.Select(r => r.Specification).ToList();

Assert.Throws<LibGit2SharpException>(() =>
Assert.Throws<InvalidSpecificationException>(() =>
repo.Network.Remotes.Update(remote, r => r.FetchRefSpecs.Add(refSpec)));

var newRemote = repo.Network.Remotes["origin"];
Expand Down
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
25 changes: 25 additions & 0 deletions LibGit2Sharp/Core/FetchPruneStrategy.cs
@@ -0,0 +1,25 @@
namespace LibGit2Sharp.Core
{
/// <summary>
/// Specify how the remote tracking branches should be locally dealt with
/// when their upstream countepart doesn't exist anymore.
/// </summary>
internal enum FetchPruneStrategy
{
/// <summary>
/// Use the setting from the configuration
/// or, when there isn't any, fallback to default behavior.
/// </summary>
FromConfigurationOrDefault = 0,

/// <summary>
/// Force pruning on
/// </summary>
Prune,

/// <summary>
/// Force pruning off
/// </summary>
NoPrune,
}
}
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
14 changes: 14 additions & 0 deletions LibGit2Sharp/Core/GitFetchOptions.cs
@@ -0,0 +1,14 @@
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 UpdateFetchHead = true;
public TagFetchMode download_tags;
}
}
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;
}
}
64 changes: 59 additions & 5 deletions LibGit2Sharp/Core/GitMergeOpts.cs
Expand Up @@ -31,6 +31,11 @@ internal struct GitMergeOpts
/// Flags for automerging content.
/// </summary>
public MergeFileFavor MergeFileFavorFlags;

/// <summary>
/// File merging flags.
/// </summary>
public GitMergeFileFlags FileFlags;
}

/// <summary>
Expand Down Expand Up @@ -63,11 +68,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 +110,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),
}
}
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitOdbBackend.cs
Expand Up @@ -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

0 comments on commit 27abed1

Please sign in to comment.