Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ pub enum Commands {
#[arg(short = 'u', long = "update", help = "How git should update the submodule when you run `git submodule update`.")]
update: Option<Update>,

// TODO: Implement this arg
#[arg(short = 's', long = "shallow", default_value = "false", action = clap::ArgAction::SetTrue, default_missing_value = "true", help = "If given, sets the submodule as a shallow clone. It will only fetch the last commit of the branch, not the full history.")]
shallow: bool,

// TODO: Implement this arg
#[arg(long = "no-init", default_value = "false", action = clap::ArgAction::SetTrue, default_missing_value = "true", help = "If given, we'll add the submodule to your submod.toml but not initialize it.")]
no_init: bool,
},
Expand Down
50 changes: 25 additions & 25 deletions src/git_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,26 +403,26 @@ impl GitManager {
path: String,
url: String,
sparse_paths: Option<Vec<String>>,
_branch: Option<SerializableBranch>,
_ignore: Option<SerializableIgnore>,
_fetch: Option<SerializableFetchRecurse>,
_update: Option<SerializableUpdate>,
_shallow: Option<bool>,
_no_init: bool,
branch: Option<SerializableBranch>,
ignore: Option<SerializableIgnore>,
fetch_recurse: Option<SerializableFetchRecurse>,
update: Option<SerializableUpdate>,
shallow: Option<bool>,
no_init: bool,
) -> Result<(), SubmoduleError> {
if _no_init {
if no_init {
self.update_toml_config(
name.clone(),
SubmoduleEntry {
path: Some(path.clone()),
url: Some(url.clone()),
branch: _branch.clone(),
ignore: _ignore.clone(),
update: _update.clone(),
fetch_recurse: _fetch.clone(),
branch: branch.clone(),
ignore: ignore.clone(),
update: update.clone(),
fetch_recurse: fetch_recurse.clone(),
active: Some(true),
shallow: _shallow,
no_init: Some(_no_init),
shallow,
no_init: Some(no_init),
sparse_paths: None,
},
sparse_paths.clone(),
Expand All @@ -438,12 +438,12 @@ impl GitManager {
name: name.clone(),
path: std::path::PathBuf::from(&path),
url: url.clone(),
branch: None,
ignore: None,
update: None,
fetch_recurse: None,
shallow: false,
no_init: false,
branch: branch.clone(),
ignore: ignore.clone(),
update: update.clone(),
fetch_recurse: fetch_recurse.clone(),
shallow: shallow.unwrap_or(false),
no_init,
Comment on lines 437 to +446
};
match self.git_ops.add_submodule(&opts).map_err(Self::map_git_ops_error) {
Ok(()) => {
Expand All @@ -454,13 +454,13 @@ impl GitManager {
SubmoduleEntry {
path: Some(path),
url: Some(url),
branch: _branch,
ignore: _ignore,
update: _update,
fetch_recurse: _fetch,
branch,
ignore,
update,
fetch_recurse,
active: Some(true),
shallow: _shallow,
no_init: Some(_no_init),
shallow,
no_init: Some(no_init),
sparse_paths: None, // stored separately via configure_submodule_post_creation
},
sparse_paths,
Expand Down
Loading