|
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using System.Linq;
|
4 | 4 | using System.Text;
|
| 5 | +using System.Threading.Tasks; |
5 | 6 | using System.Runtime.InteropServices;
|
6 |
| -using System.ComponentModel; |
7 | 7 |
|
8 | 8 | namespace Rubberduck.SourceControl
|
9 | 9 | {
|
| 10 | + //This file was taken from the [Lib2GitSharp project][1] so this enum could be exposed to COM interop. |
| 11 | + //Otherwise, this file remains unchanged. |
| 12 | + // |
| 13 | + //[1]:https://github.com/libgit2/libgit2sharp/ |
| 14 | + // |
| 15 | + //The MIT License |
| 16 | + //Copyright (c) LibGit2Sharp contributors |
| 17 | + // |
| 18 | + //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), |
| 19 | + //to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 20 | + //and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| 21 | + //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| 22 | + // |
| 23 | + //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | + //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 25 | + //WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// Calculated status of a filepath in the working directory. |
| 29 | + /// </summary> |
| 30 | + [Flags] |
10 | 31 | [ComVisible(true)]
|
11 |
| - [Guid("577CB2D3-A84B-44FF-94EF-F4FC78363D74")] |
12 |
| - public interface IFileStatusEntry |
| 32 | + [Guid("4DDA743E-E3A7-440A-A030-92DF616B2C7B")] |
| 33 | + public enum FileStatus |
13 | 34 | {
|
14 |
| - [DispId(0)] |
15 |
| - string FilePath { get; } |
| 35 | + /// <summary> |
| 36 | + /// The file doesn't exist. |
| 37 | + /// </summary> |
| 38 | + Nonexistent = (1 << 31), |
16 | 39 |
|
17 |
| - //todo: find a way to make this com visible, even if you have to borrow the source code and cast (int) between them. |
18 |
| - [DispId(1)] |
19 |
| - LibGit2Sharp.FileStatus FileStatus { get; } |
20 |
| - } |
| 40 | + /// <summary> |
| 41 | + /// The file hasn't been modified. |
| 42 | + /// </summary> |
| 43 | + Unaltered = 0, /* GIT_STATUS_CURRENT */ |
21 | 44 |
|
22 |
| - [ComVisible(true)] |
23 |
| - [Guid("13AA3AF6-1397-4017-9E97-CBAD6A65FAFA")] |
24 |
| - [ProgId("Rubberduck.FileStatus")] |
25 |
| - [ClassInterface(ClassInterfaceType.AutoDual)] |
26 |
| - public class FileStatusEntry : IFileStatusEntry |
27 |
| - { |
28 |
| - public string FilePath { get; private set; } |
29 |
| - public LibGit2Sharp.FileStatus FileStatus { get; private set; } |
| 45 | + /// <summary> |
| 46 | + /// New file has been added to the Index. It's unknown from the Head. |
| 47 | + /// </summary> |
| 48 | + Added = (1 << 0), /* GIT_STATUS_INDEX_NEW */ |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// New version of a file has been added to the Index. A previous version exists in the Head. |
| 52 | + /// </summary> |
| 53 | + Staged = (1 << 1), /* GIT_STATUS_INDEX_MODIFIED */ |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// The deletion of a file has been promoted from the working directory to the Index. A previous version exists in the Head. |
| 57 | + /// </summary> |
| 58 | + Removed = (1 << 2), /* GIT_STATUS_INDEX_DELETED */ |
| 59 | + |
| 60 | + /// <summary> |
| 61 | + /// The renaming of a file has been promoted from the working directory to the Index. A previous version exists in the Head. |
| 62 | + /// </summary> |
| 63 | + RenamedInIndex = (1 << 3), /* GIT_STATUS_INDEX_RENAMED */ |
| 64 | + |
| 65 | + /// <summary> |
| 66 | + /// A change in type for a file has been promoted from the working directory to the Index. A previous version exists in the Head. |
| 67 | + /// </summary> |
| 68 | + StagedTypeChange = (1 << 4), /* GIT_STATUS_INDEX_TYPECHANGE */ |
| 69 | + |
| 70 | + /// <summary> |
| 71 | + /// New file in the working directory, unknown from the Index and the Head. |
| 72 | + /// </summary> |
| 73 | + Untracked = (1 << 7), /* GIT_STATUS_WT_NEW */ |
| 74 | + |
| 75 | + /// <summary> |
| 76 | + /// The file has been updated in the working directory. A previous version exists in the Index. |
| 77 | + /// </summary> |
| 78 | + Modified = (1 << 8), /* GIT_STATUS_WT_MODIFIED */ |
| 79 | + |
| 80 | + /// <summary> |
| 81 | + /// The file has been deleted from the working directory. A previous version exists in the Index. |
| 82 | + /// </summary> |
| 83 | + Missing = (1 << 9), /* GIT_STATUS_WT_DELETED */ |
| 84 | + |
| 85 | + /// <summary> |
| 86 | + /// The file type has been changed in the working directory. A previous version exists in the Index. |
| 87 | + /// </summary> |
| 88 | + TypeChanged = (1 << 10), /* GIT_STATUS_WT_TYPECHANGE */ |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// The file has been renamed in the working directory. The previous version at the previous name exists in the Index. |
| 92 | + /// </summary> |
| 93 | + RenamedInWorkDir = (1 << 11), /* GIT_STATUS_WT_RENAMED */ |
30 | 94 |
|
31 |
| - public FileStatusEntry(string filePath, LibGit2Sharp.FileStatus fileStatus) |
32 |
| - { |
33 |
| - this.FilePath = filePath; |
34 |
| - this.FileStatus = fileStatus; |
35 |
| - } |
| 95 | + /// <summary> |
| 96 | + /// The file is unreadable in the working directory. |
| 97 | + /// </summary> |
| 98 | + Unreadable = (1 << 12), /* GIT_STATUS_WT_UNREADABLE */ |
36 | 99 |
|
37 |
| - public FileStatusEntry(LibGit2Sharp.StatusEntry status) |
38 |
| - : this(status.FilePath, status.State) { } |
| 100 | + /// <summary> |
| 101 | + /// The file is <see cref="Untracked"/> but its name and/or path matches an exclude pattern in a <c>gitignore</c> file. |
| 102 | + /// </summary> |
| 103 | + Ignored = (1 << 14), /* GIT_STATUS_IGNORED */ |
39 | 104 | }
|
40 | 105 | }
|
0 commit comments