bringing attributes to pathspecs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 5 repliesIn review
- v22 patches 2 repliesSuperseded
- v12 patches 7 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | pathspec: allow querying for attributesDocumentation/ attr.c attr.h +4 more | +382 | 0 replies | |
| 2/2 | pathspec: allow escaped query valuespathspec.c t/ | +67 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/2] bringing attributes to pathspecs
v3 fixes some nits in style in the test script (using <<-\EOF instead of <<-EOF) as well as fixing a few other minor things reported by Junio and Jonathan.
Brandon Williams (2):
pathspec: allow querying for attributes
pathspec: allow escaped query values
Documentation/glossary-content.txt | 21 ++++ attr.c | 17 ++++ attr.h | 1 + dir.c | 43 +++++++- pathspec.c | 159 +++++++++++++++++++++++++++-- pathspec.h | 15 ++- t/t6135-pathspec-with-attrs.sh | 200 +++++++++++++++++++++++++++++++++++++ 7 files changed, 446 insertions(+), 10 deletions(-) create mode 100755 t/t6135-pathspec-with-attrs.sh
--- interdiff with bw/attr-pathspec
pathspec.c +3 -7
@@ -139,7 +139,7 @@ static void parse_pathspec_attr_match(struct pathspec_item *item, const char *vastruct string_list_item *si;struct string_list list =STRING_LIST_INIT_DUP ; -if (item->attr_check) +if (item->attr_check || item->attr_match)die (_ ("Only one 'attr:' specification is allowed." ));if (!value || !*value)
@@ -149,9 +149,7 @@ static void parse_pathspec_attr_match(struct pathspec_item *item, const char *vastring_list_remove_empty_items (&list,0 ); item->attr_check =attr_check_alloc (); -ALLOC_GROW (item->attr_match, - list.nr, - item->attr_match_alloc); + item->attr_match =xcalloc (list.nr,sizeof (struct attr_match ));for_each_string_list_item (si, &list) {size_t attr_len;
@@ -462,7 +460,6 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags, item->attr_check =NULL ; item->attr_match =NULL ; item->attr_match_nr =0 ; - item->attr_match_alloc =0 ;/* PATHSPEC_LITERAL_PATH ignores magic */ if (flags &PATHSPEC_LITERAL_PATH ) {
@@ -712,8 +709,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)COPY_ARRAY (d->attr_match, s->attr_match, d->attr_match_nr);for (j =0 ; j < d->attr_match_nr; j++) {const char *value = s->attr_match[j].value; -if (value) - d->attr_match[j].value =xstrdup (value); + d->attr_match[j].value =xstrdup_or_null (value); } d->attr_check =attr_check_dup (s->attr_check);
pathspec.h +0 -1
@@ -34,7 +34,6 @@ struct pathspec {int nowildcard_len;int flags;int attr_match_nr; -int attr_match_alloc; struct attr_match { char *value; enum attr_match_mode {
t/t6135-pathspec-with-attrs.sh +9 -9
@@ -4,7 +4,7 @@ test_description='test labels in pathspecs' . ./test-lib.sh test_expect_success 'setup a tree' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileA fileAB fileAC
@@ -49,7 +49,7 @@ test_expect_success 'pathspec with labels and non existent .gitattributes' ' ' test_expect_success 'setup .gitattributes' ' - cat <<-EOF >.gitattributes && + cat <<-\EOF >.gitattributes && fileA labelA fileB labelB fileC labelC
@@ -66,7 +66,7 @@ test_expect_success 'setup .gitattributes' ' ' test_expect_success 'check specific set attr' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileSetLabel sub/fileSetLabel EOF
@@ -75,7 +75,7 @@ test_expect_success 'check specific set attr' ' ' test_expect_success 'check specific unset attr' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileUnsetLabel sub/fileUnsetLabel EOF
@@ -84,7 +84,7 @@ test_expect_success 'check specific unset attr' ' ' test_expect_success 'check specific value attr' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileValue sub/fileValue EOF
@@ -95,7 +95,7 @@ test_expect_success 'check specific value attr' ' ' test_expect_success 'check unspecified attr' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && .gitattributes fileA fileAB
@@ -119,7 +119,7 @@ test_expect_success 'check unspecified attr' ' ' test_expect_success 'check multiple unspecified attr' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && .gitattributes fileC fileNoLabel
@@ -133,7 +133,7 @@ test_expect_success 'check multiple unspecified attr' ' ' test_expect_success 'check label with more labels but excluded path' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileAB fileB fileBC
@@ -143,7 +143,7 @@ test_expect_success 'check label with more labels but excluded path' ' ' test_expect_success 'check label excluding other labels' ' - cat <<-EOF >expect && + cat <<-\EOF >expect && fileAB fileB fileBC
Signature · 1 line
2.12.0.246.ga2ecc84866-goog