You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.7 KiB

  1. From 3d7015afa223494e3318495c2f5de9cb49229da9 Mon Sep 17 00:00:00 2001
  2. From: Wayne Davison <wayne@opencoder.net>
  3. Date: Mon, 1 Aug 2022 07:29:44 -0700
  4. Subject: [PATCH] A few more minor changes.
  5. ---
  6. exclude.c | 21 +++++++++++----------
  7. 1 file changed, 11 insertions(+), 10 deletions(-)
  8. --- a/exclude.c
  9. +++ b/exclude.c
  10. @@ -313,13 +313,10 @@ void add_implied_include(const char *arg
  11. if (am_server || old_style_args || list_only || filesfrom_host != NULL)
  12. return;
  13. if (relative_paths) {
  14. - cp = strstr(arg, "/./");
  15. - if (cp)
  16. - arg = cp+3;
  17. - } else {
  18. - if ((cp = strrchr(arg, '/')) != NULL)
  19. - arg = cp + 1;
  20. - }
  21. + if ((cp = strstr(arg, "/./")) != NULL)
  22. + arg = cp + 3;
  23. + } else if ((cp = strrchr(arg, '/')) != NULL)
  24. + arg = cp + 1;
  25. arg_len = strlen(arg);
  26. if (arg_len) {
  27. if (strpbrk(arg, "*[?")) {
  28. @@ -359,13 +356,17 @@ void add_implied_include(const char *arg
  29. int found = 0;
  30. *p = '\0';
  31. for (ent = implied_filter_list.head; ent; ent = ent->next) {
  32. - if (ent != rule && strcmp(ent->pattern, rule->pattern) == 0)
  33. + if (ent != rule && strcmp(ent->pattern, rule->pattern) == 0) {
  34. found = 1;
  35. + break;
  36. + }
  37. }
  38. if (!found) {
  39. filter_rule *R_rule = new0(filter_rule);
  40. - R_rule->rflags = FILTRULE_INCLUDE | FILTRULE_DIRECTORY
  41. - | (saw_wild ? FILTRULE_WILD : 0);
  42. + R_rule->rflags = FILTRULE_INCLUDE | FILTRULE_DIRECTORY;
  43. + /* Check if our sub-path has wildcards or escaped backslashes */
  44. + if (saw_wild && strpbrk(rule->pattern, "*[?\\"))
  45. + R_rule->rflags |= FILTRULE_WILD;
  46. R_rule->pattern = strdup(rule->pattern);
  47. R_rule->u.slash_cnt = slash_cnt;
  48. R_rule->next = implied_filter_list.head;