@@ -149,6 +149,11 @@ func parseRemoteUpdateOutput(output string) []*mirrorSyncResult {
149
149
150
150
switch {
151
151
case strings .HasPrefix (lines [i ], " * " ): // New reference
152
+ if strings .HasPrefix (lines [i ], " * [new tag]" ) {
153
+ refName = git .TagPrefix + refName
154
+ } else if strings .HasPrefix (lines [i ], " * [new branch]" ) {
155
+ refName = git .BranchPrefix + refName
156
+ }
152
157
results = append (results , & mirrorSyncResult {
153
158
refName : refName ,
154
159
oldCommitID : gitShortEmptySha ,
@@ -438,6 +443,21 @@ func syncMirror(repoID string) {
438
443
439
444
// Create reference
440
445
if result .oldCommitID == gitShortEmptySha {
446
+ if tp == git .TagPrefix {
447
+ tp = "tag"
448
+ } else if tp == git .BranchPrefix {
449
+ tp = "branch"
450
+ }
451
+ commitID , err := gitRepo .GetRefCommitID (result .refName )
452
+ if err != nil {
453
+ log .Error ("gitRepo.GetRefCommitID [repo_id: %s, ref_name: %s]: %v" , m .RepoID , result .refName , err )
454
+ continue
455
+ }
456
+ notification .NotifySyncPushCommits (m .Repo .MustOwner (), m .Repo , & repo_module.PushUpdateOptions {
457
+ RefFullName : result .refName ,
458
+ OldCommitID : git .EmptySHA ,
459
+ NewCommitID : commitID ,
460
+ }, repo_module .NewPushCommits ())
441
461
notification .NotifySyncCreateRef (m .Repo .MustOwner (), m .Repo , tp , result .refName )
442
462
continue
443
463
}
0 commit comments