Present iPhone Git actions (#51)
This commit is contained in:
1 parent
fcf649e56d
commit
65eb1da71c
8 files changed
+1054
-90
No files matched your search
@@ -2255,6 +2255,25 @@ impl GitRepository {
|
||||
self.commit_tree(message, tree)
|
||||
}
|
||||
|
||||
/// Stage every current worktree/index change and create one user-requested
|
||||
/// commit without exposing staging policy to a frontend.
|
||||
pub fn commit_all(&self, message: &str) -> Result<String, GitError> {
|
||||
let status = self.status()?;
|
||||
let paths = status
|
||||
.staged()
|
||||
.iter()
|
||||
.chain(status.unstaged())
|
||||
.map(|change| change.path().to_owned())
|
||||
.collect::<BTreeSet<_>>()
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>();
|
||||
if paths.is_empty() {
|
||||
return Err(GitError::NoChanges);
|
||||
}
|
||||
self.stage_and_commit(&paths, message)?
|
||||
.ok_or(GitError::NoChanges)
|
||||
}
|
||||
|
||||
fn commit_tree(&self, message: &str, tree: gix::hash::ObjectId) -> Result<String, GitError> {
|
||||
validate_commit_message(message)?;
|
||||
let parent = self.repository.head_id().ok().map(|id| id.detach());
|
||||
|
||||
Reference in new issue
Block a user