mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix some mirror bugs (#18649)
* Fix some mirror bugs * Remove unnecessary code * Fix lint * rename stdard url * Allow more charactors in git ssh protocol url * improve the detection * support ipv6 for git url parse * Fix bug * Fix template * Fix bug * fix template * Fix tmpl * Fix tmpl * Fix parse ssh with interface * Rename functions name Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		@@ -210,9 +210,10 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
 | 
			
		||||
	}
 | 
			
		||||
	gitArgs = append(gitArgs, m.GetRemoteName())
 | 
			
		||||
 | 
			
		||||
	remoteAddr, remoteErr := git.GetRemoteAddress(ctx, repoPath, m.GetRemoteName())
 | 
			
		||||
	remoteURL, remoteErr := git.GetRemoteURL(ctx, repoPath, m.GetRemoteName())
 | 
			
		||||
	if remoteErr != nil {
 | 
			
		||||
		log.Error("SyncMirrors [repo: %-v]: GetRemoteAddress Error %v", m.Repo, remoteErr)
 | 
			
		||||
		return nil, false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stdoutBuilder := strings.Builder{}
 | 
			
		||||
@@ -291,7 +292,7 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
 | 
			
		||||
 | 
			
		||||
	if m.LFS && setting.LFS.StartServer {
 | 
			
		||||
		log.Trace("SyncMirrors [repo: %-v]: syncing LFS objects...", m.Repo)
 | 
			
		||||
		endpoint := lfs.DetermineEndpoint(remoteAddr.String(), m.LFSEndpoint)
 | 
			
		||||
		endpoint := lfs.DetermineEndpoint(remoteURL.String(), m.LFSEndpoint)
 | 
			
		||||
		lfsClient := lfs.NewClient(endpoint, nil)
 | 
			
		||||
		if err = repo_module.StoreMissingLfsObjectsInRepository(ctx, m.Repo, gitRepo, lfsClient); err != nil {
 | 
			
		||||
			log.Error("SyncMirrors [repo: %-v]: failed to synchronize LFS objects for repository: %v", m.Repo, err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user