New behavior, new tests, added wizzard and processor
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -48,23 +48,22 @@ def config_try_override(config_writer: GitConfigParser, section: str, option: st
|
||||
config_writer.set(section, option, value)
|
||||
|
||||
|
||||
def prepare_git_auth(repo: str, config_dir):
|
||||
log.debug(f"CFG: Opening repo {repo}")
|
||||
repo = Repo(repo)
|
||||
path: str = repo._get_config_path("user")
|
||||
def prepare_git_auth(config_dir: str):
|
||||
# create mockup repo
|
||||
git_config = Path(config_dir).joinpath("git")
|
||||
config_file = git_config.joinpath("config")
|
||||
path: str = config_file.as_posix()
|
||||
|
||||
log.debug(f"CFG config path: {path}")
|
||||
path = os.path.dirname(path)
|
||||
log.debug(f"CFG parent path: {path}")
|
||||
if not os.path.isdir(path):
|
||||
if not git_config.is_dir():
|
||||
log.debug(f"CFG Creating config dir")
|
||||
os.mkdir(path)
|
||||
git_config.mkdir()
|
||||
|
||||
cred_store: str = os.path.join(path, "git-credentials")
|
||||
ssh_identity: str = os.path.join(config_dir, "ssh", "identity")
|
||||
cred_store: str = os.path.join(config_dir, "auth", "git-credentials")
|
||||
ssh_identity: str = os.path.join(config_dir, "auth", "ssh", "identity")
|
||||
|
||||
with repo.config_writer("user") as cfgw:
|
||||
with GitConfigParser(path, read_only = False) as cfgw:
|
||||
# github personal token
|
||||
# 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
|
||||
if token:
|
||||
config_try_override(
|
||||
cfgw,
|
||||
|
||||
Reference in New Issue
Block a user