M4.6 step 1: crate-internal extension hook for vcs/git modules
Repo::run, check_name and SMALL_CAP become pub(crate); cmd/git.rs gains Op::Custom, start_with and a pub(super) rel_path, so a new module adds an Op::Custom through start_with instead of editing git.rs or repo.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d2c853c42f
commit
b814c49733
2 changed files with 57 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ pub const STATUS_CAP: usize = 64 * 1024 * 1024;
|
|||
pub const FILE_CAP: usize = 32 * 1024 * 1024;
|
||||
|
||||
/// Cap on other read output (refs, rev-parse).
|
||||
const SMALL_CAP: usize = 16 * 1024 * 1024;
|
||||
pub(crate) const SMALL_CAP: usize = 16 * 1024 * 1024;
|
||||
|
||||
/// How many leading bytes [`Repo::show`] checks for NUL, as git does.
|
||||
const BINARY_PROBE: usize = 8000;
|
||||
|
|
@ -240,7 +240,7 @@ impl Repo {
|
|||
}
|
||||
|
||||
/// Runs git in the work tree root.
|
||||
fn run(&self, call: Call<'_>) -> Result<runner::Output, VcsError> {
|
||||
pub(crate) fn run(&self, call: Call<'_>) -> Result<runner::Output, VcsError> {
|
||||
runner::run(&self.git.executable, call)
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +689,7 @@ impl Repo {
|
|||
|
||||
/// Rejects branch names and revisions git could read as an option or
|
||||
/// that hold control characters.
|
||||
fn check_name(name: &str) -> Result<(), VcsError> {
|
||||
pub(crate) fn check_name(name: &str) -> Result<(), VcsError> {
|
||||
if name.is_empty() || name.starts_with('-') || name.chars().any(char::is_control) {
|
||||
return Err(VcsError::InvalidName(name.to_string()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue