mirror of
https://github.com/esphome/esphome.git
synced 2025-02-07 13:40:59 +00:00
minor refactor to allow commit hash as ref value. (#6446)
This commit is contained in:
parent
63db07a156
commit
6deb253fa6
@ -59,17 +59,14 @@ def clone_or_update(
|
|||||||
)
|
)
|
||||||
|
|
||||||
repo_dir = _compute_destination_path(key, domain)
|
repo_dir = _compute_destination_path(key, domain)
|
||||||
fetch_pr_branch = ref is not None and ref.startswith("pull/")
|
|
||||||
if not repo_dir.is_dir():
|
if not repo_dir.is_dir():
|
||||||
_LOGGER.info("Cloning %s", key)
|
_LOGGER.info("Cloning %s", key)
|
||||||
_LOGGER.debug("Location: %s", repo_dir)
|
_LOGGER.debug("Location: %s", repo_dir)
|
||||||
cmd = ["git", "clone", "--depth=1"]
|
cmd = ["git", "clone", "--depth=1"]
|
||||||
if ref is not None and not fetch_pr_branch:
|
|
||||||
cmd += ["--branch", ref]
|
|
||||||
cmd += ["--", url, str(repo_dir)]
|
cmd += ["--", url, str(repo_dir)]
|
||||||
run_git_command(cmd)
|
run_git_command(cmd)
|
||||||
|
|
||||||
if fetch_pr_branch:
|
if ref is not None:
|
||||||
# We need to fetch the PR branch first, otherwise git will complain
|
# We need to fetch the PR branch first, otherwise git will complain
|
||||||
# about missing objects
|
# about missing objects
|
||||||
_LOGGER.info("Fetching %s", ref)
|
_LOGGER.info("Fetching %s", ref)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user