Skip to content

Commit

Permalink
chore: better output when nothing to commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Feb 8, 2024
1 parent 42868e0 commit 39a33fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion ci/release_notes.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Empty - please add release notes here
## Misc

- improve output when nothing to commit
6 changes: 4 additions & 2 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Repo {
private_key,
..
}: GitConfig,
) -> Result<()> {
) -> Result<bool> {
let callbacks = remote_callbacks(private_key.clone());
let mut fo = git2::FetchOptions::new();
fo.remote_callbacks(callbacks);
Expand Down Expand Up @@ -191,8 +191,10 @@ impl Repo {
Some(&mut push_options),
)
.context("Couldn't push to remote")?;
Ok(true)
} else {
Ok(false)
}
Ok(())
}

pub fn open(gate: Option<String>) -> Result<Self> {
Expand Down
10 changes: 4 additions & 6 deletions src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ impl Workspace {
pub fn ls(&self, env: &EnvironmentConfig, gate: Option<String>) -> Result<Vec<String>> {
let repo = Repo::open(gate)?;
let new_env_state = self.construct_env_state(&repo, env, false)?;
Ok(new_env_state
.files
.into_keys()
.map(|k| k.name())
.collect())
Ok(new_env_state.files.into_keys().map(|k| k.name()).collect())
}

pub fn check(
Expand Down Expand Up @@ -163,7 +159,9 @@ impl Workspace {
}
if let Some(config) = git_config {
eprintln!("Pushing to remote");
repo.push(config)?;
if !repo.push(config)? {
eprintln!("... there was nothing new to push");
}
}
Ok((
StateId {
Expand Down

0 comments on commit 39a33fc

Please sign in to comment.