commit - b93c7142c142ac5699accd8dd259187a22e200fb
commit + 62da3196627c41ea9acc5f53e0da9887dca2b82d
blob - aec06af5925a0cd63ffc6b150466bad036d5abd8
blob + fba8eb73431c038f4a91c744d8f6f0c55855c7e0
--- lib/fileindex.c
+++ lib/fileindex.c
walk_dir(struct got_pathlist_entry **next, struct got_fileindex *fileindex,
struct got_fileindex_entry **ie, struct got_pathlist_entry *dle, int fd,
const char *path, const char *rootpath, struct got_repository *repo,
- struct got_fileindex_diff_dir_cb *cb, void *cb_arg)
+ int ignore, struct got_fileindex_diff_dir_cb *cb, void *cb_arg)
{
const struct got_error *err = NULL;
struct dirent *de = dle->data;
} else
type = de->d_type;
- if (type == DT_DIR) {
+ if (type == DT_DIR && !ignore) {
char *subpath;
char *subdirpath;
struct got_pathlist_head subdirlist;
struct dirent *de = NULL;
size_t path_len = strlen(path);
struct got_pathlist_entry *dle;
+ int ignore;
if (cb->diff_traverse) {
err = cb->diff_traverse(cb_arg, path, dirfd);
break;
*ie = walk_fileindex(fileindex, *ie);
err = walk_dir(&dle, fileindex, ie, dle, dirfd,
- path, rootpath, repo, cb, cb_arg);
+ path, rootpath, repo, 0, cb, cb_arg);
} else if (cmp < 0 ) {
err = cb->diff_old(cb_arg, *ie, path);
if (err)
break;
*ie = walk_fileindex(fileindex, *ie);
} else {
- err = cb->diff_new(cb_arg, de, path, dirfd);
+ err = cb->diff_new(&ignore, cb_arg, de, path,
+ dirfd);
if (err)
break;
err = walk_dir(&dle, fileindex, ie, dle, dirfd,
- path, rootpath, repo, cb, cb_arg);
+ path, rootpath, repo, ignore, cb, cb_arg);
}
if (err)
break;
*ie = walk_fileindex(fileindex, *ie);
} else if (dle) {
de = dle->data;
- err = cb->diff_new(cb_arg, de, path, dirfd);
+ err = cb->diff_new(&ignore, cb_arg, de, path, dirfd);
if (err)
break;
err = walk_dir(&dle, fileindex, ie, dle, dirfd, path,
- rootpath, repo, cb, cb_arg);
+ rootpath, repo, ignore, cb, cb_arg);
if (err)
break;
}
blob - d03058e83c5f5c0a69baf66795455eb3ab8b7af7
blob + 0c22385de5665de7e4366e6db2b42d3737058e0f
--- lib/got_lib_fileindex.h
+++ lib/got_lib_fileindex.h
struct got_fileindex_entry *, struct dirent *, const char *, int);
typedef const struct got_error *(*got_fileindex_diff_dir_old_cb)(void *,
struct got_fileindex_entry *, const char *);
-typedef const struct got_error *(*got_fileindex_diff_dir_new_cb)(void *,
+typedef const struct got_error *(*got_fileindex_diff_dir_new_cb)(int *, void *,
struct dirent *, const char *, int);
typedef const struct got_error *(*got_fileindex_diff_dir_traverse)(void *,
const char *, int);
blob - 2fab18710a8a5331db77b19986086dd87bc4820d
blob + 8b445649ab78fb4dde26c6c0d79295a825c10599
--- lib/worktree.c
+++ lib/worktree.c
}
static const struct got_error *
-status_new(void *arg, struct dirent *de, const char *parent_path, int dirfd)
+status_new(int *ignore, void *arg, struct dirent *de, const char *parent_path,
+ int dirfd)
{
const struct got_error *err = NULL;
struct diff_dir_cb_arg *a = arg;
char *path = NULL;
+
+ if (ignore != NULL)
+ *ignore = 0;
if (a->cancel_cb && a->cancel_cb(a->cancel_arg))
return got_error(GOT_ERR_CANCELLED);
path = de->d_name;
}
- if (de->d_type != DT_DIR &&
- got_path_is_child(path, a->status_path, a->status_path_len)
- && !match_ignores(a->ignores, path))
+ if (de->d_type == DT_DIR) {
+ if (!a->no_ignores && ignore != NULL &&
+ match_ignores(a->ignores, path))
+ *ignore = 1;
+ } else if (!match_ignores(a->ignores, path) &&
+ got_path_is_child(path, a->status_path, a->status_path_len))
err = (*a->status_cb)(a->status_arg, GOT_STATUS_UNVERSIONED,
GOT_STATUS_NO_CHANGE, path, NULL, NULL, NULL, -1, NULL);
if (parent_path[0])
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- schedule_for_deletion, &sda, NULL, NULL, 0, 1);
+ schedule_for_deletion, &sda, NULL, NULL, 1, 1);
if (err)
break;
}
rfa.unlink_added_files = 0;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- revert_file, &rfa, NULL, NULL, 0, 0);
+ revert_file, &rfa, NULL, NULL, 1, 0);
if (err)
break;
}
cc_arg.allow_bad_symlinks = allow_bad_symlinks;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- collect_commitables, &cc_arg, NULL, NULL, 0, 0);
+ collect_commitables, &cc_arg, NULL, NULL, 1, 0);
if (err)
goto done;
}
rfa.repo = repo;
rfa.unlink_added_files = 0;
err = worktree_status(worktree, "", fileindex, repo,
- revert_file, &rfa, NULL, NULL, 0, 0);
+ revert_file, &rfa, NULL, NULL, 1, 0);
if (err)
goto sync;
rfa.repo = repo;
rfa.unlink_added_files = 0;
err = worktree_status(worktree, "", fileindex, repo,
- revert_file, &rfa, NULL, NULL, 0, 0);
+ revert_file, &rfa, NULL, NULL, 1, 0);
if (err)
goto sync;
cc_arg.have_staged_files = have_staged_files;
cc_arg.allow_bad_symlinks = allow_bad_symlinks;
err = worktree_status(worktree, "", fileindex, repo,
- collect_commitables, &cc_arg, NULL, NULL, 0, 0);
+ collect_commitables, &cc_arg, NULL, NULL, 1, 0);
if (err)
goto done;
rfa.repo = repo;
rfa.unlink_added_files = 1;
err = worktree_status(worktree, "", fileindex, repo,
- revert_file, &rfa, NULL, NULL, 0, 0);
+ revert_file, &rfa, NULL, NULL, 1, 0);
if (err)
goto sync;
oka.have_changes = 0;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- check_stage_ok, &oka, NULL, NULL, 0, 0);
+ check_stage_ok, &oka, NULL, NULL, 1, 0);
if (err)
goto done;
}
spa.allow_bad_symlinks = allow_bad_symlinks;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- stage_path, &spa, NULL, NULL, 0, 0);
+ stage_path, &spa, NULL, NULL, 1, 0);
if (err)
goto done;
}
upa.patch_arg = patch_arg;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- unstage_path, &upa, NULL, NULL, 0, 0);
+ unstage_path, &upa, NULL, NULL, 1, 0);
if (err)
goto done;
}