diff --git a/README.rst b/README.rst index c089f9f..08ba13e 100644 --- a/README.rst +++ b/README.rst @@ -113,7 +113,7 @@ regularly and useful to understand ``atlas`` at a glance. slug of the GitHub repository to pull from. Defaults 'openedx/openedx-translations'. `-n` or `--revision`: - Git revision to pull from. Currently only branches and tags are supported. Defaults to 'main'. + Git revision to pull from. Support branches, tags, and commits hashes. Defaults to 'main'. This option name used to be `-b` or `--branch`. The deprecated name will be removed in a future release. diff --git a/atlas b/atlas index aa833b3..a8e35e6 100755 --- a/atlas +++ b/atlas @@ -47,7 +47,7 @@ Options: slug of the GitHub repository to pull from. Defaults 'openedx/openedx-translations'. \`-n\` or \`--revision\`: - Git revision to pull from. Currently only branches and tags are supported. Defaults to 'main'. + Git revision to pull from. Support branches, tags, and commits hashes. Defaults to 'main'. This option name used to be \`-b\` or \`--branch\`. The deprecated name will be removed in a future release. @@ -200,7 +200,7 @@ Options: slug of the GitHub repository to pull from. Defaults 'openedx/openedx-translations'. `-n` or `--revision`: - Git revision to pull from. Currently only branches and tags are supported. Defaults to 'main'. + Git revision to pull from. Support branches, tags, and commits hashes. Defaults to 'main'. This option name used to be `-b` or `--branch`. The deprecated name will be removed in a future release. @@ -507,18 +507,15 @@ pull_translations() { quiet="--quiet" fi - if [ "$pull_revision" ]; - then - pull_revision_argument="--branch=${pull_revision}" - else - pull_revision_argument="" - fi # Creating a shallow clone of the repo without without pulling the files yet - # shellcheck disable=SC2086 - git clone $quiet $pull_revision_argument --filter=blob:none --no-checkout --depth=1 \ - "https://github.com/${pull_repository}.git" translations_TEMP || exit + git init $quiet translations_TEMP || exit cd translations_TEMP || exit + git remote add origin "https://github.com/${pull_repository}.git" || exit + # Requires server to allow pulling commits by direct commit hash reference, + # controlled by uploadpack.allowAnySHA1InWant and related configs. (GitHub + # does allow this, though.) + git fetch $quiet --filter=blob:none --depth=1 origin "${pull_revision:-main}" || exit # finished "Creating a temporary Git repository to pull translations into ..." step if [ -z "$SILENT" ]; @@ -564,7 +561,7 @@ pull_translations() { fi # Retrieve translation files from the repo - git checkout HEAD + git checkout $quiet FETCH_HEAD # Remove .git directory rm -rf .git