@@ -139,38 +139,64 @@ void status_subcommand::run()
139139 // output_format = 3;
140140 // }
141141
142+ bool is_long;
143+ is_long = ((of == output_format::DEFAULT) || (of == output_format::LONG));
142144 if (sl.has_tobecommited_header ())
143145 {
144- std::cout << tobecommited_header << std::endl;
146+ if (is_long)
147+ {
148+ std::cout << tobecommited_header << std::endl;
149+ }
145150 print_entries (GIT_STATUS_INDEX_NEW, sl, true , of);
146151 print_entries (GIT_STATUS_INDEX_MODIFIED, sl, true , of);
147152 print_entries (GIT_STATUS_INDEX_DELETED, sl, true , of);
148153 print_entries (GIT_STATUS_INDEX_RENAMED, sl, true , of);
149154 print_entries (GIT_STATUS_INDEX_TYPECHANGE, sl, true , of);
150- std::cout << std::endl;
155+ if (is_long)
156+ {
157+ std::cout << std::endl;
158+ }
151159 }
152160
153161 if (sl.has_notstagged_header ())
154162 {
155- std::cout << notstagged_header << std::endl;
163+ if (is_long)
164+ {
165+ std::cout << notstagged_header << std::endl;
166+ }
156167 print_entries (GIT_STATUS_WT_MODIFIED, sl, false , of);
157168 print_entries (GIT_STATUS_WT_DELETED, sl, false , of);
158169 print_entries (GIT_STATUS_WT_TYPECHANGE, sl, false , of);
159170 print_entries (GIT_STATUS_WT_RENAMED, sl, false , of);
160- std::cout << std::endl;
171+ if (is_long)
172+ {
173+ std::cout << std::endl;
174+ }
161175 }
162176
163177 if (sl.has_untracked_header ())
164178 {
165- std::cout << untracked_header << std::endl;
179+ if (is_long)
180+ {
181+ std::cout << untracked_header << std::endl;
182+ }
166183 print_entries (GIT_STATUS_WT_NEW, sl, false , of);
167- std::cout << std::endl;
184+ if (is_long)
185+ {
186+ std::cout << std::endl;
187+ }
168188 }
169189
170190 if (sl.has_ignored_header ())
171191 {
172- std::cout << ignored_header << std::endl;
192+ if (is_long)
193+ {
194+ std::cout << ignored_header << std::endl;
195+ }
173196 print_entries (GIT_STATUS_IGNORED, sl, false , of);
174- std::cout << std::endl;
197+ if (is_long)
198+ {
199+ std::cout << std::endl;
200+ }
175201 }
176202}
0 commit comments