-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(IDX): update diff logic to work outside of PRs #1745
Changes from all commits
6d2e312
b875bfc
44aa073
9643d92
c0fa3f8
6057bf2
a76302c
2aa68b5
e26a05e
03cd834
a4e5fe7
ded9125
af39b6e
e926b8f
b85d8e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,11 @@ set -euo pipefail | |
set -x | ||
cd "$(git rev-parse --show-toplevel)" | ||
|
||
MERGE_BASE="${MERGE_BASE_SHA:-HEAD}" | ||
# since default branch is not the same in ic-private, we can't set it to master, throw error if missing | ||
git fetch origin $DEFAULT_BRANCH | ||
TARGET_BRANCH_NAME="${TARGET_BRANCH_NAME:-$DEFAULT_BRANCH}" | ||
TARGET_BRANCH_SHA=$(git rev-parse origin/$TARGET_BRANCH_NAME) | ||
MERGE_BASE=$(git merge-base HEAD "$TARGET_BRANCH_SHA") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this cause the problem we discussed yesterday where I'm doing these git calculations in my head so I could be wrong here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I realise I'm wrong. If HEAD points to a merge of the PR with the target branch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I double checked this and from my understanding |
||
COMMIT_RANGE=${COMMIT_RANGE:-$MERGE_BASE".."} | ||
DIFF_FILES=$(git diff --name-only "${COMMIT_RANGE}") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would cause quite some downloads since we don't fetch all history when we checkout the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's only pulling master... Or should I specify a couple commits like we have in the checkout step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
--depth 512
should be safe enough.