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

Bare repository support #1299

Open
walderich opened this issue Mar 30, 2024 · 6 comments
Open

Bare repository support #1299

walderich opened this issue Mar 30, 2024 · 6 comments
Labels
enhancement New feature or request upstream

Comments

@walderich
Copy link

Summary 💡

Would it be possible to read repository information from a bare git repository? Currently only an error is printed that no repository can be found.

Motivation 🔦

I have a server running where all of my Git repositories are stored for synchronization. These are only bare repositories and it would be really helpful to get the statistics without cloning them or installing onefetch on every machine (I am developing on Windows, Linux and Mac).

@walderich walderich added the enhancement New feature or request label Mar 30, 2024
@spenserblack
Copy link
Collaborator

spenserblack commented Mar 31, 2024

Would it be possible to read repository information from a bare git repository?

Not as long as we use tokei, since that uses the actual files in the repository's directory, not the files in the git history. Though we might switch to a tool that can read bare repos.

Though we're still figuring out what the "source" for the files should be after the switch (e.g. #1152 (comment)).

@o2sh o2sh added the upstream label Apr 9, 2024
@spenserblack
Copy link
Collaborator

Sorry, I got a bit tunnel-visioned, I just realized, besides building language stats, onefetch reads files from "non-bare" repositories for

  • Manifests (package.json, Cargo.toml)
  • License files

So, besides #1305 (supersedes #1152), we'd have to update those utilities to read from a git commit/index. I don't think these stats will break, but they won't be included until those are updated as well.

Also, if I'm not mistaken, our call to gix::ThreadSafeRepository::discover_opts doesn't currently support bare repos and would need to be updated:

onefetch/src/info/mod.rs

Lines 113 to 120 in 3cdc171

let mut repo = gix::ThreadSafeRepository::discover_opts(
&cli_options.input,
gix::discover::upwards::Options {
dot_git_only: true,
..Default::default()
},
Mapping::default(),
)?

@halshar
Copy link

halshar commented Sep 6, 2024

do we have any updates on this or the bare support is still in draft?

@spenserblack
Copy link
Collaborator

spenserblack commented Sep 6, 2024

No updates. I've been very slow on #1305, even though not much work is left 🙇 If we ever support bare repos we'll need to make that switch, since I highly doubt that Tokei would ever behave in such a specialized manner.

So here's roughly what's left:

  • Support remaining few languages in Gengo that Onefetch needs to not throw a compiler error (or at least have a very good reason to drop a language's support)
  • Release a new version of Gengo (this part's trivial)

After that's done I think it will be pretty easy to support bare repositories for language detection (licenses and package manifests are a different story).

@halshar
Copy link

halshar commented Sep 6, 2024

thank you for the update and please take your time and thanks again for your work :)

@spenserblack
Copy link
Collaborator

Thank you! If you're interested, you can help add language support to Gengo (spenserblack/gengo#34). It's roughly 90% done -- it looks like I've slowed down the closer I got to the finish line 😅
🏁 🐌

Contributing language support is pretty easy. If you're familiar with the language, great! If not, it just takes some quick research to find at least one popular file extensions and/or filename for the language. Besides that, there's just picking a primary color for the language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request upstream
Projects
None yet
Development

No branches or pull requests

4 participants