Skip to content

Commit c673bcb

Browse files
committed
Auto merge of #8040 - ehuss:remove-git-checkout, r=alexcrichton
Remove the `git-checkout` subcommand. This command has been broken for almost a year (since #6880), and nobody has mentioned it. The command isn't very useful (it checks out into cargo's `db` directory, which can also be accomplished with `cargo fetch`). Since it doesn't have much utility, I don't see much reason to keep it around.
2 parents 8a0d4d9 + 7ac3995 commit c673bcb

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed
Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
11
use crate::command_prelude::*;
22

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

75
pub fn cli() -> App {
86
subcommand("git-checkout")
9-
.about("Checkout a copy of a Git repository")
10-
.arg(opt("quiet", "No output printed to stdout").short("q"))
11-
.arg(
12-
Arg::with_name("url")
13-
.long("url")
14-
.value_name("URL")
15-
.required(true),
16-
)
17-
.arg(
18-
Arg::with_name("reference")
19-
.long("reference")
20-
.value_name("REF")
21-
.required(true),
22-
)
7+
.about("This subcommand has been removed")
8+
.settings(&[AppSettings::Hidden])
9+
.help(REMOVED)
2310
}
2411

25-
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
26-
let url = args.value_of("url").unwrap().into_url()?;
27-
let reference = args.value_of("reference").unwrap();
28-
29-
let reference = GitReference::Branch(reference.to_string());
30-
let source_id = SourceId::for_git(&url, reference)?;
31-
32-
let mut source = GitSource::new(source_id, config)?;
33-
34-
source.update()?;
35-
36-
Ok(())
12+
pub fn exec(_config: &mut Config, _args: &ArgMatches<'_>) -> CliResult {
13+
Err(anyhow::format_err!(REMOVED).into())
3714
}

src/etc/_cargo

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ _cargo() {
129129
_arguments -s -S $common $manifest
130130
;;
131131

132-
git-checkout)
133-
_arguments -s -S $common \
134-
'--reference=:reference' \
135-
'--url=:url:_urls'
136-
;;
137-
138132
help)
139133
_cargo_cmds
140134
;;

src/etc/cargo.bashcomp.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ _cargo()
5656
local opt__fetch="$opt_common $opt_mani $opt_lock --target"
5757
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"
5858
local opt__generate_lockfile="$opt_common $opt_mani $opt_lock"
59-
local opt__git_checkout="$opt_common $opt_lock --reference --url"
6059
local opt__help="$opt_help"
6160
local opt__init="$opt_common $opt_lock --bin --lib --name --vcs --edition --registry"
6261
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"

0 commit comments

Comments
 (0)