Merge branch 'maint'

* maint:
  gitweb: use decode_utf8 directly
  posix compatibility for t4200
  Document 'opendiff' value in config.txt and git-mergetool.txt
  Allow PERL_PATH="/usr/bin/env perl"
  Make xstrndup common
  diff.c: fix "size cache" handling.
  http-fetch: Disable use of curl multi support for libcurl < 7.16.
This commit is contained in:
Junio C Hamano 2007-05-03 23:26:54 -07:00
commit 9aae177a4a
9 changed files with 35 additions and 35 deletions

View file

@ -520,7 +520,7 @@ merge.summary::
merge.tool:: merge.tool::
Controls which merge resolution program is used by Controls which merge resolution program is used by
gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff", gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
"meld", "xxdiff", "emerge", "vimdiff" "meld", "xxdiff", "emerge", "vimdiff", and "opendiff"
merge.verbosity:: merge.verbosity::
Controls the amount of output shown by the recursive merge Controls the amount of output shown by the recursive merge

View file

@ -25,7 +25,7 @@ OPTIONS
-t or --tool=<tool>:: -t or --tool=<tool>::
Use the merge resolution program specified by <tool>. Use the merge resolution program specified by <tool>.
Valid merge tools are: Valid merge tools are:
kdiff3, tkdiff, meld, xxdiff, emerge, and vimdiff. kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, and opendiff
+ +
If a merge resolution program is not specified, 'git mergetool' If a merge resolution program is not specified, 'git mergetool'
will use the configuration variable merge.tool. If the will use the configuration variable merge.tool. If the

View file

