diff options
Diffstat (limited to 'LibGit2Sharp/SubmoduleExtensions.cs')
-rw-r--r-- | LibGit2Sharp/SubmoduleExtensions.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/LibGit2Sharp/SubmoduleExtensions.cs b/LibGit2Sharp/SubmoduleExtensions.cs new file mode 100644 index 00000000..1c77d1b0 --- /dev/null +++ b/LibGit2Sharp/SubmoduleExtensions.cs @@ -0,0 +1,27 @@ +namespace LibGit2Sharp +{ + /// <summary> + /// Extensions related to submodules + /// </summary> + public static class SubmoduleExtensions + { + private const SubmoduleStatus UnmodifiedMask = ~(SubmoduleStatus.InConfig | SubmoduleStatus.InHead | SubmoduleStatus.InIndex | SubmoduleStatus.InWorkDir); + private const SubmoduleStatus WorkDirDirtyMask = SubmoduleStatus.WorkDirFilesIndexDirty | SubmoduleStatus.WorkDirFilesModified | SubmoduleStatus.WorkDirFilesUntracked; + + /// <summary> + /// The submodule is unmodified. + /// </summary> + public static bool IsUnmodified(this SubmoduleStatus @this) + { + return (@this & UnmodifiedMask) == SubmoduleStatus.Unmodified; + } + + /// <summary> + /// The submodule working directory is dirty. + /// </summary> + public static bool IsWorkingDirectoryDirty(this SubmoduleStatus @this) + { + return (@this & WorkDirDirtyMask) != SubmoduleStatus.Unmodified; + } + } +} |