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

Feature Request: Add Branch Option for Remote Repository Packing #195

Open
tranquochuy645 opened this issue Dec 9, 2024 · 9 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@tranquochuy645
Copy link
Contributor

tranquochuy645 commented Dec 9, 2024

Hello @yamadashy ,

I'm new to this project but I'm willing to help creating a PR. I think it would be beneficial to add an option to select a specific commit ID or branch when packing a remote repository.

Current Behavior:
When packing a remote repository, the process uses the default branch.

Proposed Feature:
Add a branch option to the packing process, allowing users to select a specific commit ID or branch to pack.

Potential Implementation:

repomix --remote https://github.com/yamadashy/repomix --branch master
@yamadashy
Copy link
Owner

Hi, @tranquochuy645 !
Wow, thank you for the detailed feature proposal and implementation!

I've quickly reviewed the code and it looks great! Just one suggestion: since this is paired with the --remote option, could you rename the options to --remote-branch for better consistency?

I'll review the code more thoroughly later. Really appreciate your contribution!

@tranquochuy645
Copy link
Contributor Author

Hey @yamadashy,

Thanks for the feedback! I’ve updated the PR to rename the option to --remote-branch for consistency with the --remote option, as you suggested.

Let me know if anything else needs adjustment 👍

@yamadashy yamadashy added the enhancement New feature or request label Dec 10, 2024
@tranquochuy645 tranquochuy645 mentioned this issue Dec 10, 2024
2 tasks
@yamadashy
Copy link
Owner

Hi, @tranquochuy645
I've released v0.2.6 which includes your --remote-branch feature.
Thanks again for implementing this!

You can check out the release notes here:
https://github.com/yamadashy/repomix/releases/tag/v0.2.6

@darrelladjei
Copy link

Hey guys, it seems the commit option isn't supported?
I tried with npx repomix --remote https://github.com/cubiq/ComfyUI_IPAdapter_plus --remote-branch b188a6c.
Which should point to https://github.com/cubiq/ComfyUI_IPAdapter_plus/tree/b188a6c
Any help much appreciated!

@tranquochuy645
Copy link
Contributor Author

Hello @darrelladjei ,

Thank you for reporting this issue.
Apologies for the oversight. I didn’t verify whether it also works with a commit hash. It turns out that git clone -b only supports branch names and tags.

I'm currently working on another PR to fix this issue!

@darrelladjei
Copy link

Hey @tranquochuy645 thanks for addressing, let me know if I should also take a look! Haven't contributed before but willing to help get this over the line!
Any idea of time lines for your PR or even a way for me to hack this myself?
Thanks in advance.

@tranquochuy645
Copy link
Contributor Author

Hey @tranquochuy645 thanks for addressing, let me know if I should also take a look! Haven't contributed before but willing to help get this over the line! Any idea of time lines for your PR or even a way for me to hack this myself? Thanks in advance.

Thanks for your interest and willingness to help!

I have created a draft PR #212 . It works perfectly on my machine, but it still needs additional unit tests, and I’m not entirely sure how to write those properly.
If you’d like, feel free to try out the PR yourself and let me know how it works for you. Any feedback or help with writing the tests would be greatly appreciated!

@darrelladjei
Copy link

Nice thanks, thanks for that! It wasn't working for my use case when i ran it locally (using the Comfy_UI example from a few messages above).
I had a quick fix i just wrote tests for so made PR for it here.
Let me know what you think too!

@tranquochuy645
Copy link
Contributor Author

Hey @darrelladjei,

Thanks for your feedback! I’ve tested your use case, and I can confirm that my implementation doesn't work with the short commit hash (b188a6c), but it does work with the full hash (b188a6cb39b512a9c6da7235b880af42c78ccd0d).

This issue arises because git fetch doesn't support short commit hashes. However, I believe this limitation is acceptable given the circumstances.

The goal of my implementation is to avoid fetching any git history, and the optimal approach for this has been discussed in a previous Stack Overflow thread here: How to clone git repository with a specific revision/changeset.

Regarding your PR, I don't think git checkout will work for commits on branches other than the default branch unless you perform a git fetch first. That said, the tests are great, and I plan to adapt some of them.

Thanks again!

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

No branches or pull requests

3 participants