-#include <signal.h>
-#include <sys/time.h>
#include "cache.h"
+#include "dir.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
{
int baselen = strlen(base);
int src_size = len + 1;
+ int i_stk = i_stk;
+ int retval = 0;
+
+ if (o->dir)
+ i_stk = push_exclude_per_directory(o->dir, base, strlen(base));
+
do {
int i;
const char *first;
}
/* No name means we're done */
if (!first)
- return 0;
+ goto leave_directory;
pathlen = strlen(first);
ce_size = cache_entry_size(baselen + pathlen);
newbase[baselen + pathlen] = '/';
newbase[baselen + pathlen + 1] = '\0';
if (unpack_trees_rec(subposns, len, newbase, o,
- indpos, df_conflict_list))
- return -1;
+ indpos, df_conflict_list)) {
+ retval = -1;
+ goto leave_directory;
+ }
free(newbase);
}
free(subposns);
free(src);
} while (1);
+
+ leave_directory:
+ if (o->dir)
+ pop_exclude_per_directory(o->dir, i_stk);
+ return retval;
}
/* Unlink the last component and attempt to remove leading
/*
* We do not want to remove or overwrite a working tree file that
- * is not tracked.
+ * is not tracked, unless it is ignored.
*/
static void verify_absent(const char *path, const char *action,
struct unpack_trees_options *o)
if (o->index_only || o->reset || !o->update)
return;
- if (!lstat(path, &st))
+ if (!lstat(path, &st) && !(o->dir && excluded(o->dir, path)))
die("Untracked working tree file '%s' "
"would be %s by merge.", path, action);
}