Skip to content

Conversation

gromgit
Copy link
Contributor

@gromgit gromgit commented Feb 8, 2025

Since this is the most fragile part of the process for most users, might as well put in additional effort.

Tested with this git shim:

#!/usr/bin/env bash
realgit=/usr/bin/git
if [[ -s ~/.rand_thres ]]; then
  limit=$(<~/.rand_fail)
else
  limit=23456  # around 72%
fi
# See if there's a "fetch" in args
for i in "$@"; do
  if [[ $i == "fetch" ]]; then
    # exit on random
    [[ $RANDOM -le $limit ]] && {
      echo "RANDOM FATAL ERROR" >&2
      exit 1
    }
  fi
done
exec "$realgit" "$@"

Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gromgit gromgit force-pushed the retry-git-fetch branch 2 times, most recently from 5224805 to 11c3f25 Compare February 8, 2025 05:17
Since this is the most fragile part of the process for most users, might as well put in additional effort.
@SMillerDev SMillerDev merged commit 112ca76 into Homebrew:master Feb 8, 2025
6 checks passed
@MikeMcQuaid
Copy link
Member

Great idea, thanks @gromgit!

@gromgit gromgit deleted the retry-git-fetch branch March 4, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants