Skip to content

Commit

Permalink
Combine the two hashes only if the file names differ
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Dec 17, 2024
1 parent 1f5c68a commit 8409313
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Jupytext ChangeLog
==================

1.16.6 (2024-12-16)
-------------------

**Fixed**
- We fixed a "File Changed" warning when saving notebooks ([#1301](https://github.com/mwouts/jupytext/issues/1301))

**Changed**
- 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.


1.16.5 (2024-12-15)
-------------------

Expand Down
29 changes: 16 additions & 13 deletions src/jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,22 @@ def read_one_file(alt_path, alt_fmt):
model["last_modified"] = inputs.timestamp

if require_hash:
if inputs.path is None or outputs.path is None:
return model
model_other = self.super.get(
inputs.path if path == outputs.path else outputs.path,
require_hash=True,
)
# The hash of a paired file is the concatenation of
# the hashes of the input and output files
if path == outputs.path:
model["hash"] = model_other["hash"] + model["hash"]
else:
model["hash"] = model["hash"] + model_other["hash"]
return model
if (
inputs.path is not None
and outputs.path is not None
and inputs.path != outputs.path
):
model_other = self.super.get(
inputs.path if path == outputs.path else outputs.path,
content=False,
require_hash=True,
)
# The hash of a paired file is the concatenation of
# the hashes of the input and output files
if path == outputs.path:
model["hash"] = model_other["hash"] + model["hash"]
else:
model["hash"] = model["hash"] + model_other["hash"]

if not content:
return model
Expand Down
2 changes: 1 addition & 1 deletion src/jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = "1.16.5"
__version__ = "1.16.6"

0 comments on commit 8409313

Please sign in to comment.