clean: simplify dir/not-dir logic
commit1f2e1088871e777355025a84f80a2d8b5cb04c06
authorJeff King <peff@peff.net>
Mon, 10 Mar 2014 17:24:47 +0000 (10 13:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Mar 2014 19:14:25 +0000 (11 12:14 -0700)
tree05124a700bc80d9d4a33232075383934e2368a1b
parentcf424f5fd89bb5cd09b24c96633f8951b6fd7b54
clean: simplify dir/not-dir logic

When we get a list of paths from read_directory, we further
prune it to create the final list of items to remove. The
code paths for directories and non-directories repeat the
same "add to list" code.

This patch restructures the code so that we don't repeat
ourselves. Also, by following a "if (condition) continue"
pattern like the pathspec check above, it makes it more
obvious that the conditional is about excluding directories
under certain circumstances.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clean.c