|  |  | @@ -28,10 +28,11 @@ const { isMaster } = require('cluster'); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // Default Config... | 
		
	
		
			
			|  |  |  | var reposervers = [ | 
		
	
		
			
			|  |  |  | 'http://git.bbh' | 
		
	
		
			
			|  |  |  | , '//172.16.0.27/repos' | 
		
	
		
			
			|  |  |  | 'http://git.bbh' | 
		
	
		
			
			|  |  |  | , 'https://git.bbh.org.in' | 
		
	
		
			
			|  |  |  | , '//172.16.0.27/repos' | 
		
	
		
			
			|  |  |  | ] | 
		
	
		
			
			|  |  |  | var defaultRepoServer = reposervers[0] | 
		
	
		
			
			|  |  |  | var defaultRepoServer = reposervers[1] | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var currentGitAuthUser ; // nodeShellExec('git', ['config', 'user.email']) ... PB : TODO-- get the current gittea username | 
		
	
		
			
			|  |  |  | var defaultRepoOwner = 'chess'; | 
		
	
	
		
			
			|  |  | @@ -453,6 +454,48 @@ var __runcmd = function(label){ | 
		
	
		
			
			|  |  |  | , 'is-git-repo' : (dir)=>{ | 
		
	
		
			
			|  |  |  | return nodeShellExec('git', ['-C', dir.name, 'rev-parse'], { stdio : 'ignore'}) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | , 'set-url' : (remotename, url) => { | 
		
	
		
			
			|  |  |  | var pushable = processedArgs.pushable || false; | 
		
	
		
			
			|  |  |  | remotename = remotename || processedArgs._[1] | 
		
	
		
			
			|  |  |  | url = url || processedArgs._[2] | 
		
	
		
			
			|  |  |  | var serial_perform_git_seturl = (repo)=>{ | 
		
	
		
			
			|  |  |  | var options = {  cwd : repo } | 
		
	
		
			
			|  |  |  | // console.log(repo) | 
		
	
		
			
			|  |  |  | if(pushable) { | 
		
	
		
			
			|  |  |  | return [ | 
		
	
		
			
			|  |  |  | ['git', ['remote', 'set-url', remotename, url + '/' + repo], {  cwd : repo }] | 
		
	
		
			
			|  |  |  | ] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | console.error('not supported for non-pushable') | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | var x = (args)=>{ | 
		
	
		
			
			|  |  |  | return ()=>{ | 
		
	
		
			
			|  |  |  | // console.log(args) | 
		
	
		
			
			|  |  |  | return nodeShellExec.apply(null, args) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // return Promise.resolve(true) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | var perform_git_seturl = (dir)=>{ | 
		
	
		
			
			|  |  |  | op['is-git-repo'](dir).then((code)=>{ | 
		
	
		
			
			|  |  |  | any( serial_perform_git_seturl(dir.name).map(x) ) | 
		
	
		
			
			|  |  |  | }).catch((e)=>{ | 
		
	
		
			
			|  |  |  | // console.log('Failed : ' + dir.name) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const { readdir } = require("fs").promises | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const dirs = async (perform, path) => { | 
		
	
		
			
			|  |  |  | for (const dir of await readdir(path || process.cwd(), { withFileTypes: true })) { | 
		
	
		
			
			|  |  |  | if (dir.isDirectory()) perform(dir) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | dirs( perform_git_seturl) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | , 'add' : (remotename, url, branch) => { | 
		
	
		
			
			|  |  |  | var pushable = processedArgs.pushable || false; | 
		
	
		
			
			|  |  |  | remotename = remotename || processedArgs._[1] | 
		
	
	
		
			
			|  |  | @@ -719,10 +762,13 @@ var __runcmd = function(label){ | 
		
	
		
			
			|  |  |  | return pullCmd | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var errors = []; | 
		
	
		
			
			|  |  |  | var performPull = (repo) => { | 
		
	
		
			
			|  |  |  | if(existsSync(repo)) { | 
		
	
		
			
			|  |  |  | console.log('pulling ' + repo) | 
		
	
		
			
			|  |  |  | return nodeShellExec.apply(null, getPullCmd(repo)).catch((e)=>{ console.error(e) }) | 
		
	
		
			
			|  |  |  | return nodeShellExec.apply(null, getPullCmd(repo)).catch((e)=>{ | 
		
	
		
			
			|  |  |  | errors.push({ repo , e}) | 
		
	
		
			
			|  |  |  | console.error(e) }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | console.log('cloning ' + repo) | 
		
	
	
		
			
			|  |  | @@ -732,7 +778,10 @@ var __runcmd = function(label){ | 
		
	
		
			
			|  |  |  | inherit : true, shell: true, | 
		
	
		
			
			|  |  |  | env: process.env | 
		
	
		
			
			|  |  |  | , runas : processedArgs.runas | 
		
	
		
			
			|  |  |  | }).catch((e)=>{ console.error(e) }).then(()=>{ | 
		
	
		
			
			|  |  |  | }).catch((e)=>{ | 
		
	
		
			
			|  |  |  | errors.push({ repo , e}) | 
		
	
		
			
			|  |  |  | console.error(e) | 
		
	
		
			
			|  |  |  | }).then(()=>{ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | return nodeShellExec('git', ['config', '--replace-all' , 'core.symlinks', true], | 
		
	
		
			
			|  |  |  | { |