# Fix searching for full SHA-256 commit hashes in Git graph \(\#63371\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1662f5f3f6497c5f80830ccdca1edfd1fc0c6c6a)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1662f5f3f6497c5f80830ccdca1edfd1fc0c6c6a

Requested commit: 1662f5f3f6497c5f80830ccdca1edfd1fc0c6c6a

Commit: 1662f5f3f6497c5f80830ccdca1edfd1fc0c6c6a

Tree: 4ade16b5491ebe94be95dca9829e56ae87f30f31

Author: Albert Bogusz

Committer: GitHub

## Message

```
Fix searching for full SHA-256 commit hashes in Git graph (#63371)

# Objective

Search in the Git graph does not support full commit hashes in SHA-256
formatted repos, while SHA-1 formatted repos work fine.

## Solution

Use existing constants in the `git` crate instead of hardcoded values
when checking for a commit hash query.

## Testing

Added a regression test for valid SHA-1 and SHA-256 commit hash lengths,
plus rejection of hashes longer than the max length.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<details>
  <summary>Click to view showcase</summary>

The screenshots below show the commit that is being searched for open in
the Git graph.

Before:
<img width="1153" height="536" alt="before"
src="https://github.com/user-attachments/assets/e47c4523-a046-4c47-ac75-cd00845b968f"
/>

After:
<img width="1153" height="536" alt="after"
src="https://github.com/user-attachments/assets/72eeaa16-d0ec-48cb-8ca2-c2bb26f02a10"
/>

</details>

---

Release Notes:

- Fixed searching for full SHA-256 commit hashes in the Git graph.
```

## Parents

- [e3adf43f37d7a2a9c165a78b255d293b0848d2d0](https://git.cafe/gitcafe/zed/commit/e3adf43f37d7a2a9c165a78b255d293b0848d2d0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1662f5f3f6497c5f80830ccdca1edfd1fc0c6c6a?format=markdown)
