@@ -22,8 +22,10 @@ static git_oid _oid_b3;
22
22
static git_oid _oid_b2 ;
23
23
static git_oid _oid_b1 ;
24
24
25
- /* git_oid *oid, git_repository *repo, (string literal) blob */
26
- #define CREATE_BLOB (oid , repo , blob ) git_blob_create_frombuffer(oid, repo, blob, sizeof(blob) - 1)
25
+ static git_oid _tag_commit ;
26
+ static git_oid _tag_tree ;
27
+ static git_oid _tag_blob ;
28
+ static git_oid _tag_lightweight ;
27
29
28
30
static int cred_acquire_cb (git_cred * * cred , const char * url , unsigned int allowed_types , void * payload )
29
31
{
@@ -157,6 +159,11 @@ void test_online_push__initialize(void)
157
159
git_oid_fromstr (& _oid_b2 , "a78705c3b2725f931d3ee05348d83cc26700f247" );
158
160
git_oid_fromstr (& _oid_b1 , "a78705c3b2725f931d3ee05348d83cc26700f247" );
159
161
162
+ git_oid_fromstr (& _tag_commit , "805c54522e614f29f70d2413a0470247d8b424ac" );
163
+ git_oid_fromstr (& _tag_tree , "ff83aa4c5e5d28e3bcba2f5c6e2adc61286a4e5e" );
164
+ git_oid_fromstr (& _tag_blob , "b483ae7ba66decee9aee971f501221dea84b1498" );
165
+ git_oid_fromstr (& _tag_lightweight , "951bbbb90e2259a4c8950db78946784fb53fcbce" );
166
+
160
167
/* Remote URL environment variable must be set. User and password are optional. */
161
168
_remote_url = cl_getenv ("GITTEST_REMOTE_URL" );
162
169
_remote_user = cl_getenv ("GITTEST_REMOTE_USER" );
@@ -407,6 +414,46 @@ void test_online_push__fast_fwd(void)
407
414
exp_refs_ff , ARRAY_SIZE (exp_refs_ff ), 0 );
408
415
}
409
416
417
+ void test_online_push__tag_commit (void )
418
+ {
419
+ const char * specs [] = { "refs/tags/tag-commit:refs/tags/tag-commit" };
420
+ push_status exp_stats [] = { { "refs/tags/tag-commit" , NULL } };
421
+ expected_ref exp_refs [] = { { "refs/tags/tag-commit" , & _tag_commit } };
422
+ do_push (specs , ARRAY_SIZE (specs ),
423
+ exp_stats , ARRAY_SIZE (exp_stats ),
424
+ exp_refs , ARRAY_SIZE (exp_refs ), 0 );
425
+ }
426
+
427
+ void test_online_push__tag_tree (void )
428
+ {
429
+ const char * specs [] = { "refs/tags/tag-tree:refs/tags/tag-tree" };
430
+ push_status exp_stats [] = { { "refs/tags/tag-tree" , NULL } };
431
+ expected_ref exp_refs [] = { { "refs/tags/tag-tree" , & _tag_tree } };
432
+ do_push (specs , ARRAY_SIZE (specs ),
433
+ exp_stats , ARRAY_SIZE (exp_stats ),
434
+ exp_refs , ARRAY_SIZE (exp_refs ), 0 );
435
+ }
436
+
437
+ void test_online_push__tag_blob (void )
438
+ {
439
+ const char * specs [] = { "refs/tags/tag-blob:refs/tags/tag-blob" };
440
+ push_status exp_stats [] = { { "refs/tags/tag-blob" , NULL } };
441
+ expected_ref exp_refs [] = { { "refs/tags/tag-blob" , & _tag_blob } };
442
+ do_push (specs , ARRAY_SIZE (specs ),
443
+ exp_stats , ARRAY_SIZE (exp_stats ),
444
+ exp_refs , ARRAY_SIZE (exp_refs ), 0 );
445
+ }
446
+
447
+ void test_online_push__tag_lightweight (void )
448
+ {
449
+ const char * specs [] = { "refs/tags/tag-lightweight:refs/tags/tag-lightweight" };
450
+ push_status exp_stats [] = { { "refs/tags/tag-lightweight" , NULL } };
451
+ expected_ref exp_refs [] = { { "refs/tags/tag-lightweight" , & _tag_lightweight } };
452
+ do_push (specs , ARRAY_SIZE (specs ),
453
+ exp_stats , ARRAY_SIZE (exp_stats ),
454
+ exp_refs , ARRAY_SIZE (exp_refs ), 0 );
455
+ }
456
+
410
457
void test_online_push__force (void )
411
458
{
412
459
const char * specs1 [] = {"refs/heads/b3:refs/heads/tgt" };
@@ -525,3 +572,25 @@ void test_online_push__expressions(void)
525
572
exp_stats_right_expr , ARRAY_SIZE (exp_stats_right_expr ),
526
573
NULL , 0 , 0 );
527
574
}
575
+
576
+ void test_online_push__notes (void )
577
+ {
578
+ git_oid note_oid , * target_oid , expected_oid ;
579
+ git_signature * signature ;
580
+ const char * specs [] = { "refs/notes/commits:refs/notes/commits" };
581
+ push_status exp_stats [] = { { "refs/notes/commits" , NULL } };
582
+ expected_ref exp_refs [] = { { "refs/notes/commits" , & expected_oid } };
583
+ git_oid_fromstr (& expected_oid , "8461a99b27b7043e58ff6e1f5d2cf07d282534fb" );
584
+
585
+ target_oid = & _oid_b6 ;
586
+
587
+ /* Create note to push */
588
+ cl_git_pass (
git_signature_new (
& signature ,
"nulltoken" ,
"[email protected] " ,
1323847743 ,
60 ));
/* Wed Dec 14 08:29:03 2011 +0100 */
589
+ cl_git_pass (git_note_create (& note_oid , _repo , signature , signature , NULL , target_oid , "hello world\n" , 0 ));
590
+
591
+ do_push (specs , ARRAY_SIZE (specs ),
592
+ exp_stats , ARRAY_SIZE (exp_stats ),
593
+ exp_refs , ARRAY_SIZE (exp_refs ), 0 );
594
+
595
+ git_signature_free (signature );
596
+ }
0 commit comments