Skip to content

Commit 11c30d9

Browse files
authored
Fix workspace operations for filenames with spaces (#181)
* User check now works properly for files with spaces in the name * All workspace operations now work with filenames with spaces in them. Co-authored-by: Sarmishta Velury <[email protected]>
1 parent 2cb3ad9 commit 11c30d9

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

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

+19-4
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
405405
} else {
406406
model = line;
407407
}
408-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
408+
var isForCurrentUser;
409+
if(model.indexOf(" ") > -1){
410+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
411+
} else {
412+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
413+
}
409414
if(!isForCurrentUser) {
410415
flag = 1;
411416
}
@@ -478,7 +483,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
478483
} else {
479484
model = line;
480485
}
481-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
486+
var isForCurrentUser;
487+
if(model.indexOf(" ") > -1){
488+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
489+
} else {
490+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
491+
}
482492
if(!isForCurrentUser) {
483493
flag = 1;
484494
}
@@ -2090,7 +2100,12 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
20902100
} else {
20912101
model = line;
20922102
}
2093-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
2103+
var isForCurrentUser;
2104+
if(model.indexOf(" ") > -1){
2105+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
2106+
} else {
2107+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
2108+
}
20942109
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
20952110

20962111
if(isForCurrentUser){
@@ -2259,7 +2274,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22592274
var excluded = excluding != undefined && excluding.indexOf(child.status) != -1;
22602275
if ($(child).hasClass("active") && ($(child).hasClass("available")^onlyUnavailable) && included && !excluded) {
22612276
if(stringifyFilenames)
2262-
files += '"' + (child.model) + '" ';
2277+
files += ((child.model) + ' ');
22632278
else
22642279
files.push(child);
22652280
}

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

+19-4
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
405405
} else {
406406
model = line;
407407
}
408-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
408+
var isForCurrentUser;
409+
if(model.indexOf(" ") > -1){
410+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
411+
} else {
412+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
413+
}
409414
if(!isForCurrentUser) {
410415
flag = 1;
411416
}
@@ -478,7 +483,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
478483
} else {
479484
model = line;
480485
}
481-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
486+
var isForCurrentUser;
487+
if(model.indexOf(" ") > -1){
488+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
489+
} else {
490+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
491+
}
482492
if(!isForCurrentUser) {
483493
flag = 1;
484494
}
@@ -2090,7 +2100,12 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
20902100
} else {
20912101
model = line;
20922102
}
2093-
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
2103+
var isForCurrentUser;
2104+
if(model.indexOf(" ") > -1){
2105+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
2106+
} else {
2107+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
2108+
}
20942109
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
20952110

20962111
if(isForCurrentUser){
@@ -2259,7 +2274,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22592274
var excluded = excluding != undefined && excluding.indexOf(child.status) != -1;
22602275
if ($(child).hasClass("active") && ($(child).hasClass("available")^onlyUnavailable) && included && !excluded) {
22612276
if(stringifyFilenames)
2262-
files += '"' + (child.model) + '" ';
2277+
files += ((child.model) + ' ');
22632278
else
22642279
files.push(child);
22652280
}

0 commit comments

Comments
 (0)