You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
773 B

  1. #!/bin/sh
  2. #
  3. # This script detects whether git commit is being executed in amend or regular mode
  4. # Needed to determine whether the build number should be incremented or not.
  5. #
  6. # Need to figure out if we are running on Windows or *NIX
  7. if [ "$(uname -o)" = "Msys" ]; then
  8. type -P PowerShell &>/dev/null || { echo "PowerShell command not found. Aborting." >&2; exit 1; }
  9. type -P grep &>/dev/null || { echo "grep command not found. Aborting." >&2; exit 1; }
  10. GITCMD=`PowerShell -command "Get-WmiObject win32_process -Filter \"name like '%git.exe'\" | select CommandLine"`
  11. if $(echo $GITCMD | grep -q -- --amend); then
  12. echo AMEND detected
  13. touch ./.amend
  14. fi
  15. else
  16. if $(ps -fp $PPID | grep -q -- --amend); then
  17. echo AMEND detected
  18. touch ./.amend
  19. fi
  20. fi