Skip to content

Commit

Permalink
"guilt graph" no longer loops when no patches are applied.
Browse files Browse the repository at this point in the history
Give an error message if no patches are applied.  Added a test case
that never terminates unless this fix is applied.

Signed-off-by: Per Cederqvist <[email protected]>
Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
  • Loading branch information
Per Cederqvist committed Jan 22, 2015
1 parent de8c0d6 commit ed9ac9d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 7 additions & 2 deletions guilt-graph
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ fi

patchname="$1"

bottom=`git rev-parse refs/patches/$branch/$(head_n 1 < "$applied")`
base=`git rev-parse $bottom^`
bottompatch=$(head_n 1 < "$applied")
if [ -z "$bottompatch" ]; then
echo "No patch applied." >&2
exit 1
fi

base=`git rev-parse "refs/patches/${branch}/${bottompatch}^"`

if [ -z "$patchname" ]; then
top=`git rev-parse HEAD`
Expand Down
3 changes: 3 additions & 0 deletions regression/t-033.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
% setup_repo
% guilt graph
No patch applied.
13 changes: 13 additions & 0 deletions regression/t-033.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#
# Test the graph code
#

source "$REG_DIR/scaffold"

cmd setup_repo

# Check that "guilt graph" gives a proper "No patch applied" error
# message when no patches are applied. (An older version of guilt
# used to enter an endless loop in this situation.)
shouldfail guilt graph

0 comments on commit ed9ac9d

Please sign in to comment.