File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,8 @@ static int add(int argc, const char **argv)
193
193
194
194
if (mirror && master )
195
195
die ("specifying a master branch makes no sense with --mirror" );
196
- if (mirror && track .nr )
197
- die ("specifying branches to track makes no sense with --mirror " );
196
+ if (mirror && !( mirror & MIRROR_FETCH ) && track .nr )
197
+ die ("specifying branches to track makes sense only with fetch mirrors " );
198
198
199
199
name = argv [0 ];
200
200
url = argv [1 ];
Original file line number Diff line number Diff line change @@ -347,6 +347,21 @@ test_expect_success 'fetch mirrors do not act as mirrors during push' '
347
347
)
348
348
'
349
349
350
+ test_expect_success ' add fetch mirror with specific branches' '
351
+ git init --bare mirror-fetch/track &&
352
+ (cd mirror-fetch/track &&
353
+ git remote add --mirror=fetch -t heads/new parent ../parent
354
+ )
355
+ '
356
+
357
+ test_expect_success ' fetch mirror respects specific branches' '
358
+ (cd mirror-fetch/track &&
359
+ git fetch parent &&
360
+ git rev-parse --verify refs/heads/new &&
361
+ test_must_fail git rev-parse --verify refs/heads/renamed
362
+ )
363
+ '
364
+
350
365
test_expect_success ' add --mirror=push' '
351
366
mkdir mirror-push &&
352
367
git init --bare mirror-push/public &&
@@ -382,6 +397,13 @@ test_expect_success 'push mirrors do not act as mirrors during fetch' '
382
397
)
383
398
'
384
399
400
+ test_expect_success ' push mirrors do not allow you to specify refs' '
401
+ git init mirror-push/track &&
402
+ (cd mirror-push/track &&
403
+ test_must_fail git remote add --mirror=push -t new public ../public
404
+ )
405
+ '
406
+
385
407
test_expect_success ' add alt && prune' '
386
408
(mkdir alttst &&
387
409
cd alttst &&
You can’t perform that action at this time.
0 commit comments