Skip to content

Commit 4f9fdc5

Browse files
committed
mildly improve performance in case there is nothing to do for 'organize'
1 parent 532ff2b commit 4f9fdc5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

gitoxide-core/src/organize.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ fn handle(
120120
None
121121
}
122122

123+
if let Some(parent_repo_path) = find_parent_repo(git_workdir) {
124+
progress.fail(format!(
125+
"Skipping repository at {:?} as it is nested within repository {:?}",
126+
git_workdir.display(),
127+
parent_repo_path
128+
));
129+
return Ok(());
130+
}
131+
123132
let url = match find_origin_remote(git_workdir)? {
124133
None => {
125134
progress.info(format!(
@@ -139,14 +148,6 @@ fn handle(
139148
return Ok(());
140149
}
141150

142-
if let Some(parent_repo_path) = find_parent_repo(git_workdir) {
143-
progress.fail(format!(
144-
"Skipping repository at {:?} as it is nested within repository {:?}",
145-
git_workdir.display(),
146-
parent_repo_path
147-
));
148-
return Ok(());
149-
}
150151
let destination = canonicalized_destination
151152
.join(
152153
url.host

0 commit comments

Comments
 (0)