* [PATCH] gitweb: Harden and improve $project_filter page title
From: Jakub Narebski @ 2012-02-12 15:21 UTC (permalink / raw)
To: git; +Cc: Bernhard R. Link, Jakub Narebski
Commit 19d2d23 (gitweb: add project_filter to limit project list
to a subdirectory, 2012-01-30) added also support for displaying
$project_filter, if present, in page title.
Unfortunately it forgot to treat $project_filter as path, and escape
it using esc_path(), like it is done for $filename.
Also, it was not obvious that "$site_name - $project_filter" is about
project filtering: use "$site_name - projects in '$project_filter'".
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Though we should probably also esc_path($project), not only
to_utf8($project) in get_page_title() subroutine.
So I am not that sure if it is really necessary, or if I should follow
it by further hardening of get_page_title().
Anyway I have noticed this when I was examining gitweb code for
generating page title, considering adding information about search for
project search. So this is patch I will be depending textually via
context lines on.
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 081ac45..8ba2022 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3751,7 +3751,7 @@ sub get_page_title {
unless (defined $project) {
if (defined $project_filter) {
- $title .= " - " . to_utf8($project_filter);
+ $title .= " - projects in '" . esc_path($project_filter) . "'";
}
return $title;
}
--
1.7.9
^ permalink raw reply related
* [PATCH v3] diff --stat: use the full terminal width
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:30 UTC (permalink / raw)
To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek
In-Reply-To: <7vmx8qr1gb.fsf@alter.siamese.dyndns.org>
Use as many columns as necessary for filenames, as few columns as
necessary for change counts, and up to 40 columns for the histogram.
Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the stat output can be almost useless. If the middle part
between { and } is long (because the file was moved to a completely
different directory), then most of the path would be truncated.
It makes sense to detect and use the full terminal width and display
full filenames if possible.
If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph would use the full
width, the output would look bad. Messages wrapped to about 80
columns would be interspersed with very long +- lines. It makes
sense to limit the width of the histogram to a fixed value, even if more
columns are available. This fixed value is subjectively hard-coded to
be 40 columns, which seems to work well for git.git and linux-2.6.git and
some other repositories.
If there isn't enough columns to print both the filename and the histogram,
at least 5/8 of available space is devoted to filenames. On a standard 80 column
terminal, or if not connected to a terminal and using the default of 80 columns,
this gives the same partition as before.
Number of columns required for change counts is computed based on
the maximum number of changed lines. This means that usually a few more
columns will be available for the filenames and the histogram.
Tests are added for various combinations of long filename and big change
count and ways to specify widths.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
Hi,
this is v3 (reduced to one patch) on top of:
- Save terminal width before setting up pager and export term_columns(),
- Rename lineno_width to decimal_width and export it.
The logic is described in a comment in show_stats() in diff.c. In case
of a column 80 terminal window, the output will not be identical,
because of using decimal_width, but it'll be very close to what was
there previously.
v3:
- use decimal_width(max_change) to calculate number of columns
required for change counts
- rework the logic to divide columns
- document the logic in comments, update docs
- add more tests
v2:
- style fixes
- some tests for git-format-patch added
- patches 3 and 4 squashed together, since they touch the same lines
- graph width is limited to 40 columns, even if there's more space
- patch descriptions extended and cleared up
Documentation/diff-options.txt | 14 +++---
diff.c | 93 +++++++++++++++++++++++++------------
t/t4014-format-patch.sh | 98 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 168 insertions(+), 37 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9f7cba2..35dfdfb 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -53,13 +53,15 @@ endif::git-format-patch[]
Generate a diff using the "patience diff" algorithm.
--stat[=<width>[,<name-width>[,<count>]]]::
- Generate a diffstat. You can override the default
- output width for 80-column terminal by `--stat=<width>`.
- The width of the filename part can be controlled by
- giving another width to it separated by a comma.
+ Generate a diffstat. By default, as much space as necessary
+ will be used for the filename part, and up to 40 columns for
+ the graph histogram. Maximum width defaults to terminal width,
+ or 80 columns if not connected to a terminal, and can be
+ overriden by `<width>`. The width of the filename part can be
+ limited by giving another width `<name-width>` after a comma.
By giving a third parameter `<count>`, you can limit the
- output to the first `<count>` lines, followed by
- `...` if there are more.
+ output to the first `<count>` lines, followed by `...` if
+ there are more.
+
These parameters can also be set individually with `--stat-width=<width>`,
`--stat-name-width=<name-width>` and `--stat-count=<count>`.
diff --git a/diff.c b/diff.c
index 7e15426..7abcbe9 100644
--- a/diff.c
+++ b/diff.c
@@ -1327,7 +1327,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
int i, len, add, del, adds = 0, dels = 0;
uintmax_t max_change = 0, max_len = 0;
int total_files = data->nr;
- int width, name_width, count;
+ int width, name_width, graph_width, number_width, count;
const char *reset, *add_c, *del_c;
const char *line_prefix = "";
int extra_shown = 0;
@@ -1341,25 +1341,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
line_prefix = msg->buf;
}
- width = options->stat_width ? options->stat_width : 80;
- name_width = options->stat_name_width ? options->stat_name_width : 50;
- count = options->stat_count ? options->stat_count : data->nr;
-
- /* Sanity: give at least 5 columns to the graph,
- * but leave at least 10 columns for the name.
- */
- if (width < 25)
- width = 25;
- if (name_width < 10)
- name_width = 10;
- else if (width < name_width + 15)
- name_width = width - 15;
-
/* Find the longest filename and max number of changes */
reset = diff_get_color_opt(options, DIFF_RESET);
add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
+ count = options->stat_count ? options->stat_count : data->nr;
+
for (i = 0; (i < count) && (i < data->nr); i++) {
struct diffstat_file *file = data->files[i];
uintmax_t change = file->added + file->deleted;
@@ -1380,19 +1368,63 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
}
count = i; /* min(count, data->nr) */
- /* Compute the width of the graph part;
- * 10 is for one blank at the beginning of the line plus
- * " | count " between the name and the graph.
+ /* We have width = stat_width or term_columns() columns total.
+ * We want a maximum of min(max_len, stat_name_width) for the name part.
+ * We want a maximum of min(max_change, 40) for the +- part.
+ * We also need 1 for " " and 4 + decimal_width(max_change)
+ * for " | NNNN " and one for " " at the end, altogether
+ * 6 + decimal_width(max_change).
+ *
+ * If there's not enough space, we will use stat_name_width
+ * or 5/8*width for filename, and the rest for constant
+ * elements + histogram, but no more than 40 for the histogram.
+ * (5/8 gives 50 for filename and 30 for constant parts and
+ * histogram for the standard terminal size).
*
- * From here on, name_width is the width of the name area,
- * and width is the width of the graph area.
+ * In other words: stat_width limits the maximum width, and
+ * stat_name_width fixes the maximum width of the filename,
+ * and is also used to divide available columns if there
+ * aren't enough.
*/
- name_width = (name_width < max_len) ? name_width : max_len;
- if (width < (name_width + 10) + max_change)
- width = width - (name_width + 10);
- else
- width = max_change;
+ width = options->stat_width ? options->stat_width : term_columns();
+ number_width = decimal_width(max_change);
+ /* first sizes that are wanted */
+ graph_width = max_change < 40 ? max_change : 40;
+ name_width = (options->stat_name_width > 0 &&
+ options->stat_name_width < max_len) ?
+ options->stat_name_width : max_len;
+
+ /* sanity: guarantee a minimum and maximum width */
+ if (width < 25)
+ width = 25;
+
+ if (name_width + number_width + 6 + graph_width > width) {
+ if (graph_width > width * 3/8 - number_width - 6)
+ graph_width = width * 3/8 - number_width - 6;
+ if (graph_width > 40)
+ graph_width = 40;
+ if (name_width > width - number_width - 6 - graph_width)
+ name_width = width - number_width - 6 - graph_width;
+ else
+ graph_width = width - number_width - 6 - name_width;
+ }
+ /* More sanity: give at least 5 columns to the graph,
+ * but leave at least 10 columns for the name.
+ *
+ * This should already be satisfied, unless max_change is
+ * really huge. If the window is extemely narrow, this might
+ * overflow available columns.
+ */
+ if (name_width < 10 && max_len >= 10)
+ name_width = 10;
+ if (graph_width < 5 && max_change >= 5)
+ graph_width = 5;
+
+ /* From here name_width is the width of the name area,
+ * and graph_width is the width of the graph area.
+ * max_change is used to scale graph properly.
+ */
for (i = 0; i < count; i++) {
const char *prefix = "";
char *name = data->files[i]->print_name;
@@ -1448,14 +1480,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
adds += add;
dels += del;
- if (width <= max_change) {
- add = scale_linear(add, width, max_change);
- del = scale_linear(del, width, max_change);
+ if (graph_width <= max_change) {
+ add = scale_linear(add, graph_width, max_change);
+ del = scale_linear(del, graph_width, max_change);
}
fprintf(options->file, "%s", line_prefix);
show_name(options->file, prefix, name, len);
- fprintf(options->file, "%5"PRIuMAX"%s", added + deleted,
- added + deleted ? " " : "");
+ fprintf(options->file, " %*"PRIuMAX"%s",
+ number_width, added + deleted,
+ added + deleted ? " " : "");
show_graph(options->file, '+', add, add_c, reset);
show_graph(options->file, '-', del, del_c, reset);
fprintf(options->file, "\n");
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6797512..91be989 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
cat > expect << EOF
---
- file | 16 ++++++++++++++++
+ file | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/file b/file
@@ -894,4 +894,100 @@ test_expect_success 'format patch ignores color.ui' '
test_cmp expect actual
'
+name=aaaaaaaaaa
+name=$name$name$name$name$name$name$name$name$name$name$name$name
+test_expect_success 'preparation' "
+ > ${name} &&
+ git add ${name} &&
+ git commit -m message &&
+ echo a > ${name} &&
+ git commit -m message ${name}
+"
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch graph width is 80 columns' '
+ git format-patch --stat --stdout -1 |
+ grep -m 1 aaaaa > actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch --stat=width with long name' '
+ git format-patch --stat=40 --stdout -1 |
+ grep -m 1 aaaa > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width works long name' '
+ git format-patch --stat-width=40 --stdout -1 |
+ grep -m 1 aaaa > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat=...,name-width with long name' '
+ git format-patch --stat=60,32 --stdout -1 |
+ grep -m 1 aaaa > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-name-width with long name' '
+ git format-patch --stat-name-width=32 --stdout -1 |
+ grep -m 1 aaaa > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'preparation' '
+ > abcd &&
+ git add abcd &&
+ git commit -m message &&
+ seq 1000 > abcd &&
+ git commit -m message abcd
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch graph width is 40 columns' '
+ git format-patch --stat --stdout -1 |
+ grep -m 1 abcd > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format patch ignores COLUMNS' '
+ COLUMNS=200 git format-patch --stat --stdout -1 |
+ grep -m 1 abcd > actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change' '
+ git format-patch --stat=40 --stdout -1 |
+ grep -m 1 abcd > actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width with big change' '
+ git format-patch --stat-width=40 --stdout -1 |
+ grep -m 1 abcd > actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change and long name' '
+ cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+ git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+ git commit -m message &&
+ git format-patch --stat-width=60 --stdout -1 |
+ grep -m 1 aaaa > actual &&
+ test_cmp expect actual
+'
+
test_done
--
1.7.9.3.g2429d.dirty
^ permalink raw reply related
* Re: [PATCH] git-svn: Fix time zone in --localtime
From: "Wei-Yin Chen (陳威尹)" @ 2012-02-12 13:49 UTC (permalink / raw)
To: Eric Wong; +Cc: git, Pete Harlan, gitster
In-Reply-To: <20120212081553.GA10068@dcvr.yhbt.net>
On 2012-02-12 16:15, Eric Wong wrote:
> I needed the following additional change to get things working:
>
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -6111,7 +6111,7 @@ sub run_pager {
>
> sub format_svn_date {
> my $t = shift || time;
> - my $gmoff = get_tz($t);
> + my $gmoff = Git::SVN::get_tz($t);
> return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
> }
Sorry, my bad. This bug of missing package reference can be triggered by
"git svn log", but unfortunately I didn't test this part manually. I'll
learn to use the git test suite next time.
>
> If there are no objections, I'll squash this and push for Junio
> tomorrow.
Excellent. Thank you for the testing and fixing effort!
^ permalink raw reply
* [PATCH 2/2] Rename lineno_width to decimal_width and export it
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:16 UTC (permalink / raw)
To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek
In-Reply-To: <7vsjigl79j.fsf@alter.siamese.dyndns.org>
This function will be used in calculating diff --stat graph width.
The name is changed because the function works for any number.
The function is moved from builtins/blame.c to pager.c because it
will be used not only in builtins/blame.c.
---
builtin/blame.c | 18 +++---------------
cache.h | 1 +
| 12 ++++++++++++
3 files changed, 16 insertions(+), 15 deletions(-)
This is another function to be exported. I hope it can be exported
together with term_columns(). I'll use it the next version of the diff
--stat patch.
diff --git a/builtin/blame.c b/builtin/blame.c
index 5a67c20..f028e8a 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1829,18 +1829,6 @@ static int read_ancestry(const char *graft_file)
}
/*
- * How many columns do we need to show line numbers in decimal?
- */
-static int lineno_width(int lines)
-{
- int i, width;
-
- for (width = 1, i = 10; i <= lines; width++)
- i *= 10;
- return width;
-}
-
-/*
* How many columns do we need to show line numbers, authors,
* and filenames?
*/
@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
if (largest_score < ent_score(sb, e))
largest_score = ent_score(sb, e);
}
- max_orig_digits = lineno_width(longest_src_lines);
- max_digits = lineno_width(longest_dst_lines);
- max_score_digits = lineno_width(largest_score);
+ max_orig_digits = decimal_width(longest_src_lines);
+ max_digits = decimal_width(longest_dst_lines);
+ max_score_digits = decimal_width(largest_score);
}
/*
diff --git a/cache.h b/cache.h
index 2f30b3a..3857dfd 100644
--- a/cache.h
+++ b/cache.h
@@ -1176,6 +1176,7 @@ extern const char *pager_program;
extern int pager_in_use(void);
extern int pager_use_color;
extern int term_columns(void);
+extern int decimal_width(int number);
extern const char *editor_program;
extern const char *askpass_program;
--git a/pager.c b/pager.c
index b8049a4..b6d44ef 100644
--- a/pager.c
+++ b/pager.c
@@ -155,3 +155,15 @@ int term_columns(void)
term_columns_cache = 80;
return term_columns_cache;
}
+
+/*
+ * How many columns do we need to show numbers in decimal?
+ */
+int decimal_width(int number)
+{
+ int i, width;
+
+ for (width = 1, i = 10; i <= number; width++)
+ i *= 10;
+ return width;
+}
--
1.7.9.3.g2429d.dirty
^ permalink raw reply related
* [PATCH 1/2] Save terminal width before setting up pager and export term_columns()
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:12 UTC (permalink / raw)
To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek
In-Reply-To: <7vsjigl79j.fsf@alter.siamese.dyndns.org>
term_columns() checks for terminal width via ioctl(2). After
redirecting, stdin is no longer terminal to get terminal width.
Check terminal width and save it before redirecting stdin in
setup_pager() by calling term_columns().
Move term_columns() to pager.c and export it in cache.h.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
cache.h | 1 +
help.c | 22 -------------------
| 45 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 22 deletions(-)
This replaces cb0850f (Save terminal width before setting up pager -
2012-02-04) from Nguyễn Thái Ngọc Duy and my previous patch to export
term_columns().
This is directly on top of v1.7.9 as requested.
I removed Signed-off-by from Nguyễn and Junio because the patch is
substantially changed.
diff --git a/cache.h b/cache.h
index 10afd71..2f30b3a 100644
--- a/cache.h
+++ b/cache.h
@@ -1175,6 +1175,7 @@ extern void setup_pager(void);
extern const char *pager_program;
extern int pager_in_use(void);
extern int pager_use_color;
+extern int term_columns(void);
extern const char *editor_program;
extern const char *askpass_program;
diff --git a/help.c b/help.c
index cbbe966..14eefc9 100644
--- a/help.c
+++ b/help.c
@@ -5,28 +5,6 @@
#include "help.h"
#include "common-cmds.h"
-/* most GUI terminals set COLUMNS (although some don't export it) */
-static int term_columns(void)
-{
- char *col_string = getenv("COLUMNS");
- int n_cols;
-
- if (col_string && (n_cols = atoi(col_string)) > 0)
- return n_cols;
-
-#ifdef TIOCGWINSZ
- {
- struct winsize ws;
- if (!ioctl(1, TIOCGWINSZ, &ws)) {
- if (ws.ws_col)
- return ws.ws_col;
- }
- }
-#endif
-
- return 80;
-}
-
void add_cmdname(struct cmdnames *cmds, const char *name, int len)
{
struct cmdname *ent = xmalloc(sizeof(*ent) + len + 1);
--git a/pager.c b/pager.c
index 975955b..b8049a4 100644
--- a/pager.c
+++ b/pager.c
@@ -76,6 +76,10 @@ void setup_pager(void)
if (!pager)
return;
+ /* prime the term_columns() cache before it is too
+ * late and stdout is replaced */
+ (void) term_columns();
+
setenv("GIT_PAGER_IN_USE", "true", 1);
/* spawn the pager */
@@ -110,3 +114,44 @@ int pager_in_use(void)
env = getenv("GIT_PAGER_IN_USE");
return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
}
+
+/*
+ * Return cached value (if set) or $COLUMNS (if set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ * This behaviour conforms to The Single UNIX Specification, Version 2
+ * (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).
+ */
+int term_columns(void)
+{
+ static int term_columns_cache;
+
+ char *col_string;
+ int n_cols;
+
+ if (term_columns_cache)
+ return term_columns_cache;
+
+ col_string = getenv("COLUMNS");
+ if (col_string && (n_cols = atoi(col_string)) > 0) {
+ term_columns_cache = n_cols;
+ return term_columns_cache;
+ }
+
+#ifdef TIOCGWINSZ
+ {
+ struct winsize ws;
+ if (!ioctl(1, TIOCGWINSZ, &ws)) {
+ if (ws.ws_col) {
+ term_columns_cache = ws.ws_col;
+ return term_columns_cache;
+ }
+ }
+ }
+#endif
+
+ term_columns_cache = 80;
+ return term_columns_cache;
+}
--
1.7.9.3.g2429d.dirty
^ permalink raw reply related
* [PATCH/RFC] Auto detection in Makefile if msgfmt is not available
From: Torsten Bögershausen @ 2012-02-12 12:42 UTC (permalink / raw)
To: avarab, git; +Cc: tboegi
Since commit 5e9637c629702e3d41ad01d95956d1835d7338e0
"i18n: add infrastructure for translating Git with gettext"
the Makefile demands the existance of msgfmt, unless NO_GETTEXT is defined.
This breaks the build on systems where msgfmt is not installed.
Added a simple auto-detection and switch to NO_GETTEXT when
msgfmt could not be found on the system
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Makefile | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 87fb30a..23e1e77 100644
--- a/Makefile
+++ b/Makefile
@@ -353,7 +353,11 @@ RPMBUILD = rpmbuild
TCL_PATH = tclsh
TCLTK_PATH = wish
XGETTEXT = xgettext
-MSGFMT = msgfmt
+ifeq ($(shell msgfmt --help 2>/dev/null && echo y),y)
+ MSGFMT = msgfmt
+else
+ NO_GETTEXT=UnfortunatelyYes
+endif
PTHREAD_LIBS = -lpthread
PTHREAD_CFLAGS =
GCOV = gcov
--
1.7.8.3.1.g75d1cf.dirty
^ permalink raw reply related
* Re: [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}
From: 徐迪 @ 2012-02-12 12:25 UTC (permalink / raw)
To: Git 邮件列表
In-Reply-To: <CAMocUqRutwERQ64a=9t36Za6Lm8KxpseS0NYbdGKWbixbsXeyw@mail.gmail.com>
Shouldn't I supposed to receive any information about this patch? Has
it accepted or not? If not what wrong with this patch?
在 2012年2月11日 下午5:50,徐迪 <xudifsd@gmail.com> 写道:
> strbuf_readline_fd() existed in bundle.c since e9ee84cf, but this
> function can be used elsewhere, and since it's relevant to strbuf, it
> should be in strbuf.{c,h}.
>
> Signed-off-by: Xu Di <xudifsd@gmail.com>
> ---
> bundle.c | 18 +-----------------
> strbuf.c | 16 ++++++++++++++++
> strbuf.h | 1 +
> 3 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/bundle.c b/bundle.c
> index b8acf3c..9344a91 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -7,6 +7,7 @@
> #include "list-objects.h"
> #include "run-command.h"
> #include "refs.h"
> +#include "strbuf.h"
>
> static const char bundle_signature[] = "# v2 git bundle\n";
>
> @@ -23,23 +24,6 @@ static void add_to_ref_list(const unsigned char
> *sha1, const char *name,
> list->nr++;
> }
>
> -/* Eventually this should go to strbuf.[ch] */
> -static int strbuf_readline_fd(struct strbuf *sb, int fd)
> -{
> - strbuf_reset(sb);
> -
> - while (1) {
> - char ch;
> - ssize_t len = xread(fd, &ch, 1);
> - if (len <= 0)
> - return len;
> - strbuf_addch(sb, ch);
> - if (ch == '\n')
> - break;
> - }
> - return 0;
> -}
> -
> static int parse_bundle_header(int fd, struct bundle_header *header,
> const char *report_path)
> {
> diff --git a/strbuf.c b/strbuf.c
> index ff0b96b..7532a13 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -282,6 +282,22 @@ void strbuf_addbuf_percentquote(struct strbuf
> *dst, const struct strbuf *src)
> }
> }
>
> +int strbuf_readline_fd(struct strbuf *sb, int fd)
> +{
> + strbuf_reset(sb);
> +
> + while (1) {
> + char ch;
> + ssize_t len = xread(fd, &ch, 1);
> + if (len <= 0)
> + return len;
> + strbuf_addch(sb, ch);
> + if (ch == '\n')
> + break;
> + }
> + return 0;
> +}
> +
> size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
> {
> size_t res;
> diff --git a/strbuf.h b/strbuf.h
> index fbf059f..ecebd11 100644
> --- a/strbuf.h
> +++ b/strbuf.h
> @@ -109,6 +109,7 @@ static inline void strbuf_complete_line(struct strbuf *sb)
> }
>
> extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
> +extern int strbuf_readline_fd(struct strbuf *sb, int fd);
> /* XXX: if read fails, any partial read is undone */
> extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);
> extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);
> --
> 1.7.8.1.749.gb6b3b
^ permalink raw reply
* Re: [PATCH 6/8] gitweb: Highlight interesting parts of diff
From: Jakub Narebski @ 2012-02-12 10:42 UTC (permalink / raw)
To: Michał Kiedrowicz; +Cc: git
In-Reply-To: <m3y5s9rl3g.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> writes:
> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
> > +# Highlight characters from $prefix to $suffix and escape HTML.
> > +# $str is a reference to the array of characters.
> > +sub esc_html_mark_range {
> > + my ($str, $prefix, $suffix) = @_;
> > +
> > + # Don't generate empty <span> element.
> > + if ($prefix == $suffix + 1) {
> > + return esc_html(join('', @$str), -nbsp=>1);
> > + }
> > +
> > + my $before = join('', @{$str}[0..($prefix - 1)]);
> > + my $marked = join('', @{$str}[$prefix..$suffix]);
> > + my $after = join('', @{$str}[($suffix + 1)..$#{$str}]);
>
> Eeeeeek! First you split into letters, in caller at that, then join?
> Why not pass striung ($str suggests string not array of characters),
> and use substr instead?
>
> [Please disregard this and the next paragraph at first reading]
>
> > +
> > + return esc_html($before, -nbsp=>1) .
> > + $cgi->span({-class=>'marked'}, esc_html($marked, -nbsp=>1)) .
> > + esc_html($after,-nbsp=>1);
> > +}
>
> Anyway I have send to git mailing list a patch series, which in one of
> patches adds esc_html_match_hl($str, $regexp) to highlight matches in
> a string. Your esc_html_mark_range(), after a generalization, could
> be used as underlying "engine".
>
> Something like this, perhaps (untested):
>
> # Highlight selected fragments of string, using given CSS class,
> # and escape HTML. It is assumed that fragments do not overlap.
> # Regions are passed as list of pairs (array references).
> sub esc_html_hl {
> my ($str, $css_class, @sel) = @_;
> return esc_html($str) unless @sel;
>
> my $out = '';
> my $pos = 0;
>
> for my $s (@sel) {
> $out .= esc_html(substr($str, $pos, $s->[0] - $pos))
> if ($s->[0] - $pos > 0);
> $out .= $cgi->span({-class => $css_class},
> esc_html(substr($str, $s->[0], $s->[1] - $s->[0])));
>
> $pos = $m->[1];
> }
> $out .= esc_html(substr($str, $pos))
> if ($pos < length($str));
>
> return $out;
> }
Actually we can accomodate both operating on string and operating on
array of characters in a single subroutine. Though it can be left for
later commit, anyway...
# Highlight selected fragments of string, using given CSS class,
# and escape HTML. It is assumed that fragments do not overlap.
# Regions are passed as list of pairs (array references).
sub esc_html_hl {
my ($sth, $css_class, @sel) = @_;
if (!@sel) {
if (ref($sth) eq "ARRAY") {
return esc_html(join('', @$sth), -nbsp=>1);
} else {
return esc_html($sth, -nbsp=>1);
}
if (ref($sth) eq "ARRAY") {
return esc_html_hl_gen($sth,
sub {
my ($arr, $from, $to) = @_;
return join('', @{$arr}[$from..$to]);
},
scalar @{$arr}, $css_class, @sel);
} else {
return esc_html_hl_gen($sth,
sub {
my ($str, $from, $to) = @_;
if ($to < 0) { $to += lenght($str); };
return substr($str, $from, $to - $from);
},
length($sth), $css_class, @sel);
}
}
# Highlight selected fragments of string or array of characters
# with given length, using provided $extr subroutine to extract
# fragment (substring)
sub esc_html_hl_gen {
my ($sth, $extr, $len, $css_class, @sel) = @_;
my $out = '';
my $pos = 0;
for my $s (@sel) {
$out .= esc_html($extr->($str, $pos, $s->[0]))
if ($s->[0] - $pos > 0);
$out .= $cgi->span({-class => $css_class},
esc_html($extr->($str, $s->[0], $s->[1])));
$pos = $s->[1];
}
$out .= esc_html($extr->($str, $pos, $len))
if ($pos < $len);
return $out;
}
Or maybe I have read "Higher-Order Perl" one time too many ;-))))
--
Jakub Narębski
^ permalink raw reply
* Re: 1.7.9, libcharset missing from EXTLIBS
From: Junio C Hamano @ 2012-02-12 10:30 UTC (permalink / raw)
To: Дилян Палаузов
Cc: git
In-Reply-To: <4F370DE5.70400@aegee.org>
Дилян Палаузов <dilyan.palauzov@aegee.org> writes:
> diff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in
> --- git-1.7.9.orig/config.mak.in 2012-01-27 20:51:04.000000000 +0000
> +++ git-1.7.9/config.mak.in 2012-02-12 00:52:41.457968080 +0000
> @@ -74,3 +74,4 @@
> NO_PTHREADS=@NO_PTHREADS@
> PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
> PTHREAD_LIBS=@PTHREAD_LIBS@
> +LINK_CHARSET=@LINK_CHARSET@
> diff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac
> --- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000
> +++ git-1.7.9/configure.ac 2012-02-12 00:44:29.222967868 +0000
> @@ -836,6 +836,18 @@
> [HAVE_LIBCHARSET_H=YesPlease],
> [HAVE_LIBCHARSET_H=])
> AC_SUBST(HAVE_LIBCHARSET_H)
> +# Define LINK_LIBCHARSET if libiconv does not export the
Because the use of configure is optional in our build infrastructure, I
wouldn't have objected if this comment were missing from configure.ac, but
the new variable *must* be described in Makefile (see the top 250 lines or
so of that file).
I also need to point out that LINK_LIBCHARSET does not sit very well with
the way how existing Makefile variables are named. Perhaps make the new
variable contain the necessary string ("-lcharset" in your case), and name
it CHARSET_LIB or something? By doing so, when we find a platform that
has the necessary locale_charset() not in libcharset.{a,so} but somewhere
else, e.g. libxyzzy.a, we can accomodate it with "CHARSET_LIB = -lxyzzy".
Thanks. Also as Ævar pointed out, please do not forget to sign off your
patch.
^ permalink raw reply
* Re: "git pull" doesn't know "--edit"
From: Junio C Hamano @ 2012-02-12 9:59 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <CA+55aFwLqvVyMipun4DM4CnbO97Dota3LCM2VPFfLq1LS5a4aQ@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> In the docs, the "GIT_MERGE_AUTOEDIT=no" thing is mentioned as the way
> to get the legacy behavior, which (at least to me) implies that
> setting it to "yes" gets the modern behavior.
Honestly, I didn't actually intend to accept any value other than "no" to
be set in that variable.
Also the variable's name was way suboptimal.
I didn't intend "Auto" to describe "Edit" (as in "is the editor spawned
AUTO-matically? yes/no"), but meant it to describe "Merge" (as in "When a
merge results in AUTO-committing, do we edit it? yes/no?").
> Maybe this is intentional, and not a bug? But it does seem a bit odd -
> the name is "AUTOEDIT", not "FORCEDEDIT".
A clean merge that tries to start an editor even when not interactive is
honoring the "yes" setting is understandable/explainable if you read the
misnamed variable as "When a merge results in AUTO-committing, do we edit
it? yes/no?"
But it of course does not mean that such a behaviour is useful. It is not
just "a bit odd", it is outright useless in a text terminal, especially
when you are redirecting the input from /dev/null ;-).
> Or maybe the thing could extend the notion of the current boolean to
> be a tri-state instead: in addition to the traditional true/yes/on and
> false/no/off have a "force" mode that is that "always force it on
> regardless".
Yeah, if we support any value other than "no", I think the trivalue
always/auto/never (aka yes/auto/no) would make the most sense.
> And maybe this is just a "nobody cares" situation - "Don't do that then".
I would have agreed with you 3 years ago, but these days I find the end
users are being much pickier than they used to be ;-).
^ permalink raw reply
* Re: [PATCH 2/3] help.c: make term_columns() cached and export it
From: Junio C Hamano @ 2012-02-12 9:40 UTC (permalink / raw)
To: Zbigniew Jędrzejewski-Szmek
Cc: Nguyen Thai Ngoc Duy, git, Michael J Gruber, Ramsay Jones
In-Reply-To: <4F3647B4.8090803@in.waw.pl>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:
> Junio suggested that "a new file, term.c or something, be a lot more
> suitable home for the function you will be reusing from diff and other
> parts of the system". Nevertheless, I think that adding two files (.c
> and .h) to hold one function isn't worth it. It can live in pager.c.
> Terminal size is logically connected to paging after all.
I do not have any objection to the above reasoning.
Given that Nguyen's columns topic hasn't been merged to 'next' and I
expect it will be re-rolled anyway, I would prefer a patch that does the
move from help.c to pager.c that is based directly on v1.7.9, on top of
which your work and the columns topic can both be built independently.
Thanks.
^ permalink raw reply
* Re: [PATCH] git-svn: Fix time zone in --localtime
From: Eric Wong @ 2012-02-12 8:15 UTC (permalink / raw)
To: Wei-Yin Chen (陳威尹); +Cc: git, Pete Harlan, gitster
In-Reply-To: <4EEEF199.4000404@gmail.com>
"\"Wei-Yin Chen (陳威尹)\"" <chen.weiyin@gmail.com> wrote:
> Use numerical form of time zone to replace alphabetic time zone
> abbreviation generated by "%Z". "%Z" is not portable and contain
> ambiguity for many areas. For example, CST could be "Central
> Standard Time" (GMT-0600) and "China Standard Time" (GMT+0800).
> Alphabetic time zone abbreviation is meant for human readability,
> not for specifying a time zone for machines.
>
> Failed case can be illustrated like this in linux shell:
> > echo $TZ
> Asia/Taipei
> > date +%Z
> CST
> > env TZ=`date +%Z` date
> Mon Dec 19 06:03:04 CST 2011
> > date
> Mon Dec 19 14:03:04 CST 2011
>
> Signed-off-by: Wei-Yin Chen (陳威尹) <chen.weiyin@gmail.com>
> ---
Hi, sorry for the late reply, this got lost in the shuffle.
This issue seems reasonable, but did you test this change at all?
> sub format_svn_date {
> - # some systmes don't handle or mishandle %z, so be creative.
> my $t = shift || time;
> - my $gm = timelocal(gmtime($t));
> - my $sign = qw( + + - )[ $t <=> $gm ];
> - my $gmoff = sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
> + my $gmoff = get_tz($t);
> return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
> }
I needed the following additional change to get things working:
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -6111,7 +6111,7 @@ sub run_pager {
sub format_svn_date {
my $t = shift || time;
- my $gmoff = get_tz($t);
+ my $gmoff = Git::SVN::get_tz($t);
return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
}
If there are no objections, I'll squash this and push for Junio
tomorrow.
^ permalink raw reply
* Re: [PATCH 1/2] git-svn.perl: perform deletions before anything else
From: Eric Wong @ 2012-02-12 7:03 UTC (permalink / raw)
To: Steven Walter; +Cc: gitster, git, Steven Walter
In-Reply-To: <1328820742-4795-2-git-send-email-stevenrwalter@gmail.com>
Steven Walter <stevenrwalter@gmail.com> wrote:
> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Thanks, shall I fixup 2/2 and assume you meant to Sign-off on that, too?
^ permalink raw reply
* Re: [PATCH v2 1/2] git-svn: remove redundant porcelain option to rev-list
From: Eric Wong @ 2012-02-12 6:49 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git, Jonathan Nieder
In-Reply-To: <1329006186-21346-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> Change an invocation of git-rev-list(1) to not use --no-color,
> git-rev-list(1) will always ignore that option and the --color option,
> so there's no need to pass it.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Thanks, will push this series.
^ permalink raw reply
* Re: [PATCH] column: Fix an incorrect parse of the 'nodense' option token
From: Nguyen Thai Ngoc Duy @ 2012-02-12 3:37 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
In-Reply-To: <4F36B64D.4030000@ramsay1.demon.co.uk>
On Sun, Feb 12, 2012 at 1:41 AM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
>
> The parse_option() function always saw the 'nodense' token as
> 'dense', since it stripped the 'no' off the input argument string
> earlier when checking for the presence of the 'color' token.
>
> In order to fix the parse, we use local variables (within the loop)
> initialised to the function input arguments instead, which allows
> each token check to be independent.
>
> Also, add some 'nodense' tests to t/t9002-column.sh.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
> Note that the code supports the 'nocolor' token, but it is not documented
> in config.txt.
>
> If I understand correctly (and it's quite possible that I don't!), the
> 'nodense' token has the same meaning as the absence of the 'dense' token
> (and I assume a similar comment applies to the '[no]color' tokens). If that
> is the case, then maybe a better solution would be to simply remove the
> 'nodense' and 'nocolor' tokens. I will leave it to you to decide which
> solution is more appropriate.
It's about overriding config. If you set "dense" by default in
column.ui but do not want it in this particular run, you can say
--column=nodense.
The [no]color is for plumbing only. If a command produces colored
output, "color" is required to calculate text length correctly.
Overriding it with "nocolor" would break the layout badly so it's no
use there. It does not make sense (to me) for users to put "color" in
column.ui. Which is why it's not mentioned in document.
--
Duy
^ permalink raw reply
* [PATCH] t: use sane_unset instead of unset
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 1:05 UTC (permalink / raw)
To: git; +Cc: Ævar Arnfjörð Bjarmason
Change several tests to use the sane_unset function introduced in
v1.7.3.1-35-g00648ba instead of the built-in unset function.
This fixes a failure I was having on t9130-git-svn-authors-file.sh on
Solaris, and prevents several other issues from occurring.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
t/t4150-am.sh | 2 +-
t/t5560-http-backend-noserver.sh | 6 +++---
t/t6032-merge-large-rename.sh | 2 +-
t/t9130-git-svn-authors-file.sh | 4 ++--
t/t9200-git-cvsexportcommit.sh | 2 +-
t/t9808-git-p4-chdir.sh | 4 ++--
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 8807b60..f1b60b8 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -136,7 +136,7 @@ test_expect_success setup '
git format-patch -M --stdout lorem^ >rename-add.patch &&
# reset time
- unset test_tick &&
+ sane_unset test_tick &&
test_tick
'
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
index 0ad7ce0..ef98d95 100755
--- a/t/t5560-http-backend-noserver.sh
+++ b/t/t5560-http-backend-noserver.sh
@@ -17,7 +17,7 @@ run_backend() {
GET() {
REQUEST_METHOD="GET" && export REQUEST_METHOD &&
run_backend "/repo.git/$1" &&
- unset REQUEST_METHOD &&
+ sane_unset REQUEST_METHOD &&
if ! grep "Status" act.out >act
then
printf "Status: 200 OK\r\n" >act
@@ -30,8 +30,8 @@ POST() {
REQUEST_METHOD="POST" && export REQUEST_METHOD &&
CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE &&
run_backend "/repo.git/$1" "$2" &&
- unset REQUEST_METHOD &&
- unset CONTENT_TYPE &&
+ sane_unset REQUEST_METHOD &&
+ sane_unset CONTENT_TYPE &&
if ! grep "Status" act.out >act
then
printf "Status: 200 OK\r\n" >act
diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh
index fdb6c25..94f010b 100755
--- a/t/t6032-merge-large-rename.sh
+++ b/t/t6032-merge-large-rename.sh
@@ -95,7 +95,7 @@ test_expect_success 'setup large simple rename' '
'
test_expect_success 'massive simple rename does not spam added files' '
- unset GIT_MERGE_VERBOSITY &&
+ sane_unset GIT_MERGE_VERBOSITY &&
git merge --no-stat simple-rename | grep -v Removing >output &&
test 5 -gt "$(wc -l < output)"
'
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index b324c49..c3443ce 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -96,8 +96,8 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
rm -r "$GIT_DIR" &&
test x = x"$(git config svn.authorsfile)" &&
test_config="$HOME"/.gitconfig &&
- unset GIT_DIR &&
- unset GIT_CONFIG &&
+ sane_unset GIT_DIR &&
+ sane_unset GIT_CONFIG &&
git config --global \
svn.authorsfile "$HOME"/svn-authors &&
test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 518358a..b59be9a 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -321,7 +321,7 @@ test_expect_success 'use the same checkout for Git and CVS' '
(mkdir shared &&
cd shared &&
- unset GIT_DIR &&
+ sane_unset GIT_DIR &&
cvs co . &&
git init &&
git add " space" &&
diff --git a/t/t9808-git-p4-chdir.sh b/t/t9808-git-p4-chdir.sh
index eb8cc95..f002283 100755
--- a/t/t9808-git-p4-chdir.sh
+++ b/t/t9808-git-p4-chdir.sh
@@ -25,7 +25,7 @@ test_expect_success 'P4CONFIG and absolute dir clone' '
test_when_finished cleanup_git &&
(
P4CONFIG=p4config && export P4CONFIG &&
- unset P4PORT P4CLIENT &&
+ sane_unset P4PORT P4CLIENT &&
"$GITP4" clone --verbose --dest="$git" //depot
)
'
@@ -37,7 +37,7 @@ test_expect_success 'P4CONFIG and relative dir clone' '
test_when_finished cleanup_git &&
(
P4CONFIG=p4config && export P4CONFIG &&
- unset P4PORT P4CLIENT &&
+ sane_unset P4PORT P4CLIENT &&
"$GITP4" clone --verbose --dest="git" //depot
)
'
--
1.7.9
^ permalink raw reply related
* Re: 1.7.9, libcharset missing from EXTLIBS
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 1:03 UTC (permalink / raw)
To: Дилян Палаузов
Cc: git
In-Reply-To: <4F370DE5.70400@aegee.org>
2012/2/12 Дилян Палаузов <dilyan.palauzov@aegee.org>:
This looks good to me, could you please re-submit it as described in
Documentation/SubmittingPatches? I.e. with a signed-off-by etc.
^ permalink raw reply
* Re: 1.7.9, libcharset missing from EXTLIBS
From: Дилян Палаузов @ 2012-02-12 0:55 UTC (permalink / raw)
To: git
In-Reply-To: <7vd39mph9x.fsf@alter.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 2983 bytes --]
Hello,
please consider the patch below as fix for the problem. It checks if
locale_charset is not in libiconv, but in libcharset and in this case
appends -lcharset to EXTLIBS.
Със здраве
Дилян
diff -u git-1.7.9.orig/config.mak.in git-1.7.9/config.mak.in
--- git-1.7.9.orig/config.mak.in 2012-01-27 20:51:04.000000000 +0000
+++ git-1.7.9/config.mak.in 2012-02-12 00:52:41.457968080 +0000
@@ -74,3 +74,4 @@
NO_PTHREADS=@NO_PTHREADS@
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
PTHREAD_LIBS=@PTHREAD_LIBS@
+LINK_CHARSET=@LINK_CHARSET@
diff -u git-1.7.9.orig/configure.ac git-1.7.9/configure.ac
--- git-1.7.9.orig/configure.ac 2012-01-27 20:51:04.000000000 +0000
+++ git-1.7.9/configure.ac 2012-02-12 00:44:29.222967868 +0000
@@ -836,6 +836,18 @@
[HAVE_LIBCHARSET_H=YesPlease],
[HAVE_LIBCHARSET_H=])
AC_SUBST(HAVE_LIBCHARSET_H)
+# Define LINK_LIBCHARSET if libiconv does not export the locale_charset
symbol
+# and liblibcharset does
+LINK_CHARSET=
+AC_CHECK_LIB([iconv], [locale_charset],
+ [],
+ [AC_CHECK_LIB([charset], [locale_charset],
+ [LINK_CHARSET=Yes])
+ ]
+)
+AC_SUBST(LINK_CHARSET)
+
+
#
# Define NO_STRCASESTR if you don't have strcasestr.
GIT_CHECK_FUNC(strcasestr,
diff -u git-1.7.9.orig/Makefile git-1.7.9/Makefile
--- git-1.7.9.orig/Makefile 2012-01-27 20:51:04.000000000 +0000
+++ git-1.7.9/Makefile 2012-02-12 00:35:23.982967555 +0000
@@ -1692,6 +1692,9 @@
ifdef HAVE_LIBCHARSET_H
BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
+ifdef LINK_CHARSET
+ EXTLIBS += -lcharset
+endif
endif
ifdef HAVE_DEV_TTY
On 10.02.2012 21:25, Junio C Hamano wrote:
> Junio C Hamano<gitster@pobox.com> writes:
>
>> Дилян Палаузов<dilyan.palauzov@aegee.org> writes:
>>
>>>>> What I am wondering is there are systems that need to include the header,
>>>>> but locale_charset() does not live in /lib/libcharset.a, in which case we
>>>>> cannot make HAVE_LIBCHARSET_H imply use of -lcharset.
>>>
>>> I do not understand this. If you want to use a function from
>>> libcharset, you have to use both #include<libcharset.h> and
>>> -lcharset.
>>
>> You are mistaken.
>>
>> The only constraint is that you have to "#include<libcharset.h>" and need
>> to link with the library that has locale_charset() defined.
>
> I think the follow-ups in this thread already demonstrated why it is an
> insufficient solution to make HAVE_LIBCHARSET_H imply -lcharset.
>
> We would instead need:
>
> ifeq ($(uname_S),MyHomeBrewLinux)
> HAVE_LIBCHARSET_H = YesPlease
> EXTLIBS += -lcharset
> endif
>
> or
>
> # Define NEEDS_CHARSETLIB if you use HAVE_LIBCHARSET_H and
> # need to link with -lcharset
> NEEDS_CHARSETLIB =
>
> ifeq ($(uname_S),MyHomeBrewLinux)
> HAVE_LIBCHARSET_H = YesPlease
> NEEDS_CHARSETLIB = YesPlease
> endif
>
> ifdef NEEDS_CHARSETLIB
> EXTLIBS += -lcharset
> endif
>
> or something like that, I guess.
>
[-- Attachment #2: dilyan_palauzov.vcf --]
[-- Type: text/x-vcard, Size: 381 bytes --]
begin:vcard
fn;quoted-printable:=D0=94=D0=B8=D0=BB=D1=8F=D0=BD =D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=
=D0=B2
n;quoted-printable;quoted-printable:=D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=D0=B2;=D0=94=D0=B8=D0=BB=D1=8F=D0=BD
email;internet:dilyan.palauzov@aegee.org
tel;home:+49-721-94193270
tel;cell:+49-162-4091172
note:sip:8372@aegee.org
version:2.1
end:vcard
^ permalink raw reply
* Re: [PATCH 12/10] support pager.* for external commands
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 0:46 UTC (permalink / raw)
To: Jeff King; +Cc: git, Junio C Hamano, Steffen Daode Nurpmeso, Ingo Brückl
In-Reply-To: <20110818220132.GB7799@sigill.intra.peff.net>
On Fri, Aug 19, 2011 at 00:01, Jeff King <peff@peff.net> wrote:
> +test_expect_success TTY 'command-specific pager works for external commands' '
> + sane_unset PAGER GIT_PAGER &&
> + echo "foo:initial" >expect &&
> + >actual &&
> + test_config pager.external "sed s/^/foo:/ >actual" &&
> + test_terminal git --exec-path="`pwd`" external log --format=%s -1 &&
> + test_cmp expect actual
For reasons that I haven't looked into using sed like that breaks
under /usr/bin/ksh on Solaris. Just using:
sed -e \"s/^/foo:/\"
Instead fixes it, it's not broken with /usr/xpg4/bin/sh, so it's some
ksh peculiarity.
The error it gives is:
sed s/^/foo:/ >actual: Not found
Indicating that for some reason it's considering that whole "sed
s/^/foo:/ >actual" string to be a single command.
^ permalink raw reply
* Re: [PATCH v2 2/2] git-svn: un-break "git svn rebase" when log.abbrevCommit=true
From: Jonathan Nieder @ 2012-02-12 0:31 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git, Eric Wong, Junio C Hamano
In-Reply-To: <1329006186-21346-2-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> Change git-svn to use git-rev-list(1) instead of git-log(1) since the
> latter is porcelain that'll cause "git svn rebase" to fail completely
> if log.abbrevCommit is set to true in the configuration.
[...]
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1878,8 +1878,7 @@ sub cmt_sha2rev_batch {
>
> sub working_head_info {
> my ($head, $refs) = @_;
> - my @args = qw/log --no-color --no-decorate --first-parent
> - --pretty=medium/;
> + my @args = qw/rev-list --first-parent --pretty=medium/;
Thanks! The other caller to "git log" in this script uses
--pretty=raw and should be safe.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
^ permalink raw reply
* [PATCH v2 2/2] git-svn: un-break "git svn rebase" when log.abbrevCommit=true
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 0:23 UTC (permalink / raw)
To: git; +Cc: Eric Wong, Jonathan Nieder,
Ævar Arnfjörð Bjarmason
In-Reply-To: <1329006186-21346-1-git-send-email-avarab@gmail.com>
Change git-svn to use git-rev-list(1) instead of git-log(1) since the
latter is porcelain that'll cause "git svn rebase" to fail completely
if log.abbrevCommit is set to true in the configuration.
Without this patch the code will fail to parse a SHA1, and then just
spew a bunch of "Use of uninitialized value $hash in string eq"
warnings at "if ($c && $c eq $hash) { ..." and never do anything
useful.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
---
git-svn.perl | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 712eeeb..bebe38b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1878,8 +1878,7 @@ sub cmt_sha2rev_batch {
sub working_head_info {
my ($head, $refs) = @_;
- my @args = qw/log --no-color --no-decorate --first-parent
- --pretty=medium/;
+ my @args = qw/rev-list --first-parent --pretty=medium/;
my ($fh, $ctx) = command_output_pipe(@args, $head);
my $hash;
my %max;
--
1.7.9
^ permalink raw reply related
* [PATCH v2 1/2] git-svn: remove redundant porcelain option to rev-list
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 0:23 UTC (permalink / raw)
To: git; +Cc: Eric Wong, Jonathan Nieder,
Ævar Arnfjörð Bjarmason
In-Reply-To: <CACBZZX5cwZ4Xz3-C8B3v4eEmyO0B-JiohfRATu1UhxzST0ar5w@mail.gmail.com>
Change an invocation of git-rev-list(1) to not use --no-color,
git-rev-list(1) will always ignore that option and the --color option,
so there's no need to pass it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
git-svn.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index eeb83d3..712eeeb 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3920,7 +3920,7 @@ sub rebuild {
my ($base_rev, $head) = ($partial ? $self->rev_map_max_norebuild(1) :
(undef, undef));
my ($log, $ctx) =
- command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/,
+ command_output_pipe(qw/rev-list --pretty=raw --reverse/,
($head ? "$head.." : "") . $self->refname,
'--');
my $metadata_url = $self->metadata_url;
--
1.7.9
^ permalink raw reply related
* Re: [PATCH 7/8] gitweb: Use different colors to present marked changes
From: Jakub Narebski @ 2012-02-12 0:11 UTC (permalink / raw)
To: Michał Kiedrowicz; +Cc: git
In-Reply-To: <1328865494-24415-8-git-send-email-michal.kiedrowicz@gmail.com>
Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
> This makes use of the highlight diff feature.
>
> Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> ---
> I decided to split mechanism (generate HTML page with <span> elements that
> mark interesting fragments of diff output) from politics (use these
> particular colors for this <span> elements), but otherwise this commit
> may be squashed with the previous one. These colors work for me but if
> someone comes out with better ones, I'd be happy.
I think it would be better squashed with previous patch, otherwise it
is a bit not visible change...
> gitweb/static/gitweb.css | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
> index c7827e8..4f87d16 100644
> --- a/gitweb/static/gitweb.css
> +++ b/gitweb/static/gitweb.css
> @@ -438,6 +438,10 @@ div.diff.add {
> color: #008800;
> }
>
> +div.diff.add span.marked {
> + background-color: #77ff77;
> +}
> +
> div.diff.from_file a.path,
> div.diff.from_file {
> color: #aa0000;
> @@ -447,6 +451,10 @@ div.diff.rem {
> color: #cc0000;
> }
>
> +div.diff.rem span.marked {
> + background-color: #ff7777;
> +}
> +
> div.diff.chunk_header a,
> div.diff.chunk_header {
> color: #990099;
> --
I'd have to see those colors in use. BTW what colors other
highlighting diff GUIs use?
--
Jakub Narębski
^ permalink raw reply
* Re: [PATCH] Remove Git's support for smoke testing
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 0:09 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason
In-Reply-To: <1324660098-26666-1-git-send-email-avarab@gmail.com>
On Fri, Dec 23, 2011 at 18:08, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> I'm no longer running the Git smoke testing service at
> smoke.git.nix.is due to Smolder being a fragile piece of software not
> having time to follow through on making it easy for third parties to
> run and submit their own smoke tests.
Junio, could you please apply this? The current release's t/README
file is pointing to a service I'm not running anymore.
^ permalink raw reply
* Re: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"
From: Ævar Arnfjörð Bjarmason @ 2012-02-12 0:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Linus Torvalds
In-Reply-To: <7vr4zyiyih.fsf@alter.siamese.dyndns.org>
On Wed, Dec 21, 2011 at 01:01, Junio C Hamano <gitster@pobox.com> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> However unlike Linux Git is written in ANSI C and supports a multitude
>> of compilers, including Clang, Sun Studio, xlc etc. On my Linux box
>> "cc" is a symlink to clang, and on a Solaris box I have access to "cc"
>> is Sun Studio's CC.
>>
>> Both of these are perfectly capable of compiling Git, and it's
>> annoying to have to specify CC=cc on the command-line when compiling
>> Git when that's the default behavior of most other portable programs.
>
> Would this affect folks in BSD land negatively?
I see my mail back it December didn't include a reply to that for some
reason.
Anyway like Linus said probably not, also the BSD's I use have cc as a
symlink to whatever the default compiler is, which is usually gcc.
I've recently been hacking git on Solaris again and keep getting bit
by this, I'd like to propose it for inclusion again, the patch still
applies.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox