Changes in v5:
* Move GUARD_PATHSPEC to prevent checking if pathspec is null twice.
* Mark a string containing 'mnemonic' for translation.

Brandon Williams (16):
  mv: remove use of deprecated 'get_pathspec()'
  dir: remove struct path_simplify
  dir: convert fill_directory to use the pathspec struct interface
  ls-tree: convert show_recursive to use the pathspec struct interface
  pathspec: remove the deprecated get_pathspec function
  pathspec: copy and free owned memory
  pathspec: remove unused variable from unsupported_magic
  pathspec: always show mnemonic and name in unsupported_magic
  pathspec: simpler logic to prefix original pathspec elements
  pathspec: factor global magic into its own function
  pathspec: create parse_short_magic function
  pathspec: create parse_long_magic function
  pathspec: create parse_element_magic helper
  pathspec: create strip submodule slash helpers
  pathspec: small readability changes
  pathspec: rename prefix_pathspec to init_pathspec_item

 Documentation/technical/api-setup.txt |   2 -
 builtin/ls-tree.c                     |  16 +-
 builtin/mv.c                          |  50 ++--
 cache.h                               |   1 -
 dir.c                                 | 191 ++++++--------
 pathspec.c                            | 480 +++++++++++++++++++---------------
 pathspec.h                            |   5 +-
 7 files changed, 388 insertions(+), 357 deletions(-)

--- interdiff between v4 and v5

diff --git a/dir.c b/dir.c
index e8ddd7f8a..bc5ff7216 100644
--- a/dir.c
+++ b/dir.c
@@ -1353,18 +1353,17 @@ static int simplify_away(const char *path, int pathlen,
 {
        int i;
 
-       if (pathspec)
-               GUARD_PATHSPEC(pathspec,
-                              PATHSPEC_FROMTOP |
-                              PATHSPEC_MAXDEPTH |
-                              PATHSPEC_LITERAL |
-                              PATHSPEC_GLOB |
-                              PATHSPEC_ICASE |
-                              PATHSPEC_EXCLUDE);
-
        if (!pathspec || !pathspec->nr)
                return 0;
 
+       GUARD_PATHSPEC(pathspec,
+                      PATHSPEC_FROMTOP |
+                      PATHSPEC_MAXDEPTH |
+                      PATHSPEC_LITERAL |
+                      PATHSPEC_GLOB |
+                      PATHSPEC_ICASE |
+                      PATHSPEC_EXCLUDE);
+
        for (i = 0; i < pathspec->nr; i++) {
                const struct pathspec_item *item = &pathspec->items[i];
                int len = item->nowildcard_len;
@@ -1394,18 +1393,17 @@ static int exclude_matches_pathspec(const char *path, 
int pathlen,
 {
        int i;
 
-       if (pathspec)
-               GUARD_PATHSPEC(pathspec,
-                              PATHSPEC_FROMTOP |
-                              PATHSPEC_MAXDEPTH |
-                              PATHSPEC_LITERAL |
-                              PATHSPEC_GLOB |
-                              PATHSPEC_ICASE |
-                              PATHSPEC_EXCLUDE);
-
        if (!pathspec || !pathspec->nr)
                return 0;
 
+       GUARD_PATHSPEC(pathspec,
+                      PATHSPEC_FROMTOP |
+                      PATHSPEC_MAXDEPTH |
+                      PATHSPEC_LITERAL |
+                      PATHSPEC_GLOB |
+                      PATHSPEC_ICASE |
+                      PATHSPEC_EXCLUDE);
+
        for (i = 0; i < pathspec->nr; i++) {
                const struct pathspec_item *item = &pathspec->items[i];
                int len = item->nowildcard_len;
diff --git a/pathspec.c b/pathspec.c
index bcf3ba039..ff2509ddd 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -417,7 +417,7 @@ static void NORETURN unsupported_magic(const char *pattern,
                        strbuf_addstr(&sb, ", ");
 
                if (m->mnemonic)
-                       strbuf_addf(&sb, "'%s' (mnemonic: '%c')",
+                       strbuf_addf(&sb, _("'%s' (mnemonic: '%c')"),
                                    m->name, m->mnemonic);
                else
                        strbuf_addf(&sb, "'%s'", m->name);

-- 
2.11.0.390.gc69c2f50cf-goog

Reply via email to