Skip to content

Commit 8409313

Browse files
committed
Combine the two hashes only if the file names differ
1 parent 1f5c68a commit 8409313

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Jupytext ChangeLog
22
==================
33

4+
1.16.6 (2024-12-16)
5+
-------------------
6+
7+
**Fixed**
8+
- We fixed a "File Changed" warning when saving notebooks ([#1301](https://github.com/mwouts/jupytext/issues/1301))
9+
10+
**Changed**
11+
- The original file name is easier to infer from the tmp file name in pre-commit hooks ([#1289](https://github.com/mwouts/jupytext/issues/1289)) - thanks to [Lunin Leonid](https://github.com/lrlunin) for making this change.
12+
13+
414
1.16.5 (2024-12-15)
515
-------------------
616

src/jupytext/contentsmanager.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,22 @@ def read_one_file(alt_path, alt_fmt):
341341
model["last_modified"] = inputs.timestamp
342342

343343
if require_hash:
344-
if inputs.path is None or outputs.path is None:
345-
return model
346-
model_other = self.super.get(
347-
inputs.path if path == outputs.path else outputs.path,
348-
require_hash=True,
349-
)
350-
# The hash of a paired file is the concatenation of
351-
# the hashes of the input and output files
352-
if path == outputs.path:
353-
model["hash"] = model_other["hash"] + model["hash"]
354-
else:
355-
model["hash"] = model["hash"] + model_other["hash"]
356-
return model
344+
if (
345+
inputs.path is not None
346+
and outputs.path is not None
347+
and inputs.path != outputs.path
348+
):
349+
model_other = self.super.get(
350+
inputs.path if path == outputs.path else outputs.path,
351+
content=False,
352+
require_hash=True,
353+
)
354+
# The hash of a paired file is the concatenation of
355+
# the hashes of the input and output files
356+
if path == outputs.path:
357+
model["hash"] = model_other["hash"] + model["hash"]
358+
else:
359+
model["hash"] = model["hash"] + model_other["hash"]
357360

358361
if not content:
359362
return model

src/jupytext/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Jupytext's version number"""
22

3-
__version__ = "1.16.5"
3+
__version__ = "1.16.6"

0 commit comments

Comments
 (0)