@ -718,14 +718,6 @@ static char *logmsg_reencode(const struct commit *commit,
return out; return out;
} }
static char *xstrndup(const char *text, int len)
{
char *result = xmalloc(len + 1);
memcpy(result, text, len);
result[len] = '\0';
return result;
}
static void fill_person(struct interp *table, const char *msg, int len) static void fill_person(struct interp *table, const char *msg, int len)
{ {
int start, end, tz = 0; int start, end, tz = 0;

13
diff.c
View file

@ -1572,14 +1572,15 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
enum object_type type; enum object_type type;
struct sha1_size_cache *e; struct sha1_size_cache *e;
if (size_only && use_size_cache &&
(e = locate_size_cache(s->sha1, 1, 0)) != NULL) {
s->size = e->size;
return 0;
}
if (size_only) { if (size_only) {
e = locate_size_cache(s->sha1, 1, 0);
if (e) {
s->size = e->size;
return 0;
}
type = sha1_object_info(s->sha1, &s->size); type = sha1_object_info(s->sha1, &s->size);
if (type < 0) if (use_size_cache && 0 < type)
locate_size_cache(s->sha1, 0, s->size); locate_size_cache(s->sha1, 0, s->size);
} }
else { else {

View file

@ -197,6 +197,19 @@ static inline void *xmalloc(size_t size)
return ret; return ret;
} }
static inline char *xstrndup(const char *str, size_t len)
{
char *p;
p = memchr(str, '\0', len);
if (p)
len = p - str;
p = xmalloc(len + 1);
memcpy(p, str, len);
p[len] = '\0';
return p;
}
static inline void *xrealloc(void *ptr, size_t size) static inline void *xrealloc(void *ptr, size_t size)
{ {
void *ret = realloc(ptr, size); void *ret = realloc(ptr, size);

View file

@ -564,12 +564,6 @@ sub validate_refname {
return $input; return $input;
} }
# very thin wrapper for decode("utf8", $str, Encode::FB_DEFAULT);
sub to_utf8 {
my $str = shift;
return decode("utf8", $str, Encode::FB_DEFAULT);
}
# quote unsafe chars, but keep the slash, even when it's not # quote unsafe chars, but keep the slash, even when it's not
# correct, but quoted slashes look too horrible in bookmarks # correct, but quoted slashes look too horrible in bookmarks
sub esc_param { sub esc_param {
@ -594,7 +588,7 @@ ($;%)
my $str = shift; my $str = shift;
my %opts = @_; my %opts = @_;
$str = to_utf8($str); $str = decode_utf8($str);
$str = $cgi->escapeHTML($str); $str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) { if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g; $str =~ s/ /&nbsp;/g;
@ -608,7 +602,7 @@ sub esc_path {
my $str = shift; my $str = shift;
my %opts = @_; my %opts = @_;
$str = to_utf8($str); $str = decode_utf8($str);
$str = $cgi->escapeHTML($str); $str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) { if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g; $str =~ s/ /&nbsp;/g;
@ -891,7 +885,7 @@ sub format_subject_html {
if (length($short) < length($long)) { if (length($short) < length($long)) {
return $cgi->a({-href => $href, -class => "list subject", return $cgi->a({-href => $href, -class => "list subject",
-title => to_utf8($long)}, -title => decode_utf8($long)},
esc_html($short) . $extra); esc_html($short) . $extra);
} else { } else {
return $cgi->a({-href => $href, -class => "list subject"}, return $cgi->a({-href => $href, -class => "list subject"},
@ -1126,7 +1120,7 @@ sub git_get_projects_list {
if (check_export_ok("$projectroot/$path")) { if (check_export_ok("$projectroot/$path")) {
my $pr = { my $pr = {
path => $path, path => $path,
owner => to_utf8($owner), owner => decode_utf8($owner),
}; };
push @list, $pr; push @list, $pr;
(my $forks_path = $path) =~ s/\.git$//; (my $forks_path = $path) =~ s/\.git$//;
@ -1156,7 +1150,7 @@ sub git_get_project_owner {
$pr = unescape($pr); $pr = unescape($pr);
$ow = unescape($ow); $ow = unescape($ow);
if ($pr eq $project) { if ($pr eq $project) {
$owner = to_utf8($ow); $owner = decode_utf8($ow);
last; last;
} }
} }
@ -1630,7 +1624,7 @@ sub get_file_owner {
} }
my $owner = $gcos; my $owner = $gcos;
$owner =~ s/[,;].*$//; $owner =~ s/[,;].*$//;
return to_utf8($owner); return decode_utf8($owner);
} }
## ...................................................................... ## ......................................................................
@ -1713,7 +1707,7 @@ sub git_header_html {
my $title = "$site_name"; my $title = "$site_name";
if (defined $project) { if (defined $project) {
$title .= " - " . to_utf8($project); $title .= " - " . decode_utf8($project);
if (defined $action) { if (defined $action) {
$title .= "/$action"; $title .= "/$action";
if (defined $file_name) { if (defined $file_name) {
@ -1986,7 +1980,7 @@ sub git_print_page_path {
print "<div class=\"page_path\">"; print "<div class=\"page_path\">";
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb), print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
-title => 'tree root'}, to_utf8("[$project]")); -title => 'tree root'}, decode_utf8("[$project]"));
print " / "; print " / ";
if (defined $name) { if (defined $name) {
my @dirname = split '/', $name; my @dirname = split '/', $name;
@ -2604,7 +2598,7 @@ sub git_project_list_body {
($pr->{'age'}, $pr->{'age_string'}) = @aa; ($pr->{'age'}, $pr->{'age_string'}) = @aa;
if (!defined $pr->{'descr'}) { if (!defined $pr->{'descr'}) {
my $descr = git_get_project_description($pr->{'path'}) || ""; my $descr = git_get_project_description($pr->{'path'}) || "";
$pr->{'descr_long'} = to_utf8($descr); $pr->{'descr_long'} = decode_utf8($descr);
$pr->{'descr'} = chop_str($descr, 25, 5); $pr->{'descr'} = chop_str($descr, 25, 5);
} }
if (!defined $pr->{'owner'}) { if (!defined $pr->{'owner'}) {
@ -3636,7 +3630,7 @@ sub git_snapshot {
$hash = git_get_head_hash($project); $hash = git_get_head_hash($project);
} }
my $filename = to_utf8(basename($project)) . "-$hash.tar.$suffix"; my $filename = decode_utf8(basename($project)) . "-$hash.tar.$suffix";
print $cgi->header( print $cgi->header(
-type => "application/$ctype", -type => "application/$ctype",

2
http.h
View file

@ -6,7 +6,7 @@
#include <curl/curl.h> #include <curl/curl.h>
#include <curl/easy.h> #include <curl/easy.h>
#if LIBCURL_VERSION_NUM >= 0x070908 #if LIBCURL_VERSION_NUM >= 0x071000
#define USE_CURL_MULTI #define USE_CURL_MULTI
#define DEFAULT_MAX_REQUESTS 5 #define DEFAULT_MAX_REQUESTS 5
#endif #endif

View file

@ -33,7 +33,7 @@ $(makfile): ../GIT-CFLAGS Makefile
echo ' echo $(instdir_SQ)' >> $@ echo ' echo $(instdir_SQ)' >> $@
else else
$(makfile): Makefile.PL ../GIT-CFLAGS $(makfile): Makefile.PL ../GIT-CFLAGS
'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)' $(PERL_PATH) $< PREFIX='$(prefix_SQ)'
endif endif
# this is just added comfort for calling make directly in perl dir # this is just added comfort for calling make directly in perl dir

View file

@ -44,7 +44,7 @@ mkdir .git/rr-cache
test_expect_failure 'conflicting merge' 'git pull . first' test_expect_failure 'conflicting merge' 'git pull . first'
sha1=$(sed -e 's/\t.*//' .git/rr-cache/MERGE_RR) sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR)
rr=.git/rr-cache/$sha1 rr=.git/rr-cache/$sha1
test_expect_success 'recorded preimage' "grep ======= $rr/preimage" test_expect_success 'recorded preimage' "grep ======= $rr/preimage"