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

Re: [PATCH] shallow.c: use 'reset_repository_shallow' when appropriate

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 23, 2020, 19:05 UTC
Message-ID
<xmqq5zdqhvkk.fsf@gitster.c.googlers.com>
In-Reply-To
<20200423001438.GC19100@syl.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 8 quoted lines
>> What I am trying to get at is if it would be safer to have a pair of
>> thin wrapper for rolling back or committing a new version of new
>> shallow file, e.g. rollback_shallow_file() + commit_shallow_file(),
>> and replace calls to {rollback,commit}_lock_file() with calls to
>> them.
>
> Very elegant. Thanks for an excellent suggestion. v2 incoming just as
> soon as 'make test' finishes...

Note that I didn't verify there is a case where we want not to call reset_repository_shallow() after committing or rolling back, either for performance or correctness purposes. As long as the experts on the codepaths involved are happy with the idea, I'd be happy, too.

JNieder raised the idea of using a different type to avoid calling the bare rollback/commit functions by mistake. It appears that, in addition to these two functions, setup_alternate_shallow() needs to be updated if we wanted to go that route, and it sounds like a good idea to gain safety with minimal cost.

Thanks.
Previous: Taylor Blau
Message 32 of 32 in “shallow.c: use 'reset_repository_shallow' when appropriate”
  1. shallow.c: use 'reset_repository_shallow' when appropriateTaylor Blau, Apr 21, 2020
  2. Junio C HamanoApr 21, 2020
  3. Taylor BlauApr 21, 2020
  4. Junio C HamanoApr 21, 2020
  5. Taylor BlauApr 21, 2020
  6. Junio C HamanoApr 21, 2020
  7. Jonathan TanApr 22, 2020
  8. Jonathan TanApr 22, 2020
  9. Junio C HamanoApr 22, 2020
  10. Taylor BlauApr 23, 2020
  11. 0/2 shallow.c: reset shallow-ness after updatingTaylor Blau, Apr 23, 2020
  12. 1/2 t5537: use test_write_lines, indented heredocs for readabilityTaylor Blau, Apr 23, 2020
  13. Jonathan NiederApr 23, 2020
  14. Taylor BlauApr 24, 2020
  15. Jonathan NiederApr 24, 2020
  16. Junio C HamanoApr 24, 2020
  17. 2/2 shallow.c: use '{commit,rollback}_shallow_file'Taylor Blau, Apr 23, 2020
  18. Jonathan NiederApr 23, 2020
  19. Jonathan TanApr 23, 2020
  20. Junio C HamanoApr 23, 2020
  21. Taylor BlauApr 24, 2020
  22. Jonathan NiederJun 3, 2020
  23. Taylor BlauJun 3, 2020
  24. Taylor BlauJun 3, 2020
  25. Derrick StoleeJun 3, 2020
  26. Taylor BlauJun 3, 2020
  27. Jonathan NiederJun 3, 2020
  28. Jonathan NiederJun 3, 2020
  29. Taylor BlauJun 3, 2020
  30. Jonathan NiederJun 3, 2020
  31. Taylor BlauJun 4, 2020
  32. Junio C HamanoApr 23, 2020

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.