Skip to content

Commit 71f8908

Browse files
authored
Merge pull request #298 from intersystems/fix-297-studio-errors
Fix JS bugs in Studio Git WebUI
2 parents 061d6d7 + f0bceba commit 71f8908

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Pulling add/delete of multiple non-IRIS files no longer causes error (#273)
2323
- Fixed -2 timestamp for some items (#275)
2424
- Reset SourceControlClass during module uninstall to prevent "Class does not exist error" (#285)
25+
- Unreleased bug breaking Git WebUI from Studio (#297)
2526

2627
## [2.2.0] - 2023-06-05
2728

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,14 @@ webui.SideBarView = function(mainView, noEventHandlers) {
323323
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
324324
if (id.indexOf("local-branches") > -1) {
325325
// parses the output of git branch --verbose --verbose
326-
var branchInfo = /^\*?\s*(?<branch_name>[\w-]+)\s+(?<hash>[^\s]+)\s+(?<remote>\[.*\])?.*/.exec(ref).groups;
326+
var matches = /^\*?\s*([\w-]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
327+
var branchInfo = {
328+
"branch_name": matches[1],
329+
"hash": matches[2],
330+
"remote": matches[3]
331+
}
327332
var refname = branchInfo.branch_name;
328-
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.includes("ahead")) // either no upstream or ahead of upstream
333+
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.indexOf("ahead") > -1) // either no upstream or ahead of upstream
329334
var itemId = refname + idPostfix;
330335
var cardHeader = $('<div class="card-header" id="heading-' + itemId + '">').appendTo(cardDiv);
331336
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
@@ -656,7 +661,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
656661
e.preventDefault();
657662
var refName = $(this).parent().parent().parent().siblings(
658663
".card-header").children("button").html();
659-
webui.git(`push -u origin ${refName}`, "", self.upToDateHandler)
664+
webui.git('push -u origin '+refName, "", self.upToDateHandler)
660665
}
661666

662667
self.goToSettingsPage = function() {

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,14 @@ webui.SideBarView = function(mainView, noEventHandlers) {
323323
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
324324
if (id.indexOf("local-branches") > -1) {
325325
// parses the output of git branch --verbose --verbose
326-
var branchInfo = /^\*?\s*(?<branch_name>[\w-]+)\s+(?<hash>[^\s]+)\s+(?<remote>\[.*\])?.*/.exec(ref).groups;
326+
var matches = /^\*?\s*([\w-]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
327+
var branchInfo = {
328+
"branch_name": matches[1],
329+
"hash": matches[2],
330+
"remote": matches[3]
331+
}
327332
var refname = branchInfo.branch_name;
328-
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.includes("ahead")) // either no upstream or ahead of upstream
333+
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.indexOf("ahead") > -1) // either no upstream or ahead of upstream
329334
var itemId = refname + idPostfix;
330335
var cardHeader = $('<div class="card-header" id="heading-' + itemId + '">').appendTo(cardDiv);
331336
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
@@ -656,7 +661,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
656661
e.preventDefault();
657662
var refName = $(this).parent().parent().parent().siblings(
658663
".card-header").children("button").html();
659-
webui.git(`push -u origin ${refName}`, "", self.upToDateHandler)
664+
webui.git('push -u origin '+refName, "", self.upToDateHandler)
660665
}
661666

662667
self.goToSettingsPage = function() {

0 commit comments

Comments
 (0)