Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add get_hash function #1962

Merged
merged 9 commits into from
Oct 11, 2022
Merged

add get_hash function #1962

merged 9 commits into from
Oct 11, 2022

Conversation

n-tux-tmp
Copy link
Contributor

Hello,

I saw the Discourse topic which got no answers yet, so I decided to give it a try (as I need this feature myself).

It’s basically a rough copy of get_file_hash but it takes a string literal in parameter instead of a file.
It was easier to adapt this function (and tests/documentation) than writing a filter instead. I hope this implementation still satisfies your expectations.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

@Keats
Copy link
Collaborator

Keats commented Aug 16, 2022

Can you rebase the PR?

@n-tux-tmp
Copy link
Contributor Author

Done!

Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I think I would merge get_file_hash and get_hash and just have a get_hash that takes either a path or literal arg since the logic/arguments is identical

components/templates/src/global_fns/files.rs Outdated Show resolved Hide resolved
@n-tux-tmp
Copy link
Contributor Author

n-tux-tmp commented Aug 16, 2022

I reworked the PR to merge get_hash and get_file_hash into a common function (process_hashes) to minimize the amount of duplicated lines of code.

Though I couldn’t completely get rid of compute_file_hash because another function is using it and I have no clue how to get around those and_then()… Sorry for my lack of experience.

@Keats
Copy link
Collaborator

Keats commented Aug 24, 2022

Any chance you can rebase + fix conflict? I'll merge it after, it looks good.

@n-tux-tmp
Copy link
Contributor Author

Should be fine now :)

@n-tux-tmp
Copy link
Contributor Author

As requested, I removed the get_file_hash function and added path argument to get_hash. I’ve updated the documentation and tests to reflect this change.

(I also managed to get rid of compute_file_hash somehow)

@Keats Keats merged commit 537b0b9 into getzola:next Oct 11, 2022
Keats pushed a commit that referenced this pull request Feb 16, 2023

Co-authored-by: Newbyte <newbie13xd@gmail.com>
Co-authored-by: n-tux-tmp <n-tux-tmp@example.com>
Co-authored-by: n-tux-tmp <n-tux-tmp@noreply.example.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants