Skip to content

Fix workspace operations for filenames with spaces #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2022
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
23 changes: 19 additions & 4 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
if(!isForCurrentUser) {
flag = 1;
}
Expand Down Expand Up @@ -478,7 +483,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
if(!isForCurrentUser) {
flag = 1;
}
Expand Down Expand Up @@ -2090,7 +2100,12 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';

if(isForCurrentUser){
Expand Down Expand Up @@ -2259,7 +2274,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var excluded = excluding != undefined && excluding.indexOf(child.status) != -1;
if ($(child).hasClass("active") && ($(child).hasClass("available")^onlyUnavailable) && included && !excluded) {
if(stringifyFilenames)
files += '"' + (child.model) + '" ';
files += ((child.model) + ' ');
else
files.push(child);
}
Expand Down
23 changes: 19 additions & 4 deletions git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
if(!isForCurrentUser) {
flag = 1;
}
Expand Down Expand Up @@ -478,7 +483,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
if(!isForCurrentUser) {
flag = 1;
}
Expand Down Expand Up @@ -2090,7 +2100,12 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
} else {
model = line;
}
var isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
var isForCurrentUser;
if(model.indexOf(" ") > -1){
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
} else {
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
}
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';

if(isForCurrentUser){
Expand Down Expand Up @@ -2259,7 +2274,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var excluded = excluding != undefined && excluding.indexOf(child.status) != -1;
if ($(child).hasClass("active") && ($(child).hasClass("available")^onlyUnavailable) && included && !excluded) {
if(stringifyFilenames)
files += '"' + (child.model) + '" ';
files += ((child.model) + ' ');
else
files.push(child);
}
Expand Down