Skip to content

Commit f2b3153

Browse files
committed
feat: add git ignored support in tab bar
1 parent a1fae56 commit f2b3153

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

src/extensions/default/Git/src/ProjectTreeMarks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,8 @@ define(function (require) {
201201
detachEvents();
202202
});
203203

204+
return {
205+
isIgnored: isIgnored
206+
};
207+
204208
});

src/extensions/default/Git/src/TabBarIntegration.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ define(function (require) {
33
const Events = require("src/Events");
44
const Git = require("src/git/Git");
55
const Preferences = require("src/Preferences");
6+
const ProjectTreeMarks = require("src/ProjectTreeMarks");
67

78
// the cache of file statuses by path
89
let fileStatusCache = {};
@@ -55,6 +56,19 @@ define(function (require) {
5556
);
5657
}
5758

59+
/**
60+
* whether the file is gitignored or not
61+
*
62+
* @param {string} fullPath - the file path
63+
* @returns {boolean} - if the file is gitignored it returns true otherwise false
64+
*/
65+
function isIgnored(fullPath) {
66+
if (!ProjectTreeMarks || !ProjectTreeMarks.isIgnored) {
67+
return false;
68+
}
69+
return ProjectTreeMarks.isIgnored(fullPath);
70+
}
71+
5872

5973
// Update file status cache when Git status results are received
6074
EventEmitter.on(Events.GIT_STATUS_RESULTS, function (files) {
@@ -85,6 +99,7 @@ define(function (require) {
8599
return {
86100
getFileStatus: getFileStatus,
87101
isModified: isModified,
88-
isUntracked: isUntracked
102+
isUntracked: isUntracked,
103+
isIgnored: isIgnored
89104
};
90105
});

src/extensionsIntegrated/TabBar/main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ define(function (require, exports, module) {
150150
const TabBarIntegration = window.phoenixGitEvents.TabBarIntegration;
151151

152152
// find the Git status
153-
// if untracked we add the git-new class and U char
154-
// if modified we add the git-modified class and M char
155-
if (TabBarIntegration.isUntracked(entry.path)) {
153+
// Check ignored FIRST (takes precedence over other statuses)
154+
// if ignored we add the git-ignored class
155+
// if untracked we add the git-new class
156+
// if modified we add the git-modified class
157+
if (TabBarIntegration.isIgnored(entry.path)) {
158+
gitStatus = "Ignored";
159+
gitStatusClass = "git-ignored";
160+
} else if (TabBarIntegration.isUntracked(entry.path)) {
156161
gitStatus = "Untracked";
157162
gitStatusClass = "git-new";
158163
} else if (TabBarIntegration.isModified(entry.path)) {

src/styles/Extn-TabBar.less

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,21 @@
460460
.dark .tab.git-new > .tab-icon:before {
461461
color: #91CC41;
462462
}
463+
464+
.tab.git-ignored .tab-name {
465+
color: #868888 !important;
466+
font-style: italic;
467+
}
468+
469+
.tab.git-ignored .tab-dirname {
470+
color: #868888 !important;
471+
font-style: italic;
472+
}
473+
474+
.dark .tab.git-ignored .tab-name {
475+
color: #868888 !important;
476+
}
477+
478+
.dark .tab.git-ignored .tab-dirname {
479+
color: #868888 !important;
480+
}

0 commit comments

Comments
 (0)