8000 Expose the assume-unchanged flag to IndexEntry · Issue #928 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content
Expose the assume-unchanged flag to IndexEntry #928
Closed
@zpete

Description

@zpete

I couldn't find a way to find out whether a file is flagged as assume-unchanged. Am I missing something?
If there isn't an solution this could be a possible implementation:

libgit2sharp/LibGit2Sharp/IndexEntry.cs

...

private const ushort GIT_IDXENTRY_VALID = 0x8000;

/// <summary>
/// Whether the file is marked as assume-unchanged
/// </summary>
public bool AssumeUnchanged { get; private set; }
...

internal static IndexEntry BuildFromPtr( IndexEntrySafeHandle handle )
{
    if( handle == null || handle.IsZero )
    {
        return null;
    }

    GitIndexEntry entry = handle.MarshalAsGitIndexEntry();

    FilePath path = LaxFilePathMarshaler.FromNative( entry.Path );

    return new IndexEntry
    {
        AssumeUnchanged = (GIT_IDXENTRY_VALID & entry.Flags) == GIT_IDXENTRY_VALID,
        Path = path.Native,
        Id = entry.Id,
        StageLevel = Proxy.git_index_entry_stage(handle),
        Mode = (Mode)entry.Mode
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0