Skip to content

Commit

Permalink
fetchall(): fix a serious bug which fails cloning
Browse files Browse the repository at this point in the history
The clone address should be `[email protected]:gist_number.git`.
  • Loading branch information
weakish committed Nov 2, 2013
1 parent 6d2d51e commit 78b3f16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gister.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ semver='2.0.2' # released on 2013-11-1
# - remove confusing error message
# - init() does not get oauth2 token if already exist.
# - init(): `gist.home` should be global. Thanks wenLiangcan.
# - fetchall(): fix a bug that causes git clone to fail.

# semver='2.0.1' # released on 2013-10-31
# - add support for Mac OS X and Cygwin
Expand Down Expand Up @@ -118,7 +119,9 @@ esac

fetchall() {
echo 'I can only fetch up to 10 million gists for you.'
mv $gisthome/gists.list $gisthome/gists.list.backup
if test -f $gisthome/gists.list; then
mv $gisthome/gists.list $gisthome/gists.list.backup
fi
curl -s -H "Authorization: token $github_oauth_token" 'https://api.github.com/gists?per_page=100' > $gisthome/gists.list
for i in `seq 2 100000`; do
if ! (curl -s -H "Authorization: token $github_oauth_token" "https://api.github.com/gists?page=$i&per_page=100" | jq '.' | grep --silent '^\[]$'); then
Expand All @@ -132,6 +135,7 @@ fetchall() {
grep -F '"git_pull_url":' |
grep -oE 'gist\.github\.com/[0-9a-f]+\.git' |
sed 's/^/git@/' |
sed -e 's/com\//com:/' |
xargs -I '{}' git clone '{}'
migrate
}
Expand Down

0 comments on commit 78b3f16

Please sign in to comment.