Skip to content
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

Remove the git-checkout subcommand. #8040

Merged
merged 1 commit into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
35 changes: 6 additions & 29 deletions src/bin/cargo/commands/git_checkout.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
use crate::command_prelude::*;

use cargo::core::{GitReference, Source, SourceId};
use cargo::sources::GitSource;
use cargo::util::IntoUrl;
const REMOVED: &str = "The `git-checkout` subcommand has been removed.";

pub fn cli() -> App {
subcommand("git-checkout")
.about("Checkout a copy of a Git repository")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg(
Arg::with_name("url")
.long("url")
.value_name("URL")
.required(true),
)
.arg(
Arg::with_name("reference")
.long("reference")
.value_name("REF")
.required(true),
)
.about("This subcommand has been removed")
.settings(&[AppSettings::Hidden])
.help(REMOVED)
}

pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let url = args.value_of("url").unwrap().into_url()?;
let reference = args.value_of("reference").unwrap();

let reference = GitReference::Branch(reference.to_string());
let source_id = SourceId::for_git(&url, reference)?;

let mut source = GitSource::new(source_id, config)?;

source.update()?;

Ok(())
pub fn exec(_config: &mut Config, _args: &ArgMatches<'_>) -> CliResult {
Err(anyhow::format_err!(REMOVED).into())
}
6 changes: 0 additions & 6 deletions src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ _cargo() {
_arguments -s -S $common $manifest
;;

git-checkout)
_arguments -s -S $common \
'--reference=:reference' \
'--url=:url:_urls'
;;

help)
_cargo_cmds
;;
Expand Down
1 change: 0 additions & 1 deletion src/etc/cargo.bashcomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ _cargo()
local opt__fetch="$opt_common $opt_mani $opt_lock --target"
local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_jobs $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir"
local opt__generate_lockfile="$opt_common $opt_mani $opt_lock"
local opt__git_checkout="$opt_common $opt_lock --reference --url"
local opt__help="$opt_help"
local opt__init="$opt_common $opt_lock --bin --lib --name --vcs --edition --registry"
local opt__install="$opt_common $opt_feat $opt_jobs $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track"
Expand Down