Skip to content

Commit

Permalink
Merge pull request #647 from axodotdev/skip_git_tarball_if_necessary
Browse files Browse the repository at this point in the history
fix: skip git tarball when necessary
  • Loading branch information
mistydemeo authored Dec 13, 2023
2 parents 1233825 + 4b7a197 commit 45d7d17
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cargo-dist/src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,32 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> {
if !self.global_artifacts_enabled() {
return;
}

// It's possible to run cargo-dist in something that's not a git
// repo, including a brand-new repo that hasn't been `git init`ted yet;
// we can't act on those.
//
// Note we don't need the output of --show-toplevel,
// just the exit status.
let status = Command::new("git")
.arg("rev-parse")
.arg("--show-toplevel")
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.status();
let is_git_repo = if let Ok(status) = status {
status.success()
} else {
false
};
if !is_git_repo {
warn!(
"skipping source tarball; no git repo found at {}",
self.inner.workspace_dir
);
return;
}

let release = self.release(to_release);
let checksum = release.checksum;
info!("adding source tarball to release {}", release.id);
Expand Down

0 comments on commit 45d7d17

Please sign in to comment.