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::
Controls which merge resolution program is used by
gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
"meld", "xxdiff", "emerge", "vimdiff"
"meld", "xxdiff", "emerge", "vimdiff", and "opendiff"
merge.verbosity::
Controls the amount of output shown by the recursive merge

View file

@ -25,7 +25,7 @@ OPTIONS
-t or --tool=<tool>::
Use the merge resolution program specified by <tool>.
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'
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;
}
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)
{
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;
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) {
e = locate_size_cache(s->sha1, 1, 0);
if (e) {
s->size = e->size;
return 0;
}
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);
}
else {

View file

@ -197,6 +197,19 @@ static inline void *xmalloc(size_t size)
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)
{
void *ret = realloc(ptr, size);

View file

@ -564,12 +564,6 @@ sub validate_refname {
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
# correct, but quoted slashes look too horrible in bookmarks
sub esc_param {
@ -594,7 +588,7 @@ ($;%)
my $str = shift;
my %opts = @_;
$str = to_utf8($str);
$str = decode_utf8($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g;
@ -608,7 +602,7 @@ sub esc_path {
my $str = shift;
my %opts = @_;
$str = to_utf8($str);
$str = decode_utf8($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g;
@ -891,7 +885,7 @@ sub format_subject_html {
if (length($short) < length($long)) {
return $cgi->a({-href => $href, -class => "list subject",
-title => to_utf8($long)},
-title => decode_utf8($long)},
esc_html($short) . $extra);
} else {
return $cgi->a({-href => $href, -class => "list subject"},
@ -1126,7 +1120,7 @@ sub git_get_projects_list {
if (check_export_ok("$projectroot/$path")) {
my $pr = {
path => $path,
owner => to_utf8($owner),
owner => decode_utf8($owner),
};
push @list, $pr;
(my $forks_path = $path) =~ s/\.git$//;
@ -1156,7 +1150,7 @@ sub git_get_project_owner {
$pr = unescape($pr);
$ow = unescape($ow);
if ($pr eq $project) {
$owner = to_utf8($ow);
$owner = decode_utf8($ow);
last;
}
}
@ -1630,7 +1624,7 @@ sub get_file_owner {
}
my $owner = $gcos;
$owner =~ s/[,;].*$//;
return to_utf8($owner);
return decode_utf8($owner);
}
## ......................................................................
@ -1713,7 +1707,7 @@ sub git_header_html {
my $title = "$site_name";
if (defined $project) {
$title .= " - " . to_utf8($project);
$title .= " - " . decode_utf8($project);
if (defined $action) {
$title .= "/$action";
if (defined $file_name) {
@ -1986,7 +1980,7 @@ sub git_print_page_path {
print "<div class=\"page_path\">";
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
-title => 'tree root'}, to_utf8("[$project]"));
-title => 'tree root'}, decode_utf8("[$project]"));
print " / ";
if (defined $name) {
my @dirname = split '/', $name;
@ -2604,7 +2598,7 @@ sub git_project_list_body {
($pr->{'age'}, $pr->{'age_string'}) = @aa;
if (!defined $pr->{'descr'}) {
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);
}
if (!defined $pr->{'owner'}) {
@ -3636,7 +3630,7 @@ sub git_snapshot {
$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(
-type => "application/$ctype",

2
http.h
View file

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

View file

@ -33,7 +33,7 @@ $(makfile): ../GIT-CFLAGS Makefile
echo ' echo $(instdir_SQ)' >> $@
else
$(makfile): Makefile.PL ../GIT-CFLAGS
'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
$(PERL_PATH) $< PREFIX='$(prefix_SQ)'
endif
# 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'
sha1=$(sed -e 's/\t.*//' .git/rr-cache/MERGE_RR)
sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR)
rr=.git/rr-cache/$sha1
test_expect_success 'recorded preimage' "grep ======= $rr/preimage"