diff --git a/ci/release_notes.md b/ci/release_notes.md index 4087d99..b85e440 100644 --- a/ci/release_notes.md +++ b/ci/release_notes.md @@ -1 +1,3 @@ -Empty - please add release notes here +## Misc + +- improve output when nothing to commit diff --git a/src/repo.rs b/src/repo.rs index d03e9e8..a69b1bb 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -119,7 +119,7 @@ impl Repo { private_key, .. }: GitConfig, - ) -> Result<()> { + ) -> Result { let callbacks = remote_callbacks(private_key.clone()); let mut fo = git2::FetchOptions::new(); fo.remote_callbacks(callbacks); @@ -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) -> Result { diff --git a/src/workspace.rs b/src/workspace.rs index ea1ff49..ca0f01a 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -28,11 +28,7 @@ impl Workspace { pub fn ls(&self, env: &EnvironmentConfig, gate: Option) -> Result> { 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( @@ -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 {