Skip to content

Fix files from other changelists shown under "No Changelist" when filtering#45

Merged
BHFock merged 3 commits into
mainfrom
include_no_cl
May 22, 2026
Merged

Fix files from other changelists shown under "No Changelist" when filtering#45
BHFock merged 3 commits into
mainfrom
include_no_cl

Conversation

@BHFock
Copy link
Copy Markdown
Owner

@BHFock BHFock commented May 21, 2026

Problem

When filtering git cl st by changelist name with --include-no-cl, files belonging to other (filtered-out) changelists were incorrectly listed under "No Changelist".

For example, with leak-a.txt in list1 and leak-b.txt in list2:

git cl st list1 --include-no-cl

showed leak-b.txt under "No Changelist", even though it is assigned to list2.

Cause

clutil_show_active_changelists only recorded a file as assigned when its changelist was actually displayed. The bookkeeping that populates assigned_files sat after the selected_names filter, so files in changelists that weren't shown never got recorded — and the "No Changelist" section, which lists everything not in assigned_files, then treated them as unassigned.

The bug was not specific to untracked files: a tracked modification ([ M]) in a filtered-out changelist leaked the same way. Untracked files just made it more noticeable.

Fix

Move the assigned_files bookkeeping ahead of the display filter, so all assignments are recorded regardless of which changelists are shown. Display remains filtered; only the accounting is now complete.

Test

Adds a regression test in test_basic_add_status.py that sets up two changelists, filters by one with --include-no-cl, and asserts that:

  • the filtered changelist and its file are shown,
  • a genuinely unassigned file does appear under "No Changelist",
  • files from the filtered-out changelist (both a tracked [ M] and an untracked [??]) do not leak in.

Verified failing against the previous code and passing with the fix.

@BHFock BHFock merged commit eb9d873 into main May 22, 2026
4 checks passed
@BHFock BHFock deleted the include_no_cl branch May 22, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant