Projects STRLCPY git-open Commits 4ca19904
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    git-open
    skipped 152 lines
    153 153  domain=$(getConfig "domain")
    154 154  protocol=$(getConfig "protocol")
    155 155   
    156  -# Get current branch
    157  -branch=${2:-$(git symbolic-ref -q --short HEAD)}
     156 +# Get current branch / tag / commit
     157 +branch=${2:-$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match 2>/dev/null || git rev-parse HEAD)}
    158 158   
    159 159  # Split arguments on '/'
    160 160  IFS='/' read -r -a pathargs <<<"$urlpath"
    skipped 96 lines
  • ■ ■ ■ ■ ■ ■
    test/git-open.bats
    skipped 64 lines
    65 65   assert_output "https://github.com/user/repo/tree/mybranch"
    66 66  }
    67 67   
     68 +@test "gh: tag" {
     69 + git remote set-url origin "[email protected]:user/repo.git"
     70 + git tag mytag
     71 + echo a > a
     72 + git add a
     73 + git commit -m a
     74 + git checkout mytag
     75 + run ../git-open
     76 + assert_output "https://github.com/user/repo/tree/mytag"
     77 +}
     78 + 
    68 79  @test "gh: non-origin remote" {
    69 80   git remote set-url origin "[email protected]:user/repo.git"
    70 81   git remote add upstream "[email protected]:upstreamorg/repo.git"
    skipped 219 lines
    290 301   git remote set-url origin "[email protected]:paulirish/crbug-extension.git"
    291 302   run ../git-open
    292 303   assert_output --partial "https://bitbucket.org/paulirish/crbug-extension"
     304 +}
     305 + 
     306 +@test "bitbucket: tag" {
     307 + git remote set-url origin "[email protected]:paulirish/crbug-extension.git"
     308 + git tag mytag
     309 + echo a > a
     310 + git add a
     311 + git commit -m a
     312 + git checkout mytag
     313 + run ../git-open
     314 + assert_output "https://bitbucket.org/paulirish/crbug-extension/src?at=mytag"
    293 315  }
    294 316   
    295 317  @test "bitbucket: non-origin remote" {
    skipped 338 lines
Please wait...
Page is in error, reload to recover