File tree 3 files changed +23
-1
lines changed 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -466,6 +466,20 @@ public void CanMimicGitAddAll()
466
466
}
467
467
}
468
468
469
+ [ Fact ]
470
+ public void RetrievingAssumedUnchangedMarkedIndexEntries ( )
471
+ {
472
+ var path = SandboxAssumeUnchangedTestRepo ( ) ;
473
+ using ( var repo = new Repository ( path ) )
474
+ {
475
+ var regularFile = repo . Index [ "hello.txt" ] ;
476
+ Assert . False ( regularFile . AssumeUnchanged ) ;
477
+
478
+ var assumeUnchangedFile = repo . Index [ "world.txt" ] ;
479
+ Assert . True ( assumeUnchangedFile . AssumeUnchanged ) ;
480
+ }
481
+ }
482
+
469
483
private static void AddSomeCornerCases ( Repository repo )
470
484
{
471
485
// Turn 1.txt into a directory in the Index
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ namespace LibGit2Sharp.Core
6
6
[ StructLayout ( LayoutKind . Sequential ) ]
7
7
internal class GitIndexEntry
8
8
{
9
+ internal const ushort GIT_IDXENTRY_VALID = 0x8000 ;
10
+
9
11
public GitIndexTime CTime ;
10
12
public GitIndexTime MTime ;
11
13
public uint Dev ;
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ public class IndexEntry : IEquatable<IndexEntry>
30
30
/// </summary>
31
31
public virtual StageLevel StageLevel { get ; private set ; }
32
32
33
+ /// <summary>
34
+ /// Whether the file is marked as assume-unchanged
35
+ /// </summary>
36
+ public virtual bool AssumeUnchanged { get ; private set ; }
37
+
33
38
/// <summary>
34
39
/// Gets the id of the <see cref="Blob"/> pointed at by this index entry.
35
40
/// </summary>
@@ -51,7 +56,8 @@ internal static IndexEntry BuildFromPtr(IndexEntrySafeHandle handle)
51
56
Path = path . Native ,
52
57
Id = entry . Id ,
53
58
StageLevel = Proxy . git_index_entry_stage ( handle ) ,
54
- Mode = ( Mode ) entry . Mode
59
+ Mode = ( Mode ) entry . Mode ,
60
+ AssumeUnchanged = ( GitIndexEntry . GIT_IDXENTRY_VALID & entry . Flags ) == GitIndexEntry . GIT_IDXENTRY_VALID
55
61
} ;
56
62
}
57
63
You can’t perform that action at this time.
0 commit comments