Skip to content

Commit d9b5c6d

Browse files
Verify source and target commit
1 parent 56f240f commit d9b5c6d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

assets/in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [ -z "$prq_id" ]; then
5858
exit 1
5959
fi
6060

61-
depthflag="--depth 1"
61+
depthflag=""
6262
if test "$depth" -gt 0 2> /dev/null; then
6363
depthflag="--depth $depth"
6464
fi
@@ -120,6 +120,16 @@ fi
120120
source_commit=$(git rev-list --parents -1 $ref | awk '{print $3}')
121121
target_commit=$(git rev-list --parents -1 $ref | awk '{print $2}')
122122

123+
if [ -z "$source_commit" ]; then
124+
log "Unable to determine source commit from merge commit $ref. Please verify depth configuration."
125+
exit 1
126+
fi
127+
128+
if [ -z "$target_commit" ]; then
129+
log "Unable to determine target commit from merge commit $ref. Please verify depth configuration."
130+
exit 1
131+
fi
132+
123133
# expose configuration of pull request that can be used in container
124134
git config --add pullrequest.id $prq_id
125135
git config --add pullrequest.source_commit $source_commit

0 commit comments

Comments
 (0)