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
9 changes: 7 additions & 2 deletions src/extensions/default/Git/src/Branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ define(function (require, exports) {
}
}
});
}).catch(err => {
console.error("Error Getting branches", err);
// we need to strip all user entered info from git thrown exception for get branches which shouldn't fail,
// so we throw a blank error for bugsnag
throw new Error("Failed to get getBranches while doMerge");
});
}

Expand Down Expand Up @@ -168,7 +173,7 @@ define(function (require, exports) {

Git.getAllBranches().catch(function (err) {
ErrorHandler.showError(err);
}).then(function (branches) {
}).then(function (branches = []) {

var compiledTemplate = Mustache.render(newBranchTemplate, {
branches: branches,
Expand Down Expand Up @@ -335,7 +340,7 @@ define(function (require, exports) {

Git.getBranches().catch(function (err) {
ErrorHandler.showError(err, Strings.ERROR_GETTING_BRANCH_LIST);
}).then(function (branches) {
}).then(function (branches = []) {
branches = branches.reduce(function (arr, branch) {
if (!branch.currentBranch && !branch.remote) {
arr.push(branch.name);
Expand Down
33 changes: 25 additions & 8 deletions src/extensions/default/Git/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ define(function (require, exports) {
}

p.catch(function (err) {
ErrorHandler.showError(err, "Preparing commit dialog failed");
ErrorHandler.showError(err, Strings.ERROR_PREPARING_COMMIT_DIALOG);
}).finally(function () {
Utils.unsetLoading($gitPanel.find(".git-commit"));
});
Expand Down Expand Up @@ -956,7 +956,12 @@ define(function (require, exports) {
return Git.resetIndex();
})
.then(function () {
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.CURRENT);
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath],
false, COMMIT_MODE.CURRENT);
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error commitCurrentFile in git panel.js. this should not have happened here.");
});
}

Expand All @@ -967,7 +972,12 @@ define(function (require, exports) {
return Git.resetIndex();
})
.then(function () {
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.ALL);
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath],
false, COMMIT_MODE.ALL);
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error commitAllFiles in git panel.js. this should not have happened here.");
});
}

Expand Down Expand Up @@ -1232,13 +1242,20 @@ define(function (require, exports) {
.on("click", ".check-all", function () {
if ($(this).is(":checked")) {
return Git.stageAll().then(function () {
Git.status();
});
} else {
return Git.resetIndex().then(function () {
Git.status();
return Git.status();
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error stage all by checkbox in git panel.js. this should not have happened");
});
}
return Git.resetIndex().then(function () {
return Git.status();
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error unstage all by checkbox in git panel.js. this should not have happened");
});
})
.on("click", ".git-refresh", EventEmitter.getEmitter(Events.REFRESH_ALL, ["panel", "refreshBtn"]))
.on("click", ".git-commit", EventEmitter.getEmitter(Events.HANDLE_GIT_COMMIT))
Expand Down
38 changes: 23 additions & 15 deletions src/extensions/default/Git/src/dialogs/Progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,17 @@ define(function (require, exports) {
onProgress();
}

let finalValue, finalError;
function finish() {
finished = true;
if (dialog) {
dialog.close();
}
promise.then(function (val) {
resolve(val);
}).catch(function (err) {
reject(err);
});
if(finalError){
reject(finalError);
} else {
resolve(finalValue);
}
}

if (!options.preDelay) {
Expand All @@ -109,17 +110,24 @@ define(function (require, exports) {
progressTracker.on(`${Events.GIT_PROGRESS_EVENT}.progressDlg`, (_evt, data)=>{
onProgress(data);
});
promise.finally(function () {
progressTracker.off(`${Events.GIT_PROGRESS_EVENT}.progressDlg`);
onProgress("Finished!");
if (!options.postDelay || !dialog) {
finish();
} else {
setTimeout(function () {
promise
.then(val => {
finalValue = val;
})
.catch(err => {
finalError = err;
})
.finally(function () {
progressTracker.off(`${Events.GIT_PROGRESS_EVENT}.progressDlg`);
onProgress("Finished!");
if (!options.postDelay || !dialog) {
finish();
}, options.postDelay * 1000);
}
});
} else {
setTimeout(function () {
finish();
}, options.postDelay * 1000);
}
});

});
}
Expand Down
7 changes: 4 additions & 3 deletions src/extensions/default/Git/src/dialogs/Pull.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
define(function (require, exports) {

// Brackets modules
var Dialogs = brackets.getModule("widgets/Dialogs"),
const Dialogs = brackets.getModule("widgets/Dialogs"),
Mustache = brackets.getModule("thirdparty/mustache/mustache");

// Local modules
var Preferences = require("src/Preferences"),
const Preferences = require("src/Preferences"),
RemoteCommon = require("src/dialogs/RemoteCommon"),
Strings = brackets.getModule("strings");

// Templates
var template = require("text!src/dialogs/templates/pull-dialog.html"),
const template = require("text!src/dialogs/templates/pull-dialog.html"),
remotesTemplate = require("text!src/dialogs/templates/remotes-template.html");

// Implementation
Expand Down Expand Up @@ -54,6 +54,7 @@ define(function (require, exports) {
function show(pullConfig) {
return new Promise((resolve, reject) => {
pullConfig.pull = true;
// collectInfo never rejects
RemoteCommon.collectInfo(pullConfig).then(()=>{
_show(pullConfig, resolve, reject);
});
Expand Down
1 change: 1 addition & 0 deletions src/extensions/default/Git/src/dialogs/Push.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ define(function (require, exports) {
function show(pushConfig) {
return new Promise((resolve, reject) => {
pushConfig.push = true;
// collectInfo never rejects
RemoteCommon.collectInfo(pushConfig).then(()=>{
_show(pushConfig, resolve, reject);
});
Expand Down
1 change: 1 addition & 0 deletions src/extensions/default/Git/src/dialogs/RemoteCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define(function (require, exports) {
});
}

// this should never reject for now, just show error message and bail out
exports.collectInfo = function (config) {
return Git.getCurrentUpstreamBranch().then(function (upstreamBranch) {
config.currentTrackingBranch = upstreamBranch;
Expand Down
4 changes: 2 additions & 2 deletions src/loggerSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/*globals Bugsnag, AppConfig, Phoenix*/
/*globals Bugsnag, AppConfig*/
// window.AppConfig comes from appConfig.js built by gulp scripts at build time

(function(){
Expand All @@ -32,7 +32,7 @@
"https://dev.phcode.dev", // dev url
"https://staging.phcode.dev" // staging url
];
let isBugsnagLoggableURL = false;
let isBugsnagLoggableURL = false; // to test bugsnag in dev builds, set this to true
for(let loggableURL of loggableURLS){
if(window.location.href.startsWith(loggableURL)){
isBugsnagLoggableURL = true;
Expand Down
1 change: 1 addition & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ define({
"ERROR_NO_REMOTE_SELECTED": "No remote has been selected for {0}!",
"ERROR_BRANCH_LIST": "Getting branch list failed",
"ERROR_FETCH_REMOTE": "Fetching remote information failed",
"ERROR_PREPARING_COMMIT_DIALOG": "Preparing commit dialog failed",
"GIT_TOAST_TITLE": "Explore Git Features in Phoenix Code",
"GIT_TOAST_MESSAGE": "Click the Git panel icon to manage your repository. Easily commit, push, pull, and view your project history—all in one place.<br><a href='https://docs.phcode.dev/docs/Features/git'>Learn more about the Git panel →</a>",

Expand Down
Loading