mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Co-authored-by: Gitea <gitea@fake.local> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
		@@ -149,6 +149,11 @@ func parseRemoteUpdateOutput(output string) []*mirrorSyncResult {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		switch {
 | 
							switch {
 | 
				
			||||||
		case strings.HasPrefix(lines[i], " * "): // New reference
 | 
							case strings.HasPrefix(lines[i], " * "): // New reference
 | 
				
			||||||
 | 
								if strings.HasPrefix(lines[i], " * [new tag]") {
 | 
				
			||||||
 | 
									refName = git.TagPrefix + refName
 | 
				
			||||||
 | 
								} else if strings.HasPrefix(lines[i], " * [new branch]") {
 | 
				
			||||||
 | 
									refName = git.BranchPrefix + refName
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			results = append(results, &mirrorSyncResult{
 | 
								results = append(results, &mirrorSyncResult{
 | 
				
			||||||
				refName:     refName,
 | 
									refName:     refName,
 | 
				
			||||||
				oldCommitID: gitShortEmptySha,
 | 
									oldCommitID: gitShortEmptySha,
 | 
				
			||||||
@@ -434,6 +439,17 @@ func syncMirror(repoID string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		// Create reference
 | 
							// Create reference
 | 
				
			||||||
		if result.oldCommitID == gitShortEmptySha {
 | 
							if result.oldCommitID == gitShortEmptySha {
 | 
				
			||||||
 | 
								if tp == git.TagPrefix {
 | 
				
			||||||
 | 
									tp = "tag"
 | 
				
			||||||
 | 
								} else if tp == git.BranchPrefix {
 | 
				
			||||||
 | 
									tp = "branch"
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								commitID, err := gitRepo.GetRefCommitID(result.refName)
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									log.Error("gitRepo.GetRefCommitID [repo_id: %s, ref_name: %s]: %v", m.RepoID, result.refName, err)
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								notification.NotifySyncPushCommits(m.Repo.MustOwner(), m.Repo, result.refName, git.EmptySHA, commitID, repo_module.NewPushCommits())
 | 
				
			||||||
			notification.NotifySyncCreateRef(m.Repo.MustOwner(), m.Repo, tp, result.refName)
 | 
								notification.NotifySyncCreateRef(m.Repo.MustOwner(), m.Repo, tp, result.refName)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user