Skip to content

git clone: detect the object format of empty remotes - #10733

Draft
10ne1 wants to merge 1 commit into
jj-vcs:mainfrom
10ne1:sha256-empty-remote
Draft

10ne1 wants to merge 1 commit into
jj-vcs:mainfrom
10ne1:sha256-empty-remote

Conversation

@10ne1

@10ne1 10ne1 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Hello,

This is a draft until the next git version is released containing the git ls-remote --show-object-format command.

It fixes the last remaining item from issue #3813: the ability to detect and use the remote object format of empty remotes.

Thanks,
Adrian

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I understand the AI policy, and I fully understand the code that I am
    submitting (what it does, how it works, how it's organized), including any
    code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    an eye towards deleting anything that is irrelevant, clarifying anything
    that is confusing, and adding details that are relevant. This includes,
    for example, commit descriptions, PR descriptions, and code comments.

Fetching from a remote that uses another object format only fails if
there is something to fetch. So cloning an empty SHA-256 remote gave a
SHA-1 repository and the mismatch only showed up on the first push.

That is the usual way to start a new SHA-256 repository: create an empty
project on a forge, clone it, then push to it.

When the clone fetches nothing, ask the remote for its object format
with `git ls-remote --show-object-format`, which also works for empty
remotes. On a mismatch, the clone is retried with the remote format,
like it already is for remotes that have refs.

The option is new in Git >= 2.98. For older Git versions, the clone
uses `git.object-hash` as before.

Closes jj-vcs#3813

Assisted-by: Claude Opus 5.5
Comment thread CHANGELOG.md Resolved

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.

2 participants