Re: [PATCH] show-ref: add --unresolved option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 5, 2024, 21:29 UTC
- Message-ID
- <xmqqzfvcz7sq.fsf@gitster.g>
- In-Reply-To
- <44609CA3-1215-4EAD-8456-DDD66A3B93A8@gmail.com>
John Cai <johncai86@gmail.com> writes:
> I think something like --no-dereference that was suggested in [1] could work > since the concept of dereferencing should be familiar to the user. However, this > maybe confusing because of the existing --dereference flag that is specific to > tags...
True.
As a symbolic reference is like a symbolic link [*], another possibility is to use "follow", which often is used to refer to the action of reading the contents of a symbolic link and using it as the target pathname (e.g., O_NOFOLLOW flag forbids open(2) from following symbolic links). Unfortunately the checkbox feature "--follow" the "git log" has refers to an entirely different kind of following, so it is just as confusing as --dereference.
Perhaps "--readlink", if you are showing only "ref: refs/heads/main" instead of the usual object name in the output? If we are showing both, we may want to use a name that signals the optional nature of the symref part of the output, e.g., "--with-symref-target" [*].
[Footnote]
* In fact that is how the symbolic reference started out as. We literally used a symbolic link .git/HEAD that points at the current branch, which can be seen in v0.99~418 (git-init-db: set up the full default environment, 2005-05-30).
* Yes, I know, I am terrible at naming things---my names may be descriptive but end up being unusably long and verbose.