logo

badwolf

minimalist and privacy-oriented web browser based on WebKitGTK git clone https://hacktivis.me/git/badwolf.git

version.sh (500B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2019-2022 Badwolf Authors <https://hacktivis.me/projects/badwolf>
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. if command -v git 2>/dev/null >/dev/null
  5. then
  6. hash=$(git --git-dir="$(dirname $0)/.git" rev-parse --short HEAD 2>/dev/null)
  7. branch=$(git --git-dir="$(dirname $0)/.git" rev-parse --abbrev-ref HEAD 2>/dev/null | sed -r 's/.*[^0-9A-Za-z-]([0-9A-Za-z-]*)$/\1/g')
  8. if [ -n "$hash" ] || [ -n "$branch" ]
  9. then
  10. printf '+g%s.%s' "$hash" "$branch"
  11. fi
  12. fi
  13. echo