{"id":22744299,"url":"https://github.com/tommasoamici/hashdir","last_synced_at":"2025-03-30T04:44:53.157Z","repository":{"id":206811135,"uuid":"717752841","full_name":"TommasoAmici/hashdir","owner":"TommasoAmici","description":"A CLI to calculate a single hash for the contents of a directory.","archived":false,"fork":false,"pushed_at":"2025-03-11T07:43:31.000Z","size":186,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T05:15:33.813Z","etag":null,"topics":["cli","hashdir","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TommasoAmici.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-12T13:38:10.000Z","updated_at":"2023-11-12T13:44:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"39267e04-17fb-4d2e-b4f5-7897e76de241","html_url":"https://github.com/TommasoAmici/hashdir","commit_stats":null,"previous_names":["tommasoamici/hashdir"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommasoAmici%2Fhashdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommasoAmici%2Fhashdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommasoAmici%2Fhashdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommasoAmici%2Fhashdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TommasoAmici","download_url":"https://codeload.github.com/TommasoAmici/hashdir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246277351,"owners_count":20751548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hashdir","rust"],"created_at":"2024-12-11T01:45:12.706Z","updated_at":"2025-03-30T04:44:53.134Z","avatar_url":"https://github.com/TommasoAmici.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hashdir\n\nA CLI to calculate a single hash for the contents of a directory.\n\nIt uses the `xxh3` algorithm to calculate the hash of each file and it\nrespects `.gitignore` files, thanks to the [`ignore` crate](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore).\n\n```sh\nhashdir dir\n```\n\nIs roughly equivalent to this bash one-liner, minus the `.gitignore` support:\n\n```sh\nfind dir -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum\n```\n\n## Why would you want to do this?\n\nIt can be useful to cache expensive operations when code hasn't changed.\nFor example, you could use this to cache test runs in a monorepo when other\nparts of the codebase change.\n\nImagine you have a situation like the following:\n\n```mermaid\ngitGraph\n    commit\n    commit\n    branch feat/a\n    branch feat/b\n    checkout feat/a\n    commit\n    checkout feat/b\n    commit\n    checkout main\n    merge feat/a\n    checkout feat/b\n    merge main\n    checkout main\n    merge feat/b\n    commit\n    commit\n```\n\nYou have a `main` branch and two feature branches `feat/a` and `feat/b`.\n`feat/a` and `feat/b` operate on different parts of the codebase, so they\ncan't possibly generate conflicts.\n\nYou merge `feat/a` into `main` and then rebase or merge `feat/b` on top of `main`.\nAt this point your CI will run again, even though the code in `feat/b` hasn't\nchanged.\n\nIf you had a test report that matches the hash of the code in `feat/b` you could\nskip running the tests again if the hash hasn't changed.\n\nIn a rudimentary way, this is similar to what [nx](https://nx.dev/) and [turbo](https://turbo.build/)\ndo in the JavaScript ecosystem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommasoamici%2Fhashdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommasoamici%2Fhashdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommasoamici%2Fhashdir/lists"}