Eye on the Tags header hides all tags, also tags added later
This commit is contained in:
@@ -78,3 +78,18 @@ describe("lineOwners", () => {
|
||||
expect(owners.get("f")).toBe("refs/heads/feature");
|
||||
});
|
||||
});
|
||||
|
||||
describe("hiding all tags", () => {
|
||||
const state = { hidden: [], rules: [], hideTags: true };
|
||||
it("hides every tag", () => {
|
||||
expect(isRefVisible("refs/tags/v1", state)).toBe(false);
|
||||
expect(isRefVisible("refs/tags/release/2", state)).toBe(false);
|
||||
});
|
||||
it("leaves branches alone", () => {
|
||||
expect(isRefVisible("refs/heads/main", state)).toBe(true);
|
||||
expect(isRefVisible("refs/remotes/origin/main", state)).toBe(true);
|
||||
});
|
||||
it("shows tags again when turned off", () => {
|
||||
expect(isRefVisible("refs/tags/v1", { ...state, hideTags: false })).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@ export function globMatch(pattern: string, text: string): boolean {
|
||||
|
||||
export function isRefVisible(name: string, state: FilterState): boolean {
|
||||
if (state.hidden.includes(name)) return false;
|
||||
if (state.hideTags && name.startsWith("refs/tags/")) return false;
|
||||
const short = shortName(name);
|
||||
const only = state.rules.filter((r) => r.mode === "only");
|
||||
if (only.length > 0 && !only.some((r) => globMatch(r.pattern, short))) return false;
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface FilterState {
|
||||
/** Full ref names hidden with the eye toggle. */
|
||||
hidden: string[];
|
||||
rules: FilterRule[];
|
||||
/** Hides every tag, also tags created later. */
|
||||
hideTags?: boolean;
|
||||
}
|
||||
|
||||
/** A commit as shown on screen, with its parent edges after collapsing. */
|
||||
|
||||
Reference in New Issue
Block a user