From 66e76cbdf51fed158a9f07b733e82ffd36cfc31b Mon Sep 17 00:00:00 2001 From: Michael Zhao <44533763+Pistonight@users.noreply.github.com> Date: Sat, 2 Dec 2023 15:45:18 -0800 Subject: [PATCH] bump min git version to 2.43 due to bug in set-branch and set-url (#7) --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 2 ++ README.txtpp.md | 2 ++ src/git.rs | 8 ++++++-- src/lib.rs | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7956eaf..960b754 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,7 +157,7 @@ checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "magoo" -version = "0.1.2" +version = "0.1.3" dependencies = [ "clap", "fs4", diff --git a/Cargo.toml b/Cargo.toml index 647f08e..b39c6d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "magoo" -version = "0.1.2" +version = "0.1.3" edition = "2021" description = "A wrapper for git submodule that simplifies the workflows" repository = "https://github.com/Pistonite/magoo" diff --git a/README.md b/README.md index f5d63b8..06d1a76 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ magoo status --git Unsupported versions might work as well, ![magoo](https://raw.githubusercontent.com/Pistonite/magoo/main/magoo.webp) just doesn't know. +**git <=2.42.0 doesn't work due to a bug in set-branch and set-url commands** + ### Add a submodule ```bash diff --git a/README.txtpp.md b/README.txtpp.md index 8062a2d..50a7e34 100644 --- a/README.txtpp.md +++ b/README.txtpp.md @@ -73,6 +73,8 @@ TXTPP#tag MAGOO TXTPP#include magoo.txt Unsupported versions might work as well, MAGOO just doesn't know. +**git <=2.42.0 doesn't work due to a bug in set-branch and set-url commands** + ### Add a submodule ```bash diff --git a/src/git.rs b/src/git.rs index 583cc54..317ee90 100644 --- a/src/git.rs +++ b/src/git.rs @@ -14,7 +14,7 @@ use crate::print::{self, println_info, println_verbose, println_warn}; /// The semver notation of the officially supported git versions /// /// The version is not checked at run time, since unsupported versions might work fine. -pub const SUPPORTED_GIT_VERSIONS: &str = ">=2.35.0"; +pub const SUPPORTED_GIT_VERSIONS: &str = ">=2.43.0"; /// Context for running git commands pub struct GitContext { @@ -402,6 +402,8 @@ impl GitContext { } /// Runs `git submodule set-branch`. Path should be from top level + /// + /// Note: Pre git 2.43, there's a bug treating the argument as name instead of path. pub fn submodule_set_branch(&self, path: &str, branch: Option<&str>) -> Result<(), GitError> { let top_level_dir = self.top_level_dir()?.to_cmd_arg(); let mut args = vec!["-C", &top_level_dir, "submodule", "set-branch"]; @@ -420,7 +422,9 @@ impl GitContext { Ok(()) } - /// Runs `git submodule set-url`. Path should be from top level + /// Runs `git submodule set-url`. + /// + /// Note: Pre git 2.43, there's a bug treating the argument as name instead of path. pub fn submodule_set_url(&self, path: &str, url: &str) -> Result<(), GitError> { let top_level_dir = self.top_level_dir()?.to_cmd_arg(); self.run_git_command( diff --git a/src/lib.rs b/src/lib.rs index 70b0078..2dbb670 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ pub struct Magoo { #[clap(subcommand)] pub subcmd: Command, /// Set the working directory of commands. Useful if not running inside a git repository. - #[cfg_attr(feature = "cli", clap(long, default_value(".")))] + #[cfg_attr(feature = "cli", clap(long, short('C'), default_value(".")))] pub dir: String, }