diff --git a/Justfile b/Justfile index b2dba34..fa65d4d 100644 --- a/Justfile +++ b/Justfile @@ -40,9 +40,7 @@ default: # Release a new version for `setup-moonbit` release *OPTIONS: - @overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'common.nu') }}; \ - overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'release.nu') }}; \ - git-check --check-repo=1 {{SETUP_MOONBIT_PATH}}; \ + @overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'release.nu') }}; \ make-release {{OPTIONS}} # Fetch official install scripts diff --git a/nu/release.nu b/nu/release.nu index 442428d..e564872 100644 --- a/nu/release.nu +++ b/nu/release.nu @@ -41,3 +41,14 @@ export def 'make-release' [ git checkout $releaseVer; git tag $majorTag git push origin $majorTag $releaseVer --force } + +# Check if a git repo has the specified ref: could be a branch or tag, etc. +export def has-ref [ + ref: string # The git ref to check +] { + let checkRepo = (do -i { git rev-parse --is-inside-work-tree } | complete) + if not ($checkRepo.stdout =~ 'true') { return false } + # Brackets were required here, or error will occur + let parse = (do -i { git rev-parse --verify -q $ref } | complete) + if ($parse.stdout | is-empty) { false } else { true } +}