1
0
mirror of https://github.com/git/git.git synced 2024-10-20 09:59:05 +02:00
git/builtin
Elijah Newren b548f0f156 dir: introduce readdir_skip_dot_and_dotdot() helper
Many places in the code were doing
    while ((d = readdir(dir)) != NULL) {
        if (is_dot_or_dotdot(d->d_name))
            continue;
        ...process d...
    }
Introduce a readdir_skip_dot_and_dotdot() helper to make that a one-liner:
    while ((d = readdir_skip_dot_and_dotdot(dir)) != NULL) {
        ...process d...
    }

This helper particularly simplifies checks for empty directories.

Also use this helper in read_cached_dir() so that our statistics are
consistent across platforms.  (In other words, read_cached_dir() should
have been using is_dot_or_dotdot() and skipping such entries, but did
not and left it to treat_path() to detect and mark such entries as
path_none.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-05-13 08:45:03 +09:00
..
add.c add: propagate --chmod errors to exit status 2021-02-24 12:14:51 -08:00
am.c
annotate.c
apply.c
archive.c
bisect--helper.c Merge branch 'jk/bisect-peel-tag-fix' 2021-03-19 15:25:37 -07:00
blame.c Merge branch 'rs/blame-optim' 2021-02-25 16:43:29 -08:00
branch.c Merge branch 'ph/use-delete-refs' 2021-02-05 16:40:45 -08:00
bugreport.c
bundle.c
cat-file.c
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c
checkout-index.c checkout-index: omit entries with no tempname from --temp output 2021-02-16 11:27:18 -08:00
checkout.c
clean.c dir: introduce readdir_skip_dot_and_dotdot() helper 2021-05-13 08:45:03 +09:00
clone.c Merge branch 'jt/clone-unborn-head' 2021-02-17 17:21:40 -08:00
column.c
commit-graph.c
commit-tree.c
commit.c
config.c
count-objects.c
credential-cache--daemon.c
credential-cache.c
credential-store.c
credential.c
describe.c
diff-files.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff-index.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff-tree.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
difftool.c
env--helper.c
fast-export.c
fast-import.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
fetch-pack.c
fetch.c Merge branch 'jt/clone-unborn-head' 2021-02-17 17:21:40 -08:00
fmt-merge-msg.c
for-each-ref.c
for-each-repo.c
fsck.c
gc.c maintenance: fix incorrect maintenance.repo path with bare repository 2021-02-23 00:22:45 -08:00
get-tar-commit-id.c
grep.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
hash-object.c
help.c
index-pack.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
init-db.c
interpret-trailers.c
log.c Merge branch 'ab/diff-deferred-free' 2021-02-22 16:12:43 -08:00
ls-files.c ls-files: error out on -i unless -o or -c are specified 2021-05-13 08:45:03 +09:00
ls-remote.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
mktag.c
mktree.c
multi-pack-index.c
mv.c git mv foo FOO ; git mv foo bar gave an assert 2021-03-03 17:07:12 -08:00
name-rev.c
notes.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
pack-objects.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
pack-redundant.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c
push.c Merge branch 'jc/push-delete-nothing' 2021-02-25 16:43:33 -08:00
range-diff.c Merge branch 'js/range-diff-one-side-only' 2021-02-17 17:21:41 -08:00
read-tree.c
rebase.c rebase: add a config option for --no-fork-point 2021-02-24 11:49:10 -08:00
receive-pack.c Merge branch 'rs/calloc-array' 2021-03-19 15:25:38 -07:00
reflog.c reflog expire --stale-fix: be generous about missing objects 2021-02-11 09:21:52 -08:00
remote-ext.c
remote-fd.c
remote.c
repack.c
replace.c
rerere.c
reset.c
rev-list.c rev-list: add --disk-usage option for calculating disk usage 2021-02-11 09:57:55 -08:00
rev-parse.c
revert.c
rm.c
send-pack.c
shortlog.c
show-branch.c
show-index.c
show-ref.c
sparse-checkout.c
stash.c Merge branch 'js/params-vs-args' 2021-02-25 16:43:32 -08:00
stripspace.c
submodule--helper.c Merge branch 'tb/precompose-prefix-too' 2021-02-12 14:21:04 -08:00
symbolic-ref.c
tag.c Merge branch 'js/params-vs-args' 2021-02-25 16:43:32 -08:00
unpack-file.c
unpack-objects.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
update-index.c
update-ref.c
update-server-info.c
upload-archive.c
upload-pack.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c dir: introduce readdir_skip_dot_and_dotdot() helper 2021-05-13 08:45:03 +09:00
write-tree.c