File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,11 @@ test_expect_success 'refresh --no-verify with non-executable hook (editor)' '
270
270
271
271
# now a hook that edits the commit message
272
272
write_script " $HOOK " << -'EOF '
273
- echo "new message" >"$1"
273
+ if test -d .git; then
274
+ echo "new message" >"$1"
275
+ else
276
+ echo "not in work root" >"$1"
277
+ fi
274
278
exit 0
275
279
EOF
276
280
@@ -279,6 +283,16 @@ test_expect_success 'new hook edits commit message' '
279
283
commit_msg_is "new message"
280
284
'
281
285
286
+ test_expect_success ' commit-msg run from subdir' '
287
+ mkdir -p dir0/dir1 &&
288
+ (
289
+ cd dir0/dir1 &&
290
+ stg new -m from-subdir
291
+ ) &&
292
+ commit_msg_is "new message" &&
293
+ stg delete from-subdir
294
+ '
295
+
282
296
test_expect_success " new hook doesn't edit commit message" '
283
297
stg new --no-verify -m "plus" plus &&
284
298
commit_msg_is "plus"
You can’t perform that action at this time.
0 commit comments