Skip to content

Commit 1b41dff

Browse files
committed
Check first if destination is identical to patch
1 parent 8b41157 commit 1b41dff

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

custom_components/patch/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ async def _patch(
107107
destination_content = await file.read()
108108
async with aiofiles.open(patch) as file:
109109
patch_content = await file.read()
110-
if destination_content != base_content:
111-
LOGGER.warning(
112-
"Destination file '%s' is different than it's base '%s'.",
113-
destination,
114-
base,
115-
)
116-
return False
117110
if destination_content == patch_content:
118111
LOGGER.debug(
119112
"Destination file '%s' is identical to the patch file '%s'.",
120113
destination,
121114
patch,
122115
)
123116
return False
117+
if destination_content != base_content:
118+
LOGGER.warning(
119+
"Destination file '%s' is different than it's base '%s'.",
120+
destination,
121+
base,
122+
)
123+
return False
124124
async with aiofiles.open(destination, "w") as file:
125125
await file.write(patch_content)
126126
LOGGER.warning(

0 commit comments

Comments
 (0)