From c959c3050f85b4b2b2abce41ffc2d9ffd9b0f526 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Wed, 20 Sep 2023 03:34:49 +0900 Subject: [PATCH 1/3] fix: pull/NNNN/head --- src/commands/checkout.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/checkout.yml b/src/commands/checkout.yml index 00ee2ec..c6c5a97 100644 --- a/src/commands/checkout.yml +++ b/src/commands/checkout.yml @@ -131,7 +131,7 @@ steps: echo 'Fetching from remote repository' if [ -n "$CIRCLE_TAG" ]; then git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force --tags origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}" - elif echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+$ > /dev/null; then + elif echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+/head$ > /dev/null; then # pull request called from api. see detail for https://github.com/guitarrapc/git-shallow-clone-orb/issues/34 git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force origin "+refs/${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}" else From f7d6f1ea856754a49b5699ef18a1c748f30ce5ad Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Wed, 20 Sep 2023 03:39:14 +0900 Subject: [PATCH 2/3] fix: remove head duplication --- src/commands/checkout.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/checkout.yml b/src/commands/checkout.yml index c6c5a97..9481d6f 100644 --- a/src/commands/checkout.yml +++ b/src/commands/checkout.yml @@ -132,8 +132,8 @@ steps: if [ -n "$CIRCLE_TAG" ]; then git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force --tags origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}" elif echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+/head$ > /dev/null; then - # pull request called from api. see detail for https://github.com/guitarrapc/git-shallow-clone-orb/issues/34 - git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force origin "+refs/${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}" + # pull request called from api. Input should be `pull/123/head` see detail for https://github.com/guitarrapc/git-shallow-clone-orb/issues/34 + git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force origin "+refs/${CIRCLE_BRANCH}:remotes/origin/${CIRCLE_BRANCH}" else git fetch ${fetch_tag_args} --depth << parameters.fetch_depth >> --force origin +refs/heads/${CIRCLE_BRANCH}:refs/remotes/origin/${CIRCLE_BRANCH} fi From 31cd42ed4ce406af8dd8564fd069d2fad8c9c8e2 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Wed, 20 Sep 2023 03:46:18 +0900 Subject: [PATCH 3/3] fix: pull request api support on advanced checkout --- src/commands/checkout_advanced.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/checkout_advanced.yml b/src/commands/checkout_advanced.yml index 62c78dd..5036f18 100644 --- a/src/commands/checkout_advanced.yml +++ b/src/commands/checkout_advanced.yml @@ -117,6 +117,9 @@ steps: echo 'Fetching from remote repository' if [ -n "$CIRCLE_TAG" ]; then git fetch << parameters.tag_fetch_options >> << parameters.fetch_options >> --force --tags origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}" + elif echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+/head$ > /dev/null; then + # pull request called from api. Input should be `pull/123/head` see detail for https://github.com/guitarrapc/git-shallow-clone-orb/issues/34 + git fetch << parameters.tag_fetch_options >> << parameters.fetch_options >> --force origin "+refs/${CIRCLE_BRANCH}:remotes/origin/${CIRCLE_BRANCH}" else git fetch << parameters.fetch_options >> --force origin +refs/heads/${CIRCLE_BRANCH}:refs/remotes/origin/${CIRCLE_BRANCH} fi