From: Karthik Nayak Date: Wed, 15 Oct 2025 09:29:35 GMT Subject: Re: [PATCH 9/9] refs: add a '--required' flag to 'git refs optimize' Message-ID: In-Reply-To: Karthik Nayak writes: > Junio C Hamano writes: > >> Karthik Nayak writes: >> >>> Junio C Hamano writes: >>> >>>> Junio C Hamano writes: >>>> >>>>> 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. >> > > I see what you mean. > >> Choosing a phrase around "check" is better, I would think. > > How about simply `--check`. Since the flag can be used with other > existing flags, it would make more sense to do > > git refs optimize --all --auto --check > git refs optimize --check > git refs optimize --all --check > > I will send in a new version around this and we can discuss further on > top of that! After speaking to Patrick today about this and his work on 'git maintenance', we realized we can actually broaden the scope. We could implement something like 'git maintenance needed'. This would check on a whole if repository maintenance is needed for refs and objects. I do think there is some merit in some of the patches of this series, so I'll spawn out couple of new series and send it to the list. Junio, from your latest 'What's cooking', I notice that this wasn't picked up, which is good. I hope its not too much churn in that sense :) Thanks