Junio C Hamano <gitster@xxxxxxxxx> writes: > Having to do this change probably is an indication that the division > of labour between show_ref() and show_one() up to this step needs to > be rethought. > > Conceptually, "git show-ref" works in two ways: > > * When in --verify mode, the end user gives which refnames to > consider showing. > > * Otherwise the end user gives pattern and the command infers which > refnames to consider showing using the pattern. > > And for the refnames that are considered for showing, we may do > various things, like -d to deref and --quiet to be silent. We want > this actual "output" step to be the same between two modes of > operation. ... also "error out if the named object did not exist" can be part of this, which means ... > So a better division of labour would be: > > * Make show_ref() about "using pattern, enumerate what refs to > show" and call show_one(). > > * Update show_one() and teach _it_ to handle quiet and deref_tags. ... "if (!has_sha1_file(oid->hash)) die()" in show_ref() would probably want to be part of this update.