Skip to content

Commit 5a43ba4

Browse files
authored
Merge pull request #329 from isc-pbarton/fix-no-stage-add
Fix committing add of new file
2 parents a1286e6 + 2409a90 commit 5a43ba4

File tree

3 files changed

+5
-41
lines changed

3 files changed

+5
-41
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status
526526
set FileType = ##class(SourceControl.Git.Utils).Type(.FileInternalName)
527527

528528
set @..#Storage@("items", FileInternalName) = ""
529-
do ..RunGitCommand("add",.errStream,.outStream,filenames(i))
529+
do ..RunGitCommand("add",.errStream,.outStream,filenames(i),"--intent-to-add")
530530
write !, "Added ", FileInternalName, " to source control."
531531
do ..PrintStreams(outStream, errStream)
532532
}

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21502150
var uncommittedItems = JSON.parse(uncommitted)["current user's changes"];
21512151
var otherDeveloperUncommittedItems = JSON.parse(uncommitted)["other users' changes"];
21522152
self.filesCount = 0;
2153-
var filePaths = [];
21542153
function addItemToFileList(fileList, otherDeveloperUsername, model) {
21552154
var isForCurrentUser = otherDeveloperUsername === ""? true : false;
21562155
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
@@ -2179,15 +2178,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21792178
} else {
21802179
model = line;
21812180
}
2182-
filePaths.push(model);
21832181

2184-
if (workingTreeStatus === "D") {
2185-
localStorage.removeItem(model);
2186-
}
2187-
2188-
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " " && localStorage.getItem(model) === null;
2182+
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " "
21892183
var addUnstagedFile = col == 1 && isNotStaged;
2190-
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?" && localStorage.getItem(model) !== null;
2184+
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?"
21912185
if (addUnstagedFile || addStagedFile) {
21922186
++self.filesCount;
21932187
var isForCurrentUser;
@@ -2217,12 +2211,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22172211
$('[data-toggle="tooltip"]').tooltip()
22182212
});
22192213

2220-
Object.keys(localStorage).filter(function (key) {
2221-
return (filePaths.indexOf(key) === -1);
2222-
}).map(function (key) {
2223-
localStorage.removeItem(key);
2224-
});
2225-
22262214
if (selectedIndex !== null && selectedIndex >= fileList.childElementCount) {
22272215
selectedIndex = fileList.childElementCount - 1;
22282216
if (selectedIndex == -1) {
@@ -2388,12 +2376,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
23882376
var files = self.getFileList(undefined, "D", 0);
23892377
var rmFiles = self.getFileList("D", undefined, 0);
23902378

2391-
if (action === "stage") {
2392-
localStorage.setItem(files.trim(), "staged");
2393-
} else {
2394-
localStorage.removeItem(files.trim());
2395-
}
2396-
23972379
if (files.length != 0) {
23982380
var cmd = type == "working-copy" ? "add" : "reset";
23992381
webui.git(cmd + " -- " + files, function(data) {

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21502150
var uncommittedItems = JSON.parse(uncommitted)["current user's changes"];
21512151
var otherDeveloperUncommittedItems = JSON.parse(uncommitted)["other users' changes"];
21522152
self.filesCount = 0;
2153-
var filePaths = [];
21542153
function addItemToFileList(fileList, otherDeveloperUsername, model) {
21552154
var isForCurrentUser = otherDeveloperUsername === ""? true : false;
21562155
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
@@ -2179,15 +2178,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21792178
} else {
21802179
model = line;
21812180
}
2182-
filePaths.push(model);
21832181

2184-
if (workingTreeStatus === "D") {
2185-
localStorage.removeItem(model);
2186-
}
2187-
2188-
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " " && localStorage.getItem(model) === null;
2182+
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " "
21892183
var addUnstagedFile = col == 1 && isNotStaged;
2190-
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?" && localStorage.getItem(model) !== null;
2184+
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?"
21912185
if (addUnstagedFile || addStagedFile) {
21922186
++self.filesCount;
21932187
var isForCurrentUser;
@@ -2217,12 +2211,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22172211
$('[data-toggle="tooltip"]').tooltip()
22182212
});
22192213

2220-
Object.keys(localStorage).filter(function (key) {
2221-
return (filePaths.indexOf(key) === -1);
2222-
}).map(function (key) {
2223-
localStorage.removeItem(key);
2224-
});
2225-
22262214
if (selectedIndex !== null && selectedIndex >= fileList.childElementCount) {
22272215
selectedIndex = fileList.childElementCount - 1;
22282216
if (selectedIndex == -1) {
@@ -2388,12 +2376,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
23882376
var files = self.getFileList(undefined, "D", 0);
23892377
var rmFiles = self.getFileList("D", undefined, 0);
23902378

2391-
if (action === "stage") {
2392-
localStorage.setItem(files.trim(), "staged");
2393-
} else {
2394-
localStorage.removeItem(files.trim());
2395-
}
2396-
23972379
if (files.length != 0) {
23982380
var cmd = type == "working-copy" ? "add" : "reset";
23992381
webui.git(cmd + " -- " + files, function(data) {

0 commit comments

Comments
 (0)