From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: durham@fb.com, mitrandir@fb.com,
"Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/2] dir.c: correct "stuck" logging logic
Date: Thu, 17 Mar 2016 19:45:44 +0700 [thread overview]
Message-ID: <1458218744-15810-4-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1458218744-15810-1-git-send-email-pclouds@gmail.com>
Before the last patch, the loop in last_exclude_matching_from_list()
looks like this (greatly simplified of course)
exc = NULL;
for (...) {
if (sticky_paths.nr) {
if (matched) {
exc = something;
break;
}
continue;
}
...
}
With this loop, if sticky_paths.nr is non-zero and exc is not NULL, we
know we have found a sticky path and can log " (stuck)".
With the last patch, the "continue;" line is removed and that won't work
anymore. So explicitly keep track of when to print " (stuck)".
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
dir.c | 4 +++-
t/t1011-read-tree-sparse-checkout.sh | 8 ++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dir.c b/dir.c
index 77f38a5..2028094 100644
--- a/dir.c
+++ b/dir.c
@@ -1005,6 +1005,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
{
struct exclude *exc = NULL; /* undecided */
int i, maybe_descend = 0;
+ const char *stuck = "";
if (!el->nr)
return NULL; /* undefined */
@@ -1024,6 +1025,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
if (*dtype == DT_UNKNOWN)
*dtype = get_dtype(NULL, pathname, pathlen);
if (match_sticky(x, pathname, pathlen, *dtype)) {
+ stuck = " (stuck)";
exc = x;
break;
}
@@ -1093,7 +1095,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
trace_printf_key(&trace_exclude, "exclude: %.*s vs %s at line %d => %s%s\n",
pathlen, pathname, exc->pattern, exc->srcpos,
exc->flags & EXC_FLAG_NEGATIVE ? "no" : "yes",
- exc->sticky_paths.nr ? " (stuck)" : "");
+ stuck);
return exc;
}
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index ecc5e93..f0b856f 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -287,10 +287,14 @@ test_expect_success 'sparse checkout and dir.c sticky bits' '
!one/hideme
EOF
git config core.sparsecheckout true &&
- git checkout &&
+ GIT_TRACE_EXCLUDE=2 git checkout 2>&1 | grep stuck >stuck-list &&
test_path_is_missing one/hideme &&
test_path_is_file one/showme &&
- test_path_is_file two/showme
+ test_path_is_file two/showme &&
+ cat >expected <<-\EOF &&
+ exclude: one/showme vs /* at line 1 => yes (stuck)
+ EOF
+ test_cmp expected stuck-list
)
'
--
2.8.0.rc0.210.gd302cd2
next prev parent reply other threads:[~2016-03-17 12:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 0:09 bug: sparse config interpretation incorrectness in 2.8.0-rc2 Durham Goode
2016-03-17 0:56 ` Duy Nguyen
2016-03-17 6:49 ` Durham Goode
2016-03-17 7:51 ` Junio C Hamano
2016-03-17 10:17 ` Duy Nguyen
2016-03-17 13:04 ` Johannes Schindelin
2016-03-17 13:20 ` Duy Nguyen
2016-03-17 13:46 ` Johannes Schindelin
2016-03-17 14:00 ` Duy Nguyen
2016-03-18 15:49 ` Johannes Schindelin
2016-03-17 7:22 ` Junio C Hamano
2016-03-17 17:51 ` Durham Goode
2016-03-17 12:45 ` [PATCH 1/2] dir.c: fix bug in 'nd/exclusion-regression-fix' topic Nguyễn Thái Ngọc Duy
2016-03-17 12:45 ` Nguyễn Thái Ngọc Duy
2016-03-17 12:54 ` [PATCH 3/2] dir.c: fix dir re-inclusion rules with "NODIR" and "MUSTBEDIR" Nguyễn Thái Ngọc Duy
2016-03-17 23:49 ` Junio C Hamano
2016-03-18 0:15 ` Duy Nguyen
2016-03-18 5:40 ` Junio C Hamano
2016-03-18 5:51 ` Duy Nguyen
2016-03-18 5:58 ` Eric Sunshine
2016-03-18 4:51 ` Durham Goode
2016-03-18 5:40 ` Duy Nguyen
2016-03-18 6:21 ` Durham Goode
2016-03-18 6:28 ` Duy Nguyen
2016-03-18 18:00 ` Junio C Hamano
2016-03-18 18:37 ` Extending this cycle by a week and reverting !reinclusion topic Junio C Hamano
2016-03-19 1:03 ` [PATCH 3/2] dir.c: fix dir re-inclusion rules with "NODIR" and "MUSTBEDIR" Duy Nguyen
2016-03-17 12:45 ` [PATCH 2/2] dir.c: correct "stuck" logging logic Nguyễn Thái Ngọc Duy
2016-03-17 12:45 ` Nguyễn Thái Ngọc Duy [this message]
2016-03-18 17:38 ` [PATCH 1/2] dir.c: fix bug in 'nd/exclusion-regression-fix' topic Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458218744-15810-4-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=durham@fb.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mitrandir@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).