Skip to content

Commit 666c0e9

Browse files
committed
Don't require a manifest for cargo owner commands
1 parent 1bdfb25 commit 666c0e9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/bin/owner.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use cargo::ops;
22
use cargo::core::MultiShell;
33
use cargo::util::{CliResult, CliError};
4-
use cargo::util::important_paths::find_root_manifest_for_cwd;
54

65
#[deriving(Decodable)]
76
struct Options {
@@ -36,7 +35,6 @@ versions, and also modify the set of owners, so take caution!
3635

3736
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
3837
shell.set_verbose(options.flag_verbose);
39-
let root = try!(find_root_manifest_for_cwd(None));
4038
let opts = ops::OwnersOptions {
4139
krate: options.arg_crate,
4240
token: options.flag_token,
@@ -45,7 +43,7 @@ pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>
4543
to_remove: options.flag_remove,
4644
list: options.flag_list,
4745
};
48-
try!(ops::modify_owners(&root, shell, &opts).map_err(|e| {
46+
try!(ops::modify_owners(shell, &opts).map_err(|e| {
4947
CliError::from_boxed(e, 101)
5048
}));
5149
Ok(None)

src/cargo/ops/registry.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use sources::{PathSource, RegistrySource};
1414
use util::config;
1515
use util::{CargoResult, human, internal, ChainError, Require, ToUrl};
1616
use util::config::{Config, ConfigValue, Location};
17+
use util::important_paths::find_root_manifest_for_cwd;
1718

1819
pub struct RegistryConfig {
1920
pub index: Option<String>,
@@ -229,12 +230,12 @@ pub struct OwnersOptions {
229230
pub list: bool,
230231
}
231232

232-
pub fn modify_owners(manifest_path: &Path,
233-
shell: &mut MultiShell,
233+
pub fn modify_owners(shell: &mut MultiShell,
234234
opts: &OwnersOptions) -> CargoResult<()> {
235235
let name = match opts.krate {
236236
Some(ref name) => name.clone(),
237237
None => {
238+
let manifest_path = try!(find_root_manifest_for_cwd(None));
238239
let mut src = try!(PathSource::for_path(&manifest_path.dir_path()));
239240
try!(src.update());
240241
let pkg = try!(src.get_root_package());

0 commit comments

Comments
 (0)