Check for outstanding changes before pushing/poping a patch
[guilt.git] / gq-pop
blobdecaa86970c0b5643c4466f8b5ca94614fef53d8
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006
6 source "`dirname $0`/gq.lib"
8 export GIT_DIR=`find_git_dir`
9 GQ_DIR="$GIT_DIR/patches"
11 branch=`get_branch_verify`
12 series="$GQ_DIR/$branch/series"
13 applied="$GQ_DIR/$branch/status"
15 # FIXME: ...
16 [ $# -ne 0 ] && echo "Poping only top most patch..arguments ignored"
18 # make sure that there are no unapplied changes
19 if ! must_commit_first; then
20 echo "Uncommited changes detected. Refresh first."
21 exit 1
24 git reset --hard HEAD^
26 echo "Poping `get_top`..."
28 head -n -1 < $applied > $applied.tmp
29 mv $applied{.tmp,}
31 p=`get_top`
32 [ ! -z "$p" ] && echo "Now at $p." || echo "All patches popped."