mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	fix reg
This commit is contained in:
		| @@ -17,7 +17,7 @@ from esphome.const import ( | ||||
|     TYPE_GIT, | ||||
|     TYPE_LOCAL, | ||||
| ) | ||||
| from esphome.core import CORE | ||||
| from esphome.core import CORE, TimePeriodSeconds | ||||
|  | ||||
| _LOGGER = logging.getLogger(__name__) | ||||
|  | ||||
| @@ -40,8 +40,9 @@ async def to_code(config): | ||||
|  | ||||
|  | ||||
| def _process_git_config(config: dict, refresh, skip_update: bool = False) -> str: | ||||
|     # When skip_update is True, set refresh to None to prevent updates | ||||
|     actual_refresh = None if skip_update else refresh | ||||
|     # When skip_update is True, set a very large refresh value to prevent updates | ||||
|     # Using 100 years in seconds to effectively disable refresh | ||||
|     actual_refresh = TimePeriodSeconds(days=36500) if skip_update else refresh | ||||
|     repo_dir, _ = git.clone_or_update( | ||||
|         url=config[CONF_URL], | ||||
|         ref=config.get(CONF_REF), | ||||
|   | ||||
| @@ -90,7 +90,7 @@ def clone_or_update( | ||||
|         if not file_timestamp.exists(): | ||||
|             file_timestamp = Path(repo_dir / ".git" / "HEAD") | ||||
|         age = datetime.now() - datetime.fromtimestamp(file_timestamp.stat().st_mtime) | ||||
|         if refresh is not None and age.total_seconds() > refresh.total_seconds: | ||||
|         if refresh is None or age.total_seconds() > refresh.total_seconds: | ||||
|             old_sha = run_git_command(["git", "rev-parse", "HEAD"], str(repo_dir)) | ||||
|             _LOGGER.info("Updating %s", key) | ||||
|             _LOGGER.debug("Location: %s", repo_dir) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user