File tree Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,12 @@ test_expect_success 'pre-auto-gc hook can stop auto gc' '
101
101
EOF
102
102
103
103
git init pre-auto-gc-hook &&
104
+ test_hook -C pre-auto-gc-hook pre-auto-gc <<-\EOF &&
105
+ echo >&2 no gc for you &&
106
+ exit 1
107
+ EOF
104
108
(
105
109
cd pre-auto-gc-hook &&
106
- write_script ".git/hooks/pre-auto-gc" <<-\EOF &&
107
- echo >&2 no gc for you &&
108
- exit 1
109
- EOF
110
110
111
111
git config gc.auto 3 &&
112
112
git config gc.autoDetach false &&
@@ -128,14 +128,12 @@ test_expect_success 'pre-auto-gc hook can stop auto gc' '
128
128
See "git help gc" for manual housekeeping.
129
129
EOF
130
130
131
- (
132
- cd pre-auto-gc-hook &&
133
- write_script ".git/hooks/pre-auto-gc" <<-\EOF &&
134
- echo >&2 will gc for you &&
135
- exit 0
136
- EOF
137
- git gc --auto >../out.actual 2>../err.actual
138
- ) &&
131
+ test_hook -C pre-auto-gc-hook --clobber pre-auto-gc <<-\EOF &&
132
+ echo >&2 will gc for you &&
133
+ exit 0
134
+ EOF
135
+
136
+ git -C pre-auto-gc-hook gc --auto >out.actual 2>err.actual &&
139
137
140
138
test_must_be_empty out.actual &&
141
139
test_cmp err.expect err.actual
Original file line number Diff line number Diff line change @@ -277,16 +277,21 @@ test_expect_success 'run hook p4-pre-submit before submit' '
277
277
git commit -m "add hello.txt" &&
278
278
git config git-p4.skipSubmitEdit true &&
279
279
git p4 submit --dry-run >out &&
280
- grep "Would apply" out &&
281
- mkdir -p .git/hooks &&
282
- write_script .git/hooks/p4-pre-submit <<-\EOF &&
283
- exit 0
284
- EOF
280
+ grep "Would apply" out
281
+ ) &&
282
+ test_hook -C "$git" p4-pre-submit <<-\EOF &&
283
+ exit 0
284
+ EOF
285
+ (
286
+ cd "$git" &&
285
287
git p4 submit --dry-run >out &&
286
- grep "Would apply" out &&
287
- write_script .git/hooks/p4-pre-submit <<-\EOF &&
288
- exit 1
289
- EOF
288
+ grep "Would apply" out
289
+ ) &&
290
+ test_hook -C "$git" --clobber p4-pre-submit <<-\EOF &&
291
+ exit 1
292
+ EOF
293
+ (
294
+ cd "$git" &&
290
295
test_must_fail git p4 submit --dry-run >errs 2>&1 &&
291
296
! grep "Would apply" errs
292
297
)
You can’t perform that action at this time.
0 commit comments