Skip to content

Commit 1f968ec

Browse files
committed
Fix team members test case and add --all option test
- Update t0050-teams.sh to fix expected output for --members option to only show regular members, not team leaders - Add new test case for --all option to verify it shows all team members (both leaders and regular members) - Fix ShowTeams function logic in util/team.go to correctly handle display of languages when no options are specified Change-Id: I8e892b91b5efb0dbd5ff0d211b931fe084a457d8 Co-developed-by: Gemini <[email protected]>
1 parent 2fffc47 commit 1f968ec

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

test/t0050-teams.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ test_expect_success "show team members" '
105105
git -C workdir $HELPER team --members >out &&
106106
make_user_friendly_and_stable_output <out >actual &&
107107
108+
cat >expect <<-EOF &&
109+
Alex Henrie <[email protected]>
110+
Ralf Thielow <[email protected]>
111+
Phillip Szelat <[email protected]>
112+
Sébastien Helleu <[email protected]>
113+
Changwoo Ryu <[email protected]>
114+
Sihyeon Jang <[email protected]>
115+
116+
Nguyễn Thái Ngọc Duy <[email protected]>
117+
Ray Chen <[email protected]>
118+
119+
Fangyi Zhou <[email protected]>
120+
Franklin Weng <[email protected]>
121+
EOF
122+
123+
test_cmp expect actual
124+
'
125+
126+
test_expect_success "show all team members (leader + members)" '
127+
git -C workdir $HELPER team --all >out &&
128+
make_user_friendly_and_stable_output <out >actual &&
129+
108130
cat >expect <<-EOF &&
109131
Alexander Shopov <[email protected]>
110132
Jordi Mas <[email protected]>

util/team.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ func ShowTeams(args ...string) bool {
210210
if optLanguage {
211211
fmt.Printf("# %s:\n", team.Language)
212212
prefix = "\t"
213+
} else if !optLeader && !optMembers && !optAll {
214+
// When no options specified, show language code and name
215+
fmt.Printf("%s\n", team.Language)
216+
continue
213217
}
214218
if (optLeader || optAll) && team.Leader.Name != "" {
215219
fmt.Printf("%s%s <%s>\n", prefix, team.Leader.Name, team.Leader.Email)
@@ -220,9 +224,6 @@ func ShowTeams(args ...string) bool {
220224
fmt.Printf("%s%s <%s>\n", prefix, member.Name, member.Email)
221225
}
222226
}
223-
if !optLeader && !optMembers && !optAll && !optLanguage {
224-
fmt.Printf("# %s:\n", team.Language)
225-
}
226227
}
227228
return ret
228229
}

0 commit comments

Comments
 (0)