git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Allow "clone --dissociate" to dissociate from alternates

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 21, 2015, 17:52 UTC
Message-ID
<xmqqpp085cth.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<56274922.80007@cetitec.com>
Alexander Riesen <alexander.riesen@cetitec.com> writes:
> Reminder. Is this (or rather the one I'm replying to) patch a better option?

I suspect that the reason why you didn't get any quick response was because it was unclear from either one of these proposed log messages why any change is needed in the first place. At least that is what prevented me from commenting on either.

The "clone --dissociate" was designed to be used with "--reference". The mindset of those who saw the need for the feature being that "clone --reference" is the only way to make the resulting repository's objects incomplete, needing to borrow objects from some other place, which necessitates the "--dissociate" option.

The readers of this change need to be enlightened with a log message to remind them that "--reference" is not the only way. Namely, if you start from a repository with $GIT_DIR/objects/info/alternates, i.e. the original already borrows from somewhere, and bypass the normal "Git aware" transport mechanism, i.e. "git clone --local", then the resulting repository would also become dependent of the object store that the original depended on before the clone. In order to make it free-standing, you would need "--dissociate", but there is no "--reference" involved in that use case.

And once that is clarified, it becomes very clear why it is wrong to blindly require "--reference" to be there on the command line when "--dissociate" is given.

As to the patch, I think this one is much simpler and preferrable. It would hurt those who make a clone without bypassing the normal "Git aware" transport mechanism and pass "--dissociate" without "--reference". They will end up making a clone that does not need repacking to dissociate, but with this patch they would spend extra cycles to run an unnecessary repack. To avoid that, I think you can throw in an check at the beginning of dissociate_from_references() to see if git_path("objects/info/alternates") is there and make the function a no-op if there isn't.

Thanks.
Previous: Alexander RiesenNext: Alexander Riesen
Message 5 of 16 in “Use the alternates of the source repository for dissociating clone”
  1. Use the alternates of the source repository for dissociating cloneAlexander Riesen, Oct 15, 2015
  2. Johannes SchindelinOct 15, 2015
  3. Allow "clone --dissociate" to dissociate from alternatesAlexander Riesen, Oct 15, 2015
  4. Alexander RiesenOct 21, 2015
  5. Junio C HamanoOct 21, 2015
  6. Consider object stores in alternates during a dissociating cloneAlexander Riesen, Oct 22, 2015
  7. Junio C HamanoOct 22, 2015
  8. Alexander RiesenOct 22, 2015
  9. Junio C HamanoOct 22, 2015
  10. Alexander RiesenOct 22, 2015
  11. Junio C HamanoOct 22, 2015
  12. Junio C HamanoOct 22, 2015
  13. Documentation: AsciiDoc spells em-dash as double-dashes, not tripleJunio C Hamano, Oct 22, 2015
  14. Johannes LöthbergOct 23, 2015
  15. Junio C HamanoOct 15, 2015
  16. Alexander RiesenOct 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.