1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.treewalk;
12
13 import org.eclipse.jgit.lib.Config;
14 import org.eclipse.jgit.lib.Config.SectionParser;
15 import org.eclipse.jgit.lib.ConfigConstants;
16 import org.eclipse.jgit.lib.CoreConfig.AutoCRLF;
17 import org.eclipse.jgit.lib.CoreConfig.CheckStat;
18 import org.eclipse.jgit.lib.CoreConfig.EOL;
19 import org.eclipse.jgit.lib.CoreConfig.HideDotFiles;
20 import org.eclipse.jgit.lib.CoreConfig.SymLinks;
21
22
23
24
25 public class WorkingTreeOptions {
26
27 public static final Config.SectionParser<WorkingTreeOptions> KEY =
28 WorkingTreeOptions::new;
29
30 private final boolean fileMode;
31
32 private final AutoCRLF autoCRLF;
33
34 private final EOL eol;
35
36 private final CheckStat checkStat;
37
38 private final SymLinks symlinks;
39
40 private final HideDotFiles hideDotFiles;
41
42 private final boolean dirNoGitLinks;
43
44 private WorkingTreeOptions(Config rc) {
45 fileMode = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION,
46 ConfigConstants.CONFIG_KEY_FILEMODE, true);
47 autoCRLF = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
48 ConfigConstants.CONFIG_KEY_AUTOCRLF, AutoCRLF.FALSE);
49 eol = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
50 ConfigConstants.CONFIG_KEY_EOL, EOL.NATIVE);
51 checkStat = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
52 ConfigConstants.CONFIG_KEY_CHECKSTAT, CheckStat.DEFAULT);
53 symlinks = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
54 ConfigConstants.CONFIG_KEY_SYMLINKS, SymLinks.TRUE);
55 hideDotFiles = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
56 ConfigConstants.CONFIG_KEY_HIDEDOTFILES,
57 HideDotFiles.DOTGITONLY);
58 dirNoGitLinks = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
59 ConfigConstants.CONFIG_KEY_DIRNOGITLINKS,
60 false);
61 }
62
63
64
65
66
67
68
69
70 public boolean isFileMode() {
71 return fileMode;
72 }
73
74
75
76
77
78
79 public AutoCRLF getAutoCRLF() {
80 return autoCRLF;
81 }
82
83
84
85
86
87
88
89 public EOL getEOL() {
90 return eol;
91 }
92
93
94
95
96
97
98
99 public CheckStat getCheckStat() {
100 return checkStat;
101 }
102
103
104
105
106
107
108
109 public SymLinks getSymLinks() {
110 return symlinks;
111 }
112
113
114
115
116
117
118
119 public HideDotFiles getHideDotFiles() {
120 return hideDotFiles;
121 }
122
123
124
125
126
127
128
129
130 public boolean isDirNoGitLinks() { return dirNoGitLinks; }
131 }