commit - c50a74557db04e5ab02a1b0c53cb4fbdd64088ac
commit + 6092c29954d72000fdc1b6fe2a9c10ff56aabc65
blob - 814eb2087943991b565469794ce542b904c409f4
blob + c6d1f7ea574e7ec116144f4448f4ca17215ea404
--- 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 - bf1b968b1dcb7b8b268250267bca14c5c8447b66
blob + f3111e0b046c0a015967d9caba4e8e93a57c937d
--- 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;
}