mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
feat: allow the remote dotfiles to be fetched from a branch.
This commit is contained in:
parent
5660da7d32
commit
ae8f42e6ac
2 changed files with 3 additions and 1 deletions
|
|
@ -4,3 +4,4 @@ HOME_DIRECTORY = str(Path.home())
|
||||||
CONFIG_FILE = '.pre-commit-config.yaml'
|
CONFIG_FILE = '.pre-commit-config.yaml'
|
||||||
DEFAULT_CONFIG_FILE = HOME_DIRECTORY + '/' + CONFIG_FILE
|
DEFAULT_CONFIG_FILE = HOME_DIRECTORY + '/' + CONFIG_FILE
|
||||||
GITHUB_DOTFILES_REPOSITORY = 'https://github.com/avlos/dotfiles/'
|
GITHUB_DOTFILES_REPOSITORY = 'https://github.com/avlos/dotfiles/'
|
||||||
|
GITHUB_DOTFILES_REPOSITORY_BRANCH = 'some_branch_to_get_from_command_flag_for_development'
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from pre_commit.commands.install_uninstall import _hook_paths
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from git.repo.base import Repo
|
from git.repo.base import Repo
|
||||||
from pre_commit.avlos.constants import GITHUB_DOTFILES_REPOSITORY
|
from pre_commit.avlos.constants import GITHUB_DOTFILES_REPOSITORY
|
||||||
|
from pre_commit.avlos.constants import GITHUB_DOTFILES_REPOSITORY_BRANCH
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -42,7 +43,7 @@ def setup_avlos() -> int:
|
||||||
# check if folder exists, remove #
|
# check if folder exists, remove #
|
||||||
if os.path.isdir(installation_directory):
|
if os.path.isdir(installation_directory):
|
||||||
shutil.rmtree(installation_directory)
|
shutil.rmtree(installation_directory)
|
||||||
Repo.clone_from(GITHUB_DOTFILES_REPOSITORY, installation_directory)
|
Repo.clone_from(GITHUB_DOTFILES_REPOSITORY, installation_directory, b=GITHUB_DOTFILES_REPOSITORY_BRANCH)
|
||||||
|
|
||||||
### copy dotfiles to home directory ###
|
### copy dotfiles to home directory ###
|
||||||
dotfiles = os.listdir(installation_directory)
|
dotfiles = os.listdir(installation_directory)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue