using System;
using System.Runtime.InteropServices;
namespace LibGit2Sharp.Core
{
[Flags]
internal enum CheckoutStrategy
{
///
/// Default is a dry run, no actual updates.
///
GIT_CHECKOUT_NONE = 0,
///
/// Allow safe updates that cannot overwrite uncommited data.
///
GIT_CHECKOUT_SAFE = (1 << 0),
///
/// Allow safe updates plus creation of missing files.
///
GIT_CHECKOUT_SAFE_CREATE = (1 << 1),
///
/// Allow update of entries in working dir that are modified from HEAD.
///
GIT_CHECKOUT_FORCE = (1 << 2),
///
/// Allow checkout to make safe updates even if conflicts are found
///
GIT_CHECKOUT_ALLOW_CONFLICTS = (1 << 4),
///
/// Remove untracked files not in index (that are not ignored)
///
GIT_CHECKOUT_REMOVE_UNTRACKED = (1 << 5),
///
/// Remove ignored files not in index
///
GIT_CHECKOUT_REMOVE_IGNORED = (1 << 6),
///
/// Only update existing files, don't create new ones
///
GIT_CHECKOUT_UPDATE_ONLY = (1 << 7),
///
/// Normally checkout updates index entries as it goes; this stops that
///
GIT_CHECKOUT_DONT_UPDATE_INDEX = (1 << 8),
///
/// Don't refresh index/config/etc before doing checkout
///
GIT_CHECKOUT_NO_REFRESH = (1 << 9),
///Allow checkout to skip unmerged files (NOT IMPLEMENTED)
GIT_CHECKOUT_SKIP_UNMERGED = (1 << 10),
///
/// For unmerged files, checkout stage 2 from index (NOT IMPLEMENTED)
///
GIT_CHECKOUT_USE_OURS = (1 << 11),
///
/// For unmerged files, checkout stage 3 from index (NOT IMPLEMENTED)
///
GIT_CHECKOUT_USE_THEIRS = (1 << 12),
///
/// Recursively checkout submodules with same options (NOT IMPLEMENTED)
///
GIT_CHECKOUT_UPDATE_SUBMODULES = (1 << 16),
///
/// Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED)
///
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1 << 17),
}
internal delegate int checkout_notify_cb(
CheckoutNotifyFlags why,
IntPtr path,
IntPtr baseline,
IntPtr target,
IntPtr workdir,
IntPtr payload);
internal delegate void progress_cb(
IntPtr strPtr,
UIntPtr completed_steps,
UIntPtr total_steps,
IntPtr payload);
[StructLayout(LayoutKind.Sequential)]
internal struct GitCheckoutOpts :IDisposable
{
public uint version;
public CheckoutStrategy checkout_strategy;
public int DisableFilters;
public uint DirMode;
public uint FileMode;
public int FileOpenFlags;
public CheckoutNotifyFlags notify_flags;
public checkout_notify_cb notify_cb;
public IntPtr notify_payload;
public progress_cb progress_cb;
public IntPtr progress_payload;
public GitStrArrayIn paths;
public IntPtr baseline;
public IntPtr target_directory;
public IntPtr our_label;
public IntPtr their_label;
public void Dispose()
{
if (paths == null)
{
return;
}
paths.Dispose();
}
}
}