Skip to content

Fix committing add of new file #329

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 24, 2024
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
2 changes: 1 addition & 1 deletion cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status
set FileType = ##class(SourceControl.Git.Utils).Type(.FileInternalName)

set @..#Storage@("items", FileInternalName) = ""
do ..RunGitCommand("add",.errStream,.outStream,filenames(i))
do ..RunGitCommand("add",.errStream,.outStream,filenames(i),"--intent-to-add")
write !, "Added ", FileInternalName, " to source control."
do ..PrintStreams(outStream, errStream)
}
Expand Down
22 changes: 2 additions & 20 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var uncommittedItems = JSON.parse(uncommitted)["current user's changes"];
var otherDeveloperUncommittedItems = JSON.parse(uncommitted)["other users' changes"];
self.filesCount = 0;
var filePaths = [];
function addItemToFileList(fileList, otherDeveloperUsername, model) {
var isForCurrentUser = otherDeveloperUsername === ""? true : false;
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
Expand Down Expand Up @@ -2179,15 +2178,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
} else {
model = line;
}
filePaths.push(model);

if (workingTreeStatus === "D") {
localStorage.removeItem(model);
}

var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " " && localStorage.getItem(model) === null;
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " "
var addUnstagedFile = col == 1 && isNotStaged;
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?" && localStorage.getItem(model) !== null;
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?"
if (addUnstagedFile || addStagedFile) {
++self.filesCount;
var isForCurrentUser;
Expand Down Expand Up @@ -2217,12 +2211,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
$('[data-toggle="tooltip"]').tooltip()
});

Object.keys(localStorage).filter(function (key) {
return (filePaths.indexOf(key) === -1);
}).map(function (key) {
localStorage.removeItem(key);
});

if (selectedIndex !== null && selectedIndex >= fileList.childElementCount) {
selectedIndex = fileList.childElementCount - 1;
if (selectedIndex == -1) {
Expand Down Expand Up @@ -2388,12 +2376,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var files = self.getFileList(undefined, "D", 0);
var rmFiles = self.getFileList("D", undefined, 0);

if (action === "stage") {
localStorage.setItem(files.trim(), "staged");
} else {
localStorage.removeItem(files.trim());
}

if (files.length != 0) {
var cmd = type == "working-copy" ? "add" : "reset";
webui.git(cmd + " -- " + files, function(data) {
Expand Down
22 changes: 2 additions & 20 deletions git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var uncommittedItems = JSON.parse(uncommitted)["current user's changes"];
var otherDeveloperUncommittedItems = JSON.parse(uncommitted)["other users' changes"];
self.filesCount = 0;
var filePaths = [];
function addItemToFileList(fileList, otherDeveloperUsername, model) {
var isForCurrentUser = otherDeveloperUsername === ""? true : false;
var cssClass = isForCurrentUser ? 'list-group-item available' : 'list-group-item unavailable';
Expand Down Expand Up @@ -2179,15 +2178,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
} else {
model = line;
}
filePaths.push(model);

if (workingTreeStatus === "D") {
localStorage.removeItem(model);
}

var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " " && localStorage.getItem(model) === null;
var isNotStaged= workingTreeStatus != "D" && workingTreeStatus != " "
var addUnstagedFile = col == 1 && isNotStaged;
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?" && localStorage.getItem(model) !== null;
var addStagedFile = col == 0 && indexStatus != " " && indexStatus != "?"
if (addUnstagedFile || addStagedFile) {
++self.filesCount;
var isForCurrentUser;
Expand Down Expand Up @@ -2217,12 +2211,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
$('[data-toggle="tooltip"]').tooltip()
});

Object.keys(localStorage).filter(function (key) {
return (filePaths.indexOf(key) === -1);
}).map(function (key) {
localStorage.removeItem(key);
});

if (selectedIndex !== null && selectedIndex >= fileList.childElementCount) {
selectedIndex = fileList.childElementCount - 1;
if (selectedIndex == -1) {
Expand Down Expand Up @@ -2388,12 +2376,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
var files = self.getFileList(undefined, "D", 0);
var rmFiles = self.getFileList("D", undefined, 0);

if (action === "stage") {
localStorage.setItem(files.trim(), "staged");
} else {
localStorage.removeItem(files.trim());
}

if (files.length != 0) {
var cmd = type == "working-copy" ? "add" : "reset";
webui.git(cmd + " -- " + files, function(data) {
Expand Down