RE: [PATCH 9/9] refs: add a '--required' flag to 'git refs optimize'
From: Srivastava, Nitin <hidden>
Date: 2025-10-15 07:50:34
Please unsubscribe me from all email notifications. -----Original Message----- From: Junio C Hamano <redacted> Sent: Tuesday, October 14, 2025 11:17 PM To: Karthik Nayak <redacted> Cc: Patrick Steinhardt <redacted>; git@vger.kernel.org Subject: Re: [PATCH 9/9] refs: add a '--required' flag to 'git refs optimize' Karthik Nayak [off-list ref] writes:
Junio C Hamano [off-list ref] writes:quoted
Junio C Hamano [off-list ref] writes:quoted
Perhaps "--check-" followed by a word specific to what we are trying to achieve (e.g., if we are trying to see if auto-compaction is necessary, "--check-for-auto" "check for auto compaction")? I dunno.After reading what you did in the previou step, I am reasonably sure "required" is a wrong word to use, with or without other words like "check". Semantically it is similar to the should_pack_refs() check that we use for pack-refs even before "optimize" came. We expect it to answer this question cheaply: are we better off if we repacked, or can we go on without repacking for now? It is not about "are we performing so poorly that we MUST optimize now?"I agree '--required' isn't the best name, and like we discussed '--dry-run' wouldn't be either since that would imply that the work is being done but not persisted. I was leaning towards '--check', which is simple. But It might be nicer to be verbose here and simply add something like '--is-worthwhile'. Being verbose here is okay, since it will only be used sparingly and specifically by those who require such a use case.
Nah, "worthwhile" is relative and it would be less meaningful without expressing for what goal we are judging how it is worthwhile to do. Choosing a phrase around "check" is better, I would think. This transmission is intended solely for the addressee and contains confidential information. If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system. Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like.