grep: add --threads=<num> option and grep.threads configuration
[gitweb.git] / builtin / branch.c
index b83116a609d90b18dcb4311151b261eaa5260f34..b99a436ef36ecfcc70636741642fdcf07b5a5810 100644 (file)
@@ -26,6 +26,7 @@ static const char * const builtin_branch_usage[] = {
        N_("git branch [<options>] [-l] [-f] <branch-name> [<start-point>]"),
        N_("git branch [<options>] [-r] (-d | -D) <branch-name>..."),
        N_("git branch [<options>] (-m | -M) [<old-branch>] <new-branch>"),
+       N_("git branch [<options>] [-r | -a] [--points-at]"),
        NULL
 };
 
@@ -581,7 +582,7 @@ static int edit_branch_description(const char *branch_name)
                    "  %s\n"
                    "Lines starting with '%c' will be stripped.\n",
                    branch_name, comment_line_char);
-       if (write_file(git_path(edit_description), 0, "%s", buf.buf)) {
+       if (write_file_gently(git_path(edit_description), "%s", buf.buf)) {
                strbuf_release(&buf);
                return error(_("could not write branch description template: %s"),
                             strerror(errno));
@@ -591,7 +592,7 @@ static int edit_branch_description(const char *branch_name)
                strbuf_release(&buf);
                return -1;
        }
-       stripspace(&buf, 1);
+       strbuf_stripspace(&buf, 1);
 
        strbuf_addf(&name, "branch.%s.description", branch_name);
        status = git_config_set(name.buf, buf.len ? buf.buf : NULL);
@@ -646,6 +647,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")),
                OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
                             N_("field name to sort on"), &parse_opt_ref_sorting),
+               {
+                       OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
+                       N_("print only branches of the object"), 0, parse_opt_object_name
+               },
                OPT_END(),
        };
 
@@ -674,7 +679,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
        if (!delete && !rename && !edit_description && !new_upstream && !unset_upstream && argc == 0)
                list = 1;
 
-       if (filter.with_commit || filter.merge != REF_FILTER_MERGED_NONE)
+       if (filter.with_commit || filter.merge != REF_FILTER_MERGED_NONE || filter.points_at.nr)
                list = 1;
 
        if (!!delete + !!rename + !!new_upstream +