File tree 3 files changed +9
-0
lines changed
gitoxide-core/src/repository
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ pub struct Options {
6
6
pub handshake_info : bool ,
7
7
pub no_tags : bool ,
8
8
pub shallow : gix:: remote:: fetch:: Shallow ,
9
+ pub ref_name : Option < gix:: refs:: PartialName > ,
9
10
}
10
11
11
12
pub const PROGRESS_RANGE : std:: ops:: RangeInclusive < u8 > = 1 ..=3 ;
@@ -31,6 +32,7 @@ pub(crate) mod function {
31
32
handshake_info,
32
33
bare,
33
34
no_tags,
35
+ ref_name,
34
36
shallow,
35
37
} : Options ,
36
38
) -> anyhow:: Result < ( ) >
@@ -75,6 +77,7 @@ pub(crate) mod function {
75
77
}
76
78
let ( mut checkout, fetch_outcome) = prepare
77
79
. with_shallow ( shallow)
80
+ . with_ref_name ( ref_name. as_ref ( ) ) ?
78
81
. fetch_then_checkout ( & mut progress, & gix:: interrupt:: IS_INTERRUPTED ) ?;
79
82
80
83
let ( repo, outcome) = if bare {
Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ pub fn main() -> Result<()> {
404
404
handshake_info,
405
405
bare,
406
406
no_tags,
407
+ ref_name,
407
408
remote,
408
409
shallow,
409
410
directory,
@@ -413,6 +414,7 @@ pub fn main() -> Result<()> {
413
414
bare,
414
415
handshake_info,
415
416
no_tags,
417
+ ref_name,
416
418
shallow : shallow. into ( ) ,
417
419
} ;
418
420
prepare_and_run (
Original file line number Diff line number Diff line change @@ -434,6 +434,10 @@ pub mod clone {
434
434
/// The url of the remote to connect to, like `https://github.com/byron/gitoxide`.
435
435
pub remote : OsString ,
436
436
437
+ /// The name of the reference to check out.
438
+ #[ clap( long = "ref" , value_parser = crate :: shared:: AsPartialRefName , value_name = "REF_NAME" ) ]
439
+ pub ref_name : Option < gix:: refs:: PartialName > ,
440
+
437
441
/// The directory to initialize with the new repository and to which all data should be written.
438
442
pub directory : Option < PathBuf > ,
439
443
}
You can’t perform that action at this time.
0 commit comments