eza icon indicating copy to clipboard operation
eza copied to clipboard

feat: Support for sha256 git repositories

Open Digit4lSh4d0w opened this issue 9 months ago • 2 comments

Summary

Add support for git repositories using the sha256 object format.

Currently, when using a sha256 git repo, the branch and status display functions do not work.

Steps to trigger the problem:

1. Create sha1 git repo:

  1. Create folder for git repo with sha1: mkdir test-sha1.
  2. Enter to directory: cd test-sha1.
  3. Create repository with sha1 object format: git init --object-format sha1.
  4. Create file: echo "test" > file.txt.
  5. Stage file: git add file.txt.
  6. Commit file: git commit -m "Add file.txt".
  7. Return: cd ...

2. Create sha256 git repo:

  1. Create folder for git repo with sha256: mkdir test-sha256.
  2. Enter to directory: cd test-sha256.
  3. Create repository with sha256 object format: git init --object-format sha256.
  4. Create file: echo "test" > file.txt.
  5. Stage file: git add file.txt.
  6. Commit file: git commit -m "Add file.txt".
  7. Return: cd ...

3. Check the result:

  1. Run eza: eza --long --git-repos.
  2. Catch the wrong behavior.

Actual Behavior:

The functions related to displaying the branch name and repository status are not working.

Example (from my system):

... + main book-rust-in-action
... | main configs
... - -    cryptography
... - -    docker-compose-files

In the above example, I have left only the directories containing the git repositories. As you can see, some of them use sha1, while others use sha256.

Repositories using sha256 are displayed as simple directories without git repositories.

Expected Behavior:

The functions related to displaying the branch name and repository status are working.

Eza version and system specs:

  • Eza: v0.20.23 [+git]
  • OS: Archlinux 6.13.5-zen1-1-zen

Digit4lSh4d0w avatar Mar 04 '25 06:03 Digit4lSh4d0w

This would indeed be super cool, if anyone wants to work on support consider it endorsed!

cafkafk avatar Mar 04 '25 07:03 cafkafk

First issue will be libgit2 seemingly (allegedly?) not supporting it https://github.com/libgit2/libgit2/discussions/5840#discussioncomment-10845200

Moving from libgit2 would likely be a much larger scope issue (not that it would be unwelcome, if there is rust libraries with acceptable maturity and feature parity).

cafkafk avatar Mar 04 '25 07:03 cafkafk

@cafkafk Could you use gitoxide?

yonas avatar Jun 21 '25 15:06 yonas

If we were to move to gitoxide, we should move entirely from libgit2, and that's a major task, so it may be worth holding back on it a bit. I'm also not sure gitoxide has all the features we would need

cafkafk avatar Jun 25 '25 10:06 cafkafk