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

Re: [PATCH] refs: run copy and rename through transactions

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 21, 2026, 23:28 UTC
Message-ID
<xmqqh5jijiar.fsf@gitster.g>
In-Reply-To
<xmqqjyoemqvu.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 41 quoted lines
>> +struct files_copy_or_rename_transaction_data {
>> +	struct ref_lock *lock;
>> +	struct object_id orig_oid;
>> +	struct object_id destination_oid;
>> +	char *destination_target;
>> +	int logmoved;
>> +	int destination_exists;
>> +	int destination_log_backed_up;
>> +};
>
> Good to have a type that can be used to hold pieces of information
> specific to the operation.  Can't we do without rename/copy specific
> addition to the generic ref_transaction struct by following the same
> principle?
>
> The comment above the members does make it understandable, but ...
>
>> @@ -240,6 +253,21 @@ struct ref_transaction {
>>  	void *backend_data;
>>  	unsigned int flags;
>>  	uint64_t max_index;
>> +
>> +	/*
>> +	 * Rename and copy operations need backend-specific reflog handling.
>> +	 * Their logical updates still live in `updates`, so hooks see the
>> +	 * operation like any other reference transaction. The fields below
>> +	 * retain the state that backends verify after taking their locks.
>> +	 */
>> +	enum ref_transaction_type type;
>> +	char *old_refname;
>> +	char *new_refname;
>> +	char *logmsg;
>> +	struct object_id source_oid;
>> +	struct object_id destination_oid;
>> +	char *destination_target;
>> +	unsigned int destination_exists:1;
>>  };
>
> ... is it the best we can do to contaminate a rather generic data
> structure for such a details relevant only to one specific
> operation?

More importantly, this structure suggests to me that you can have a single rename (or copy) from one source to one destination in a single transaction. Is that correct or am I misunderstanding the way this data structure is used? How would one rename A, B and C to X, Y and Z in a single transaction? Or perhaps rename A to B and copy C to D in a single transaction?

Previous: Junio C HamanoNext: Maciej Ciemborowicz
Message 5 of 32 in “[BUG] reference-transaction hook misses destination of git branch -m”
  1. Maciej CiemborowiczSep 19, 2026
  2. Karthik NayakSep 19, 2026
  3. refs: run copy and rename through transactionsMaciej Ciemborowicz, Sep 20, 2026
  4. Junio C HamanoSep 21, 2026
  5. Junio C HamanoSep 21, 2026
  6. Maciej CiemborowiczSep 22, 2026
  7. refs: run copy and rename through transactionsMaciej Ciemborowicz, Sep 23, 2026
  8. Maciej CiemborowiczSep 30, 2026
  9. Patrick SteinhardtOct 2, 2026
  10. Maciej CiemborowiczOct 2, 2026
  11. Patrick SteinhardtOct 5, 2026
  12. 0/4 refs: run copy and rename through transactionsMaciej Ciemborowicz, Oct 7, 2026
  13. 1/4 refs: distinguish internal transactions from logical updatesMaciej Ciemborowicz, Oct 7, 2026
  14. 2/4 refs: support replacing reflogs in a transactionMaciej Ciemborowicz, Oct 7, 2026
  15. 3/4 refs: run copy and rename through ordinary transactionsMaciej Ciemborowicz, Oct 7, 2026
  16. 4/4 refs: remove backend-specific copy and rename callbacksMaciej Ciemborowicz, Oct 7, 2026
  17. Junio C HamanoOct 7, 2026
  18. 0/4 refs: run copy and rename through transactionsMaciej Ciemborowicz, Oct 8, 2026
  19. 1/4 refs: distinguish internal transactions from logical updatesMaciej Ciemborowicz, Oct 8, 2026
  20. 2/4 refs: support replacing reflogs in a transactionMaciej Ciemborowicz, Oct 8, 2026
  21. 3/4 refs: run copy and rename through ordinary transactionsMaciej Ciemborowicz, Oct 8, 2026
  22. 4/4 refs: remove backend-specific copy and rename callbacksMaciej Ciemborowicz, Oct 8, 2026
  23. Patrick SteinhardtOct 8, 2026
  24. Maciej CiemborowiczOct 8, 2026
  25. Maciej CiemborowiczOct 8, 2026
  26. Junio C HamanoOct 8, 2026
  27. Maciej CiemborowiczOct 8, 2026
  28. Kristoffer HaugsbakkOct 8, 2026
  29. Maciej CiemborowiczOct 8, 2026
  30. Patrick SteinhardtOct 9, 2026
  31. Junio C HamanoOct 8, 2026
  32. Maciej CiemborowiczSep 23, 2026

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.