fix get_gitea_token

This commit is contained in:
2025-08-07 11:27:54 +02:00
parent f136d81e44
commit 94e8014a90

View File

@@ -159,6 +159,10 @@ def check_repo(root, repo, url=None, branch=None):
do('git clone %s' % url) do('git clone %s' % url)
pull = True pull = True
created = doit created = doit
if 'gitea' in url:
hooksrc = '/afs/psi.ch/project/sinq/common/stow/markus/lib/gitea'
docopy(f'{hooksrc}/get_gitea_token', '.git/hooks/')
docopy(f'{hooksrc}/pre-commit', '.git/hooks/')
if created: if created:
chdir(join(root, repo)) chdir(join(root, repo))
docmd('git remote update') docmd('git remote update')
@@ -173,9 +177,9 @@ def check_repo(root, repo, url=None, branch=None):
gitconfig['pull.rebase'] = 'True' gitconfig['pull.rebase'] = 'True'
gitconfig['remote.origin.url'] = url gitconfig['remote.origin.url'] = url
if 'gitea' in url: if 'gitea' in url:
hooksrc = '/afs/psi.ch/project/sinq/common/stow/markus/lib/gitea' # hooksrc = '/afs/psi.ch/project/sinq/common/stow/markus/lib/gitea'
docopy(f'{hooksrc}/get_gitea_token', '.git/hooks/') # docopy(f'{hooksrc}/get_gitea_token', '.git/hooks/')
docopy(f'{hooksrc}/pre-commit', '.git/hooks/') # docopy(f'{hooksrc}/pre-commit', '.git/hooks/')
gitconfig['credential.helper'] = f'{getcwd()}/.git/hooks/get_gitea_token' gitconfig['credential.helper'] = f'{getcwd()}/.git/hooks/get_gitea_token'
diff = {k: v for k, v in gitconfig.items() if v != prev.get(k) and v != prev.get(k.replace('branch.', ''))} diff = {k: v for k, v in gitconfig.items() if v != prev.get(k) and v != prev.get(k.replace('branch.', ''))}
if doit: if doit: