#!/bin/bash STASH_NAME="$1" pop() { STASH_NUM=$(git stash list | grep $STASH_NAME | sed -re 's/stash@\{(.*)\}.*/\1/') # Only necessary if anything was stashed if [ -n "$STASH_NUM" ]; then git stash pop -q stash@{$STASH_NUM} fi } dir="$(echo $PWD | sed 's@/home/[^/]\+/@~/@')" notify-send "Running $dir tests..." if ! (make test &> /dev/null || test $? = 2); then notify-send "Tests failed during commit in $dir" else notify-send "Tests passed in $dir" fi pop