Skip to content

Commit

Permalink
Use checkout instead of switch
Browse files Browse the repository at this point in the history
  • Loading branch information
pv72895 committed Feb 14, 2024
1 parent 6b15c5c commit 4d3639d
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/scripts/compute_impacted_targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ bazelDiff() {
fi
}

# NOTE: We cannot assume that the checked out Git repo (e.g. via actions-checkout)
# was a shallow vs a complete clone. The `--depth` options deepens the commit history
# in both clone modes: https://git-scm.com/docs/fetch-options#Documentation/fetch-options.txt---depthltdepthgt
fetchRemoteGitHistory() {
logIfVerbose "Fetching" "$@" "..."
git fetch --quiet --depth=2147483647 origin "$@"
logIfVerbose "...done!"
}

## Verbose logging for the Merge Instance and PR branch.
if [[ -n ${VERBOSE} ]]; then
# Find the merge base of the two branches
Expand All @@ -72,14 +63,14 @@ if [[ -n ${VERBOSE} ]]; then
merge_instance_depth=$(git rev-list "${merge_base_sha}".."${MERGE_INSTANCE_BRANCH_HEAD_SHA}" | wc -l)
echo "Merge Instance Depth= ${merge_instance_depth}"

git switch "${MERGE_INSTANCE_BRANCH}"
git checkout "${MERGE_INSTANCE_BRANCH}"
git log -n "${merge_instance_depth}" --oneline

# Find the number of commits between the merge base and the PR's HEAD
pr_depth=$(git rev-list "${merge_base_sha}".."${PR_BRANCH_HEAD_SHA}" | wc -l)
echo "PR Depth= ${pr_depth}"

git switch "${PR_BRANCH}"
git checkout "${PR_BRANCH}"
git log -n "${pr_depth}" --oneline
fi

Expand Down

0 comments on commit 4d3639d

Please sign in to comment.