cli: bookmark list: fix --tracked --remote to not include untracked refs

Different filter options should intersect. The doc also says --tracked "shows
remote tracked bookmarks only."
This commit is contained in:
Yuya Nishihara 2024-10-25 18:38:30 +09:00
parent fc3e99d0e9
commit c93d97d00b
2 changed files with 1 additions and 2 deletions

View file

@ -196,7 +196,7 @@ pub fn cmd_bookmark_list(
.any(|&(remote, _)| remote != git::REMOTE_NAME_FOR_LOCAL_GIT_REPO);
}
if args.all_remotes || args.remotes.is_some() {
if !args.tracked && (args.all_remotes || args.remotes.is_some()) {
for &(remote, remote_ref) in &untracked_remote_refs {
let ref_name = RefName::remote_only(name, remote, remote_ref.target.clone());
template.format(&ref_name, formatter.as_mut())?;

View file

@ -1819,7 +1819,6 @@ fn test_bookmark_list_tracked() {
@origin: zwtyzrop c761c7ea (empty) remote-sync
remote-unsync: nmzmmopx e1da745b (empty) local-only
@origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync
remote-untrack@origin: vmortlor 71a16b05 (empty) remote-untrack
"#
);
insta::assert_snapshot!(stderr, @r###"