author | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Nov 2007 09:15:41 +0000 (01:15 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 17 Nov 2007 01:05:13 +0000 (17:05 -0800) | ||
commit | 0e06cc8b823144be16a9fc1f703126b68d20d3b5 | |
tree | 830668c049a9cfdf5ec945bc3be585c21eeff3de | tree | snapshot |
parent | dcf0c16ef1a8c2e468afe686a27a5549fea59798 | commit | diff |
Fix per-directory exclude handing for "git add"
In "dir_struct", each exclusion element in the exclusion stack records a
base string (pointer to the beginning with length) so that we can tell
where it came from, but this pointer is just pointing at the parameter
that is given by the caller to the push_exclude_per_directory()
function.
While read_directory_recursive() runs, calls to excluded() makes use
the data in the exclusion elements, including this base string. The
caller of read_directory_recursive() is not supposed to free the
buffer it gave to push_exclude_per_directory() earlier, until it
returns.
The test case Bruce Stephens gave in the mailing list discussion
was simplified and added to the t3700 test.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In "dir_struct", each exclusion element in the exclusion stack records a
base string (pointer to the beginning with length) so that we can tell
where it came from, but this pointer is just pointing at the parameter
that is given by the caller to the push_exclude_per_directory()
function.
While read_directory_recursive() runs, calls to excluded() makes use
the data in the exclusion elements, including this base string. The
caller of read_directory_recursive() is not supposed to free the
buffer it gave to push_exclude_per_directory() earlier, until it
returns.
The test case Bruce Stephens gave in the mailing list discussion
was simplified and added to the t3700 test.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c | diff | blob | history | |
t/t3700-add.sh | diff | blob | history |