hook: add sign-off using "interpret-trailers"
[gitweb.git] / builtin / show-branch.c
index 4a6cc6f490f4e7b8a98adb362213535b6a9ae97d..527f69e283fd592c7b862b4ad6467d08d33e561c 100644 (file)
@@ -1,10 +1,12 @@
 #include "cache.h"
+#include "config.h"
 #include "commit.h"
 #include "refs.h"
 #include "builtin.h"
 #include "color.h"
 #include "argv-array.h"
 #include "parse-options.h"
+#include "dir.h"
 
 static const char* show_branch_usage[] = {
     N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
@@ -421,14 +423,6 @@ static int append_tag_ref(const char *refname, const struct object_id *oid,
 
 static const char *match_ref_pattern = NULL;
 static int match_ref_slash = 0;
-static int count_slash(const char *s)
-{
-       int cnt = 0;
-       while (*s)
-               if (*s++ == '/')
-                       cnt++;
-       return cnt;
-}
 
 static int append_matching_ref(const char *refname, const struct object_id *oid,
                               int flag, void *cb_data)
@@ -438,7 +432,7 @@ static int append_matching_ref(const char *refname, const struct object_id *oid,
         * refs/tags/v0.99.9a and friends.
         */
        const char *tail;
-       int slash = count_slash(refname);
+       int slash = count_slashes(refname);
        for (tail = refname; *tail && match_ref_slash < slash; )
                if (*tail++ == '/')
                        slash--;
@@ -529,7 +523,7 @@ static void append_one_rev(const char *av)
                int saved_matches = ref_name_cnt;
 
                match_ref_pattern = av;
-               match_ref_slash = count_slash(av);
+               match_ref_slash = count_slashes(av);
                for_each_ref(append_matching_ref, NULL);
                if (saved_matches == ref_name_cnt &&
                    ref_name_cnt < MAX_REVS)