fix(index): preserve selection on bulk stage operations
This commit is contained in:
@@ -912,17 +912,31 @@ bool GitManager::redoCommit(RepositoryView &repository, std::string &error)
|
||||
|
||||
bool GitManager::stageAll(RepositoryView &repository, std::string &error)
|
||||
{
|
||||
return runGit(repository, {"add", "--all"}, "All changes staged", error);
|
||||
if (!runGit(repository, {"add", "--all"}, "All changes staged", error, false))
|
||||
return false;
|
||||
loadWorkingTree(repository);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitManager::unstageAll(RepositoryView &repository, std::string &error)
|
||||
{
|
||||
if (git_repository_head_unborn(repository.repo) == 1)
|
||||
return runGit(repository, {"rm", "--cached", "-r", "--ignore-unmatch", "--", "."},
|
||||
"All changes unstaged", error);
|
||||
if (runGit(repository, {"restore", "--staged", "--", "."}, "All changes unstaged", error))
|
||||
{
|
||||
if (!runGit(repository, {"rm", "--cached", "-r", "--ignore-unmatch", "--", "."},
|
||||
"All changes unstaged", error, false))
|
||||
return false;
|
||||
loadWorkingTree(repository);
|
||||
return true;
|
||||
return runGit(repository, {"reset", "HEAD", "--", "."}, "All changes unstaged", error);
|
||||
}
|
||||
if (runGit(repository, {"restore", "--staged", "--", "."}, "All changes unstaged", error, false))
|
||||
{
|
||||
loadWorkingTree(repository);
|
||||
return true;
|
||||
}
|
||||
if (!runGit(repository, {"reset", "HEAD", "--", "."}, "All changes unstaged", error, false))
|
||||
return false;
|
||||
loadWorkingTree(repository);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitManager::stageFile(RepositoryView &repository, const std::string &path, std::string &error)
|
||||
|
||||
Reference in New Issue
Block a user