-
Notifications
You must be signed in to change notification settings - Fork 11
Add subtree filter support and improve round-trip check #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| use anyhow::Context; | ||
| use std::path::Path; | ||
| use std::path::{Path, PathBuf}; | ||
| use std::process::Command; | ||
|
|
||
| /// Run command and return its stdout. | ||
|
|
@@ -36,6 +36,26 @@ fn run_command_inner<'a, Args: AsRef<[&'a str]>>( | |
| cmd.current_dir(workdir); | ||
| cmd.args(&args[1..]); | ||
|
|
||
| execute_command(cmd, capture, verbose) | ||
| } | ||
|
|
||
| pub fn run_command_by_path<'a, Args: AsRef<[&'a str]>>( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was a new function needed here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's basically a copy-paste of |
||
| cmd: &PathBuf, | ||
| args: Args, | ||
| workdir: &Path, | ||
| capture: bool, | ||
| verbose: bool, | ||
| ) -> anyhow::Result<String> { | ||
| let args = args.as_ref(); | ||
|
|
||
| let mut cmd = Command::new(cmd); | ||
| cmd.current_dir(workdir); | ||
| cmd.args(args); | ||
|
|
||
| execute_command(cmd, capture, verbose) | ||
| } | ||
|
|
||
| fn execute_command(mut cmd: Command, capture: bool, verbose: bool) -> anyhow::Result<String> { | ||
| if verbose { | ||
| eprintln!("+ {cmd:?}"); | ||
| } | ||
|
|
@@ -105,3 +125,8 @@ pub fn read_line() -> String { | |
| .expect("cannot read line from stdin"); | ||
| line.trim().to_string() | ||
| } | ||
|
|
||
| pub fn is_null_sha(s: &str) -> bool { | ||
| let s = s.trim(); | ||
| !s.is_empty() && s.chars().all(|c| c == '0') | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please pin the version/tag/commit SHA? I don't want
josh-syncto install unpinned versions of Josh, we had enough trouble with that in the past.