Skip to content

Commit

Permalink
fix: Fix has-ref for Nu 0.98
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer committed Sep 18, 2024
1 parent afee922 commit b7de657
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nu/common.nu
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export def 'get-env' [
}

# Check if a git repo has the specified ref: could be a branch or tag, etc.
export def 'has-ref' [
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) })
if ($parse | is-empty) { false } else { true }
let parse = (do -i { git rev-parse --verify -q $ref } | complete)
if ($parse.stdout | is-empty) { false } else { true }
}

# Check if some command available in current shell
Expand Down

0 comments on commit b7de657

Please sign in to comment.