Skip to content

fix(init): refuse an upstream that has tags but no branches - #527

Draft
roschaefer wants to merge 1 commit into
mainfrom
fix/19-init-tags-only
Draft

roschaefer wants to merge 1 commit into
mainfrom
fix/19-init-tags-only

Conversation

@roschaefer

Copy link
Copy Markdown
Owner

init checked for an empty upstream with ls-remote --heads, so a repository whose commits are reachable only through tags passed as empty. The first push then created a branch whose history is unrelated to the tagged commits, next to them, instead of stopping before the two histories split.

init now refuses any upstream that advertises refs besides HEAD. clone sent users with such an upstream to init ("has no branches yet"); it now names the ref it found instead, so neither command points to the other in a loop.

Fixes #19

init checked for an empty upstream with `ls-remote --heads`, so a
repository whose commits are reachable only through tags passed as
empty. The first push then created a branch whose history is unrelated
to the tagged commits, next to them, instead of stopping before the two
histories split.

init now refuses any upstream that advertises refs besides HEAD. clone
sent users with such an upstream to init ("has no branches yet"); it now
names the ref it found instead, so neither command points to the other
in a loop.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1df5b2e5-760a-4f9f-a854-ca01fbb36b34
Commits

Reviewing files that changed from the base of the PR and between cb3f483 and 08c729d.

Files selected for processing: 5

  • docs/tests/clone.bats
  • docs/tests/init.bats
  • src/clone.rs
  • src/init.rs
  • src/util.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init accepts an upstream whose commits are only reachable through tags

1 participant