Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/extensions/default/Git/src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,27 +344,35 @@ define(function (require, exports) {

var _toggleMenuEntriesState = false,
_divider1 = null,
_divider2 = null;
_divider2 = null,
_divider3 = null;
function toggleMenuEntries(bool) {
if (bool === _toggleMenuEntriesState) {
return;
}
var projectCmenu = Menus.getContextMenu(Menus.ContextMenuIds.PROJECT_MENU);
var workingCmenu = Menus.getContextMenu(Menus.ContextMenuIds.WORKING_SET_CONTEXT_MENU);
var tabbarCmenu = Menus.getContextMenu("tabbar-context-menu");
if (bool) {
_divider1 = projectCmenu.addMenuDivider();
_divider2 = workingCmenu.addMenuDivider();
_divider3 = tabbarCmenu.addMenuDivider();
projectCmenu.addMenuItem(CMD_ADD_TO_IGNORE);
workingCmenu.addMenuItem(CMD_ADD_TO_IGNORE);
tabbarCmenu.addMenuItem(CMD_ADD_TO_IGNORE);
projectCmenu.addMenuItem(CMD_REMOVE_FROM_IGNORE);
workingCmenu.addMenuItem(CMD_REMOVE_FROM_IGNORE);
tabbarCmenu.addMenuItem(CMD_REMOVE_FROM_IGNORE);
} else {
projectCmenu.removeMenuDivider(_divider1.id);
workingCmenu.removeMenuDivider(_divider2.id);
tabbarCmenu.removeMenuDivider(_divider3.id);
projectCmenu.removeMenuItem(CMD_ADD_TO_IGNORE);
workingCmenu.removeMenuItem(CMD_ADD_TO_IGNORE);
tabbarCmenu.removeMenuItem(CMD_ADD_TO_IGNORE);
projectCmenu.removeMenuItem(CMD_REMOVE_FROM_IGNORE);
workingCmenu.removeMenuItem(CMD_REMOVE_FROM_IGNORE);
tabbarCmenu.removeMenuItem(CMD_REMOVE_FROM_IGNORE);
}
_toggleMenuEntriesState = bool;
}
Expand Down
4 changes: 4 additions & 0 deletions src/extensions/default/Git/src/ProjectTreeMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,8 @@ define(function (require) {
detachEvents();
});

return {
isIgnored: isIgnored
};

});
17 changes: 16 additions & 1 deletion src/extensions/default/Git/src/TabBarIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define(function (require) {
const Events = require("src/Events");
const Git = require("src/git/Git");
const Preferences = require("src/Preferences");
const ProjectTreeMarks = require("src/ProjectTreeMarks");

// the cache of file statuses by path
let fileStatusCache = {};
Expand Down Expand Up @@ -55,6 +56,19 @@ define(function (require) {
);
}

/**
* whether the file is gitignored or not
*
* @param {string} fullPath - the file path
* @returns {boolean} - if the file is gitignored it returns true otherwise false
*/
function isIgnored(fullPath) {
if (!ProjectTreeMarks || !ProjectTreeMarks.isIgnored) {
return false;
}
return ProjectTreeMarks.isIgnored(fullPath);
}


// Update file status cache when Git status results are received
EventEmitter.on(Events.GIT_STATUS_RESULTS, function (files) {
Expand Down Expand Up @@ -85,6 +99,7 @@ define(function (require) {
return {
getFileStatus: getFileStatus,
isModified: isModified,
isUntracked: isUntracked
isUntracked: isUntracked,
isIgnored: isIgnored
};
});
14 changes: 10 additions & 4 deletions src/extensionsIntegrated/TabBar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,14 @@ define(function (require, exports, module) {
const TabBarIntegration = window.phoenixGitEvents.TabBarIntegration;

// find the Git status
// if untracked we add the git-new class and U char
// if modified we add the git-modified class and M char
if (TabBarIntegration.isUntracked(entry.path)) {
// Check ignored FIRST (takes precedence over other statuses)
// if ignored we add the git-ignored class
// if untracked we add the git-new class
// if modified we add the git-modified class
if (TabBarIntegration.isIgnored(entry.path)) {
gitStatus = "Ignored";
gitStatusClass = "git-ignored";
} else if (TabBarIntegration.isUntracked(entry.path)) {
gitStatus = "Untracked";
gitStatusClass = "git-new";
} else if (TabBarIntegration.isModified(entry.path)) {
Expand Down Expand Up @@ -553,7 +558,7 @@ define(function (require, exports, module) {
const paneId = isSecondPane ? "second-pane" : "first-pane";

// show the context menu at mouse position
MoreOptions.showMoreOptionsContextMenu(paneId, event.pageX, event.pageY, filePath);
MoreOptions.showMoreOptionsContextMenu(paneId, filePath, event.pageX, event.pageY);
});
}

Expand Down Expand Up @@ -768,6 +773,7 @@ define(function (require, exports, module) {
// handle when a single tab gets clicked
handleTabClick();

MoreOptions.init();
Overflow.init();
DragDrop.init($("#phoenix-tab-bar"), $("#phoenix-tab-bar-2"));

Expand Down
Loading
Loading