Merge branch 'ch/new-gpg-drops-rfc-1991'
[gitweb.git] / builtin / name-rev.c
index 0b21d7e5b297ff3d2d1a73d8a74c8bc37e672ccb..9736d4452f28728b4f970bbf52af502d94edba86 100644 (file)
@@ -33,10 +33,7 @@ static void name_rev(struct commit *commit,
                return;
 
        if (deref) {
-               char *new_name = xmalloc(strlen(tip_name)+3);
-               strcpy(new_name, tip_name);
-               strcat(new_name, "^0");
-               tip_name = new_name;
+               tip_name = xstrfmt("%s^0", tip_name);
 
                if (generation)
                        die("generation: %d, but deref?", generation);
@@ -87,7 +84,7 @@ static int subpath_matches(const char *path, const char *filter)
        const char *subpath = path;
 
        while (subpath) {
-               if (!fnmatch(filter, subpath, 0))
+               if (!wildmatch(filter, subpath, 0, NULL))
                        return subpath - path;
                subpath = strchr(subpath, '/');
                if (subpath)
@@ -255,9 +252,9 @@ static void show_name(const struct object *obj,
 }
 
 static char const * const name_rev_usage[] = {
-       N_("git name-rev [options] <commit>..."),
-       N_("git name-rev [options] --all"),
-       N_("git name-rev [options] --stdin"),
+       N_("git name-rev [<options>] <commit>..."),
+       N_("git name-rev [<options>] --all"),
+       N_("git name-rev [<options>] --stdin"),
        NULL
 };