Skip to content

Commit 17c6c00

Browse files
committed
refactor: move items around in the file
1 parent 018dc8a commit 17c6c00

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/git.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ use std::{
1010

1111
use crate::config::{BranchName, CommitId};
1212

13-
/// Run `git` with the given arguments, and get its output
14-
fn git<const N: usize>(args: [&str; N]) -> Result<String> {
15-
log::trace!("$ git {}", args.join(" "));
16-
get_git_output(&spawn_git(&args, &ROOT)?, &args)
17-
}
18-
1913
/// Add the file
2014
pub fn add(file: &str) -> Result<String> {
2115
git(["add", file])
@@ -140,12 +134,10 @@ pub fn reset_branch_to_commit(branch: &BranchName, commit: &CommitId) -> Result<
140134
git(["branch", "--force", branch.as_ref(), commit.as_ref()])
141135
}
142136

143-
/// Spawn a git process and collect its output
144-
pub fn spawn_git(args: &[&str], git_dir: &Path) -> Result<Output, io::Error> {
145-
process::Command::new("git")
146-
.args(args)
147-
.current_dir(git_dir)
148-
.output()
137+
/// Run `git` with the given arguments, and get its output
138+
fn git<const N: usize>(args: [&str; N]) -> Result<String> {
139+
log::trace!("$ git {}", args.join(" "));
140+
get_git_output(&spawn_git(&args, &ROOT)?, &args)
149141
}
150142

151143
/// Get output of the git process
@@ -164,6 +156,14 @@ pub fn get_git_output(output: &Output, args: &[&str]) -> Result<String> {
164156
}
165157
}
166158

159+
/// Spawn a git process and collect its output
160+
pub fn spawn_git(args: &[&str], git_dir: &Path) -> Result<Output, io::Error> {
161+
process::Command::new("git")
162+
.args(args)
163+
.current_dir(git_dir)
164+
.output()
165+
}
166+
167167
/// Location of the root directory of Git
168168
pub static ROOT: LazyLock<PathBuf> = LazyLock::new(|| {
169169
match (|| {

0 commit comments

Comments
 (0)