feat(run): log git clone command with flags and branch information

This commit is contained in:
35C4n0r 2026-05-19 03:17:55 +00:00
parent 6117692279
commit 1fc855711b
2 changed files with 6 additions and 0 deletions

View File

@ -59,6 +59,7 @@ describe("git-clone", async () => {
expect(output.stdout).toEqual([
"Creating directory /root/fake-url...",
"Cloning fake-url to /root/fake-url...",
"Running: git clone fake-url /root/fake-url",
]);
expect(output.stderr.join(" ")).toContain("fatal");
expect(output.stderr.join(" ")).toContain("fake-url");
@ -235,6 +236,7 @@ describe("git-clone", async () => {
expect(output.stdout).toEqual([
"Creating directory /root/repo-tests.log...",
"Cloning https://github.com/michaelbrewer/repo-tests.log to /root/repo-tests.log on branch feat/branch...",
"Running: git clone -b feat/branch https://github.com/michaelbrewer/repo-tests.log /root/repo-tests.log",
]);
});
@ -248,6 +250,7 @@ describe("git-clone", async () => {
expect(output.stdout).toEqual([
"Creating directory /root/repo-tests.log...",
"Cloning https://gitlab.com/mike.brew/repo-tests.log to /root/repo-tests.log on branch feat/branch...",
"Running: git clone -b feat/branch https://gitlab.com/mike.brew/repo-tests.log /root/repo-tests.log",
]);
});
@ -269,6 +272,7 @@ describe("git-clone", async () => {
expect(output.stdout).toEqual([
"Creating directory /root/repo-tests.log...",
"Cloning https://github.com/michaelbrewer/repo-tests.log to /root/repo-tests.log on branch feat/branch...",
"Running: git clone -b feat/branch https://github.com/michaelbrewer/repo-tests.log /root/repo-tests.log",
]);
});

View File

@ -65,9 +65,11 @@ fi
if [ -z "$(ls -A "$CLONE_PATH")" ]; then
if [ -z "$BRANCH_NAME" ]; then
echo "Cloning $REPO_URL to $CLONE_PATH..."
echo "Running: git clone $${CLONE_FLAGS[*]} $REPO_URL $CLONE_PATH"
git clone "$${CLONE_FLAGS[@]}" "$REPO_URL" "$CLONE_PATH"
else
echo "Cloning $REPO_URL to $CLONE_PATH on branch $BRANCH_NAME..."
echo "Running: git clone $${CLONE_FLAGS[*]} -b $BRANCH_NAME $REPO_URL $CLONE_PATH"
git clone "$${CLONE_FLAGS[@]}" -b "$BRANCH_NAME" "$REPO_URL" "$CLONE_PATH"
fi
else