From: Junio C Hamano Date: Mon, 23 Aug 2010 03:18:37 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.7.3-rc0~44 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bc38219f50ba9228945fba8e900d636f15082f16?ds=inline;hp=-c Merge branch 'maint' * maint: Typos in code comments, an error message, documentation --- bc38219f50ba9228945fba8e900d636f15082f16 diff --combined builtin/blame.c index 437b1a433a,28e3be2ead..101535448f --- a/builtin/blame.c +++ b/builtin/blame.c @@@ -1407,8 -1407,7 +1407,8 @@@ static void get_commit_info(struct comm int detailed) { int len; - char *tmp, *endp, *reencoded, *message; + const char *subject; + char *reencoded, *message; static char author_name[1024]; static char author_mail[1024]; static char committer_name[1024]; @@@ -1450,13 -1449,22 +1450,13 @@@ &ret->committer_time, &ret->committer_tz); ret->summary = summary_buf; - tmp = strstr(message, "\n\n"); - if (!tmp) { - error_out: + len = find_commit_subject(message, &subject); + if (len && len < sizeof(summary_buf)) { + memcpy(summary_buf, subject, len); + summary_buf[len] = 0; + } else { sprintf(summary_buf, "(%s)", sha1_to_hex(commit->object.sha1)); - free(reencoded); - return; } - tmp += 2; - endp = strchr(tmp, '\n'); - if (!endp) - endp = tmp + strlen(tmp); - len = endp - tmp; - if (len >= sizeof(summary_buf) || len == 0) - goto error_out; - memcpy(summary_buf, tmp, len); - summary_buf[len] = 0; free(reencoded); } @@@ -2368,11 -2376,11 +2368,11 @@@ parse_done * * The remaining are: * - * (1) if dashdash_pos != 0, its either + * (1) if dashdash_pos != 0, it is either * "blame [revisions] -- " or * "blame -- " * - * (2) otherwise, its one of the two: + * (2) otherwise, it is one of the two: * "blame [revisions] " * "blame " * diff --combined gitweb/gitweb.perl index 898b121b50,84261bba34..d0687f4581 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@@ -232,29 -232,6 +232,29 @@@ our %avatar_size = # Leave it undefined (or set to 'undef') to turn off load checking. our $maxload = 300; +# configuration for 'highlight' (http://www.andre-simon.de/) +# match by basename +our %highlight_basename = ( + #'Program' => 'py', + #'Library' => 'py', + 'SConstruct' => 'py', # SCons equivalent of Makefile + 'Makefile' => 'make', +); +# match by extension +our %highlight_ext = ( + # main extensions, defining name of syntax; + # see files in /usr/share/highlight/langDefs/ directory + map { $_ => $_ } + qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl), + # alternate extensions, see /etc/highlight/filetypes.conf + 'h' => 'c', + map { $_ => 'cpp' } qw(cxx c++ cc), + map { $_ => 'php' } qw(php3 php4), + map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi' + 'mak' => 'make', + map { $_ => 'xml' } qw(xhtml html htm), +); + # You define site-wide feature defaults here; override them with # $GITWEB_CONFIG as necessary. our %feature = ( @@@ -268,7 -245,7 +268,7 @@@ # return value of feature-sub indicates if to enable specified feature # # if there is no 'sub' key (no feature-sub), then feature cannot be - # overriden + # overridden # # use gitweb_get_feature() to retrieve the value # (an array) or gitweb_check_feature() to check if @@@ -1060,12 -1037,8 +1060,12 @@@ sub run_request reset_timer(); evaluate_uri(); + evaluate_gitweb_config(); check_loadavg(); + # $projectroot and $projects_list might be set in gitweb config file + $projects_list ||= $projectroot; + evaluate_query_params(); evaluate_path_info(); evaluate_and_validate_params(); @@@ -1113,8 -1086,12 +1113,8 @@@ sub evaluate_argv sub run { evaluate_argv(); - evaluate_gitweb_config(); evaluate_git_version(); - # $projectroot and $projects_list might be set in gitweb config file - $projects_list ||= $projectroot; - $pre_listen_hook->() if $pre_listen_hook; @@@ -1125,7 -1102,7 +1125,7 @@@ run_request(); - $pre_dispatch_hook->() + $post_dispatch_hook->() if $post_dispatch_hook; last REQUEST if ($is_last_request->()); @@@ -1346,7 -1323,7 +1346,7 @@@ sub esc_param return $str; } - # quote unsafe chars in whole URL, so some charactrs cannot be quoted + # quote unsafe chars in whole URL, so some characters cannot be quoted sub esc_url { my $str = shift; return undef unless defined $str; @@@ -3339,6 -3316,30 +3339,6 @@@ sub blob_contenttype sub guess_file_syntax { my ($highlight, $mimetype, $file_name) = @_; return undef unless ($highlight && defined $file_name); - - # configuration for 'highlight' (http://www.andre-simon.de/) - # match by basename - my %highlight_basename = ( - #'Program' => 'py', - #'Library' => 'py', - 'SConstruct' => 'py', # SCons equivalent of Makefile - 'Makefile' => 'make', - ); - # match by extension - my %highlight_ext = ( - # main extensions, defining name of syntax; - # see files in /usr/share/highlight/langDefs/ directory - map { $_ => $_ } - qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl), - # alternate extensions, see /etc/highlight/filetypes.conf - 'h' => 'c', - map { $_ => 'cpp' } qw(cxx c++ cc), - map { $_ => 'php' } qw(php3 php4), - map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi' - 'mak' => 'make', - map { $_ => 'xml' } qw(xhtml html htm), - ); - my $basename = basename($file_name, '.in'); return $highlight_basename{$basename} if exists $highlight_basename{$basename}; @@@ -3781,9 -3782,9 +3781,9 @@@ sub git_print_authorship } # Outputs table rows containing the full author or committer information, - # in the format expected for 'commit' view (& similia). + # in the format expected for 'commit' view (& similar). # Parameters are a commit hash reference, followed by the list of people - # to output information for. If the list is empty it defalts to both + # to output information for. If the list is empty it defaults to both # author and committer. sub git_print_authorship_rows { my $co = shift; @@@ -4512,8 -4513,8 +4512,8 @@@ sub git_patchset_body print "\n"; # class="patch" } - # for compact combined (--cc) format, with chunk and patch simpliciaction - # patchset might be empty, but there might be unprocessed raw lines + # for compact combined (--cc) format, with chunk and patch simplification + # the patchset might be empty, but there might be unprocessed raw lines for (++$patch_idx if $patch_number > 0; $patch_idx < @$difftree; ++$patch_idx) { diff --combined graph.c index e2a58605ca,85ab150787..f1a63c2241 --- a/graph.c +++ b/graph.c @@@ -7,6 -7,17 +7,6 @@@ /* Internal API */ -/* - * Output the next line for a graph. - * This formats the next graph line into the specified strbuf. It is not - * terminated with a newline. - * - * Returns 1 if the line includes the current commit, and 0 otherwise. - * graph_next_line() will return 1 exactly once for each time - * graph_update() is called. - */ -static int graph_next_line(struct git_graph *graph, struct strbuf *sb); - /* * Output a padding line in the graph. * This is similar to graph_next_line(). However, it is guaranteed to @@@ -62,7 -73,7 +62,7 @@@ enum graph_state /* * The list of available column colors. */ -static char column_colors[][COLOR_MAXLEN] = { +static const char *column_colors_ansi[] = { GIT_COLOR_RED, GIT_COLOR_GREEN, GIT_COLOR_YELLOW, @@@ -75,33 -86,23 +75,33 @@@ GIT_COLOR_BOLD_BLUE, GIT_COLOR_BOLD_MAGENTA, GIT_COLOR_BOLD_CYAN, + GIT_COLOR_RESET, }; -#define COLUMN_COLORS_MAX (ARRAY_SIZE(column_colors)) +#define COLUMN_COLORS_ANSI_MAX (ARRAY_SIZE(column_colors_ansi) - 1) + +static const char **column_colors; +static unsigned short column_colors_max; -static const char *column_get_color_code(const struct column *c) +void graph_set_column_colors(const char **colors, unsigned short colors_max) { - return column_colors[c->color]; + column_colors = colors; + column_colors_max = colors_max; +} + +static const char *column_get_color_code(unsigned short color) +{ + return column_colors[color]; } static void strbuf_write_column(struct strbuf *sb, const struct column *c, char col_char) { - if (c->color < COLUMN_COLORS_MAX) - strbuf_addstr(sb, column_get_color_code(c)); + if (c->color < column_colors_max) + strbuf_addstr(sb, column_get_color_code(c->color)); strbuf_addch(sb, col_char); - if (c->color < COLUMN_COLORS_MAX) - strbuf_addstr(sb, GIT_COLOR_RESET); + if (c->color < column_colors_max) + strbuf_addstr(sb, column_get_color_code(column_colors_max)); } struct git_graph { @@@ -225,11 -226,6 +225,11 @@@ static struct strbuf *diff_output_prefi struct git_graph *graph_init(struct rev_info *opt) { struct git_graph *graph = xmalloc(sizeof(struct git_graph)); + + if (!column_colors) + graph_set_column_colors(column_colors_ansi, + COLUMN_COLORS_ANSI_MAX); + graph->commit = NULL; graph->revs = opt; graph->num_parents = 0; @@@ -246,7 -242,7 +246,7 @@@ * always increment it for the first commit we output. * This way we start at 0 for the first commit. */ - graph->default_column_color = COLUMN_COLORS_MAX - 1; + graph->default_column_color = column_colors_max - 1; /* * Allocate a reasonably large default number of columns @@@ -369,7 -365,7 +369,7 @@@ static struct commit_list *first_intere static unsigned short graph_get_current_column_color(const struct git_graph *graph) { if (!DIFF_OPT_TST(&graph->revs->diffopt, COLOR_DIFF)) - return COLUMN_COLORS_MAX; + return column_colors_max; return graph->default_column_color; } @@@ -379,7 -375,7 +379,7 @@@ static void graph_increment_column_color(struct git_graph *graph) { graph->default_column_color = (graph->default_column_color + 1) % - COLUMN_COLORS_MAX; + column_colors_max; } static unsigned short graph_find_commit_color(const struct git_graph *graph, @@@ -443,7 -439,7 +443,7 @@@ static void graph_update_width(struct g max_cols++; /* - * We added a column for the the current commit as part of + * We added a column for the current commit as part of * graph->num_parents. If the current commit was already in * graph->columns, then we have double counted it. */ @@@ -1147,7 -1143,7 +1147,7 @@@ static void graph_output_collapsing_lin graph_update_state(graph, GRAPH_PADDING); } -static int graph_next_line(struct git_graph *graph, struct strbuf *sb) +int graph_next_line(struct git_graph *graph, struct strbuf *sb) { switch (graph->state) { case GRAPH_PADDING: