Re: git-add has gone lstat() mad

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: git-add has gone lstat() mad

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:02

Linus Torvalds [off-list ref] writes:
Here's a patch. It passes all tests. It's not that complex. But people 
should double-check. ESPECIALLY the list of special characters (currently 
'?' '*' '\\' and '[').
I think the above is a good set.

This is an optimization different from what I was thinking
about.  I was hoping that we do not even need to call into
read_directory() if all the pathspec[] elements succeeds to
lstat() and they are not directories; in such a case we can just
stuff them to dir structure by hand, and use the remainder for
directory walk.

But I like this patch better.  We need to look at .gitignore to
warn about adding ignored files, so we cannot just stuff what
are found to dir without checking if they are ignored.

Re: git-add has gone lstat() mad

From: Andy Parkins <hidden>
Date: 2016-06-15 22:43:02

On Sunday 2007, April 01, Junio C Hamano wrote:
But I like this patch better.  We need to look at .gitignore to
warn about adding ignored files, so we cannot just stuff what
are found to dir without checking if they are ignored.
I needed the following needed on top of current pu:
diff --git a/unpack-trees.c b/unpack-trees.c
index fa36495..d4f7589 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -521,7 +521,7 @@ static void verify_clean_subdirectory(const char *path, const char *action,
 	memset(&d, 0, sizeof(d));
 	if (o->dir)
 		d.exclude_per_dir = o->dir->exclude_per_dir;
-	i = read_directory(&d, path, pathbuf, namelen+1);
+	i = read_directory(&d, path, pathbuf, namelen+1, NULL);
 	if (i)
 		die("Updating '%s' would lose untracked files in it",
 		    path);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help