Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Junio C Hamano committed May 4, 2007
2 parents 50acc58 + e3ad95a commit 9aae177
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-mergetool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 7 additions & 6 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 13 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 10 additions & 16 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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$//;
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -1630,7 +1624,7 @@ sub get_file_owner {
}
my $owner = $gcos;
$owner =~ s/[,;].*$//;
return to_utf8($owner);
return decode_utf8($owner);
}

## ......................................................................
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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'}) {
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion http.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion perl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion t/t4200-rerere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 9aae177

Please sign in to comment.