libkas: Reorder cloning commands and add silent mode consistently
The two code paths are unfortunate. Factor out the difference and use a single run_cmd invocation. This also adds the forgotten -q when using a reference directory. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
		
				
					committed by
					
						
						Daniel Wagner
					
				
			
			
				
	
			
			
			
						parent
						
							b911942883
						
					
				
				
					commit
					47e8a0730f
				
			@@ -170,18 +170,11 @@ def repo_fetch(config, repo):
 | 
				
			|||||||
        gitsrcdir = os.path.join(config.get_repo_ref_dir() or '',
 | 
					        gitsrcdir = os.path.join(config.get_repo_ref_dir() or '',
 | 
				
			||||||
                                 repo.qualified_name)
 | 
					                                 repo.qualified_name)
 | 
				
			||||||
        logging.debug('Looking for repo ref dir in %s', gitsrcdir)
 | 
					        logging.debug('Looking for repo ref dir in %s', gitsrcdir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmd = ['/usr/bin/git', 'clone', '-q', repo.url, repo.path]
 | 
				
			||||||
        if config.get_repo_ref_dir() and os.path.exists(gitsrcdir):
 | 
					        if config.get_repo_ref_dir() and os.path.exists(gitsrcdir):
 | 
				
			||||||
            run_cmd(['/usr/bin/git',
 | 
					            cmd.extend(['--reference', gitsrcdir])
 | 
				
			||||||
                     'clone',
 | 
					        run_cmd(cmd, env=config.environ, cwd=config.kas_work_dir)
 | 
				
			||||||
                     '--reference', gitsrcdir,
 | 
					 | 
				
			||||||
                     repo.url, repo.path],
 | 
					 | 
				
			||||||
                    env=config.environ,
 | 
					 | 
				
			||||||
                    cwd=config.kas_work_dir)
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            run_cmd(['/usr/bin/git', 'clone', '-q', repo.url,
 | 
					 | 
				
			||||||
                     repo.path],
 | 
					 | 
				
			||||||
                    env=config.environ,
 | 
					 | 
				
			||||||
                    cwd=config.kas_work_dir)
 | 
					 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Does refspec in the current repository?
 | 
					    # Does refspec in the current repository?
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user