-
Notifications
You must be signed in to change notification settings - Fork 13
gitk: Add user preference to hide custom references #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Update: I just filed a similar FR #17 with some thoughts. Thank you for working on this! The PR works for me except for #18. I had to manually add the option into my config file. Update 2: Now that I realized that deleting the config file is a workaround for #18, I tested that this fully works. Ideally, I think this would be a View option and more flexible, as I discuss in #17, but this PR is much, much better than nothing. Also, there's precedent with the I'll certainly be using this PR from now on. Thank you again! |
Closing. See discussion in #17. |
I missed that I based the list on Git's /*
* No command-line or config options were given, so
* populate with sensible defaults.
*/
for (size_t i = 0; i < ARRAY_SIZE(ref_namespace); i++) {
if (!ref_namespace[i].decoration)
continue;
string_list_append(include, ref_namespace[i].ref);
} and enum ref_namespace {
NAMESPACE_HEAD,
NAMESPACE_BRANCHES,
NAMESPACE_TAGS,
NAMESPACE_REMOTE_REFS,
NAMESPACE_STASH,
NAMESPACE_REPLACE,
NAMESPACE_NOTES,
NAMESPACE_PREFETCH,
NAMESPACE_REWRITTEN,
/* Must be last */
NAMESPACE__COUNT
}; |
Git marks some namespaces as "decoration" here. Those not marked as decoration are filtered out by default. This reminds me that I also like to see Hm, aren't we entering personal preferences again? |
4a4a512
to
d21ae73
Compare
I added Do you have a better name for the setting "Hide custom refs"? |
d21ae73
to
8353392
Compare
You may have already seen these, but if it helps to seed ideas, I'll quote myself from #17 (comment)
From the above discussion, another possibility is to have two new checkboxes: "other decoration refs" and "non-decoration refs". |
My initial suggestion was to call this option "Hide non-standard refs" with the definition that "standard refs" was everything that Git knows about. I have seen this mysterious submission that adds an option to hide But now I see that prefetch refs are actually "standard" by this definition, and the cited case would not be subsumed by this solution here if we take the definition literally. On the other hand, "bisect" refs would be "non-standard" by the same definition, yet we must never hide "bisect" refs, hence, it cannot be affected by this option. My conclusion is that we need a more customizable solution. Or am I overthinking things here? |
I'm fine with making this customizable, just let me know where in the UI it should go (global settings? View?), and which command-line flags should be supported. Found a Stack Overflow complaint from 2 months ago about Gitk showing prefetch refs. Whatever name and option is chosen, it should have sensible defaults (and I think hiding those refs should be turned on by default, like Git does). Exceptions can be provided in a list. |
I would provide an edit box in the global preferences labeled Hide these references (pattern): The default setting is such that users who have not changed the setting do not observe a change in behavior. Whether the edit box is a single line with space-separated content or multi-line with patterns on lines I cannot tell without seeing the result first. In a subsequent step, the option Hide remote refs can perhaps be subsumed into this option. The setting would only influence the operation of |
Is it important to you to preserve the current behavior of showing all refs? My hunch is the vast majority of users would prefer sensible defaults. Let's say the exclude list is is a one-line input field that's comma-separated. How can that syntax be communicated to the user? (I prefer one-line to multi-line because I don't want the preferences window to grow in size to include a large empty input box, but maybe there's a better way to implement that. |
It is important to preserve the current behavior. Consider a user who types
A would have chosen a space separated list because a SP cannot occur in a ref. How to communicate that to the user I have no good idea, tough. |
They'd wonder that with a default-configuration Both are not ideal, but it feels more natural to me to have an unconfigured gitk behave like unconfigured git, and worth a "breaking change". In any case, I accept your decision. I'll implement an exclude list and will remove behavior of only showing "default" refs when the list is empty. |
8353392
to
fe567b3
Compare
I added setting called "Refs to hide (space-separated)" - my current value for it is I thought about adding a tooltip when you hover over the label, giving some more information about the format, but I am not familiar with Tcl/Tk. Tried something like this, but it had no effect. Is it because this is a ttk label? bind $page.refstohidef.l <Enter> {set status "Hover text"}
bind $page.refstohidef.l <Leave> {set status ""} |
If I run Perhaps this setting should also prevent |
I would expect that ref enumeration works the same as with |
Seems to work as advertised. But can we please have a different name instead of |
External tools such as Jujutsu may add many references that are of no interest to the user. This preference allows hiding them. Signed-off-by: Ori Avtalion <[email protected]>
fe567b3
to
680b689
Compare
Renamed. |
External tools such as Jujutsu may add many references that are of no interest to the user. This preference hides them.
The non-custom refs are those that pass git's default decoration filter (see set_default_decoration_filter).
The preference is off by default, maintaining current behavior.