Skip to content

Commit de7289a

Browse files
committed
refactor
1 parent da114c1 commit de7289a

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

gix/src/clone/fetch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl PrepareFetch {
143143
repo.config
144144
.resolved
145145
.string(crate::config::tree::Init::DEFAULT_BRANCH)
146-
.and_then(|name| name.to_str().ok().map(|s| format!("refs/heads/{}", s)))
146+
.and_then(|name| name.to_str().ok().map(|s| format!("refs/heads/{s}")))
147147
})
148148
.unwrap_or_else(|| "refs/heads/main".to_string());
149149

gix/tests/gix/clone.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,9 @@ mod blocking_io {
104104

105105
// The refspec should be for a single branch (main), not a wildcard
106106
let refspec_str = refspecs[0].to_str().expect("valid utf8");
107-
assert!(
108-
!refspec_str.contains("*"),
109-
"shallow clone refspec should not use wildcard: {}",
110-
refspec_str
111-
);
112-
assert!(
113-
refspec_str.contains("refs/heads/main"),
114-
"shallow clone refspec should reference the main branch: {}",
115-
refspec_str
107+
assert_eq!(
108+
refspec_str, "+refs/heads/main:refs/remotes/origin/main",
109+
"shallow clone refspec should not use wildcard and should be the main branch: {refspec_str}"
116110
);
117111

118112
Ok(())

0 commit comments

Comments
 (0)