fix: copy contents and not folder (#1033)

add: bot prefix to sync commits
This commit is contained in:
Zelda Hessler 2022-01-04 12:55:06 -06:00 committed by GitHub
parent a9f1b5aa26
commit 34520b1b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,7 @@ struct Opt {
const BOT_NAME: &str = "AWS SDK Rust Bot";
const BOT_EMAIL: &str = "aws-sdk-rust-primary@amazon.com";
const COMMIT_HASH_FILENAME: &str = ".smithyrs-githash";
const BOT_COMMIT_PREFIX: &str = "[autosync]";
/// A macro for attaching info to error messages pointing to the line of code responsible for the error.
/// [Thanks to dtolnay for this macro](https://github.com/dtolnay/anyhow/issues/22#issuecomment-542309452)
@ -280,6 +281,8 @@ fn copy_sdk(from_path: &Path, to_path: &Path) -> Result<()> {
bail!("expected absolute to_path but got: {}", from_path.display());
}
// The '.' tells cp to copy the folder contents, not the folder
let from_path = from_path.join(".");
let from_path = from_path
.to_str()
.expect("for our use case, this will always be UTF-8");
@ -336,7 +339,11 @@ fn create_mirror_commit(aws_sdk_repo: &Repository, based_on_commit: &Commit) ->
Some("HEAD"),
&based_on_commit.author(),
&bot_signature,
based_on_commit.message().unwrap_or_default(),
&format!(
"{} {}",
BOT_COMMIT_PREFIX,
based_on_commit.message().unwrap_or_default()
),
&tree,
&[&parent_commit],
)