Skip to content

Commit

Permalink
fetch until sha is there
Browse files Browse the repository at this point in the history
Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
M. Fatih Cırıt committed Jun 11, 2024
1 parent b4135e3 commit fbde115
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions get-modified-packages/get-modified-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ function find_package_dir() {
return 1
}

# Function to check if the base ref SHA is in the commit history
check_base_sha_in_history() {
git rev-list HEAD | grep -q "$(git rev-parse $base_sha)"
}

# Fetch the initial shallow clone depth
depth=8

# Loop to deepen the fetch until the base ref SHA is included,
# deepening by a factor of 2 each time
while ! check_base_sha_in_history; do
depth=$((depth * 2))
git fetch --deepen=$depth
done

# Find modified files from base branch
modified_files=$(git diff --name-only "$base_sha"...HEAD)

Expand Down

0 comments on commit fbde115

Please sign in to comment.