diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2020-04-01 04:17:41 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-01 11:10:38 -0700 |
commit | 0bbd0e8b5233b7cf66b846d4c1825a530d8402bd (patch) | |
tree | 18ced603d487ea5bd71d1ef0a34b8f8d5a244aa0 /t/t0055-beyond-symlinks.sh | |
parent | dir: fix confusion based on variable tense (diff) | |
download | tgif-0bbd0e8b5233b7cf66b846d4c1825a530d8402bd.tar.xz |
dir: refactor treat_directory to clarify control flow
The logic in treat_directory() is handled by a multi-case
switch statement, but this switch is very asymmetrical, as
the first two cases are simple but the third is more
complicated than the rest of the method. In fact, the third
case includes a "break" statement that leads to the block
of code outside the switch statement. That is the only way
to reach that block, as the switch handles all possible
values from directory_exists_in_index();
Extract the switch statement into a series of "if" statements.
This simplifies the trivial cases, while clarifying how to
reach the "show_other_directories" case. This is particularly
important as the "show_other_directories" case will expand
in a later change.
Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0055-beyond-symlinks.sh')
0 files changed, 0 insertions, 0 deletions