From 9cf04301b182c4c57d62ea63554d109db613f9d3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 2 May 2007 14:53:23 +0200 Subject: http-fetch: Disable use of curl multi support for libcurl < 7.16. curl_multi_remove_handle() is broken in libcurl < 7.16, in that it doesn't correctly update the active handles count when a request is aborted. This causes the transfer to hang forever waiting for the handle count to become less than the number of active requests. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano diff --git a/http.h b/http.h index 324fcf4..69b6b66 100644 --- a/http.h +++ b/http.h @@ -6,7 +6,7 @@ #include #include -#if LIBCURL_VERSION_NUM >= 0x070908 +#if LIBCURL_VERSION_NUM >= 0x071000 #define USE_CURL_MULTI #define DEFAULT_MAX_REQUESTS 5 #endif -- cgit v0.10.2-6-g49f6 From cdda666201710dcf50d7ebee804aac65fdec32fd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 May 2007 13:00:43 -0700 Subject: diff.c: fix "size cache" handling. We broke the size-cache handling when we changed the function signature of sha1_object_info() in 21666f1a. We obviously wanted to cache the size we obtained when sha1_object_info() succeeded, not when it failed. Signed-off-by: Junio C Hamano diff --git a/diff.c b/diff.c index d8f9242..b28933f 100644 --- a/diff.c +++ b/diff.c @@ -1468,14 +1468,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 { -- cgit v0.10.2-6-g49f6 From 5094102e13640d7559a02fd7c77b44dc9254cbbb Mon Sep 17 00:00:00 2001 From: Daniel Barkalow Date: Wed, 2 May 2007 22:49:41 -0400 Subject: Make xstrndup common This also improves the implementation to match how strndup is specified (by GNU): if the length given is longer than the string, only the string's length is allocated and copied, but the string need not be null-terminated if it is at least as long as the given length. Signed-off-by: Daniel Barkalow Signed-off-by: Junio C Hamano diff --git a/commit.c b/commit.c index 754d1b8..eb911f4 100644 --- a/commit.c +++ b/commit.c @@ -720,14 +720,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; diff --git a/git-compat-util.h b/git-compat-util.h index e3cf370..bd93b62 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -189,6 +189,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); -- cgit v0.10.2-6-g49f6 From 5318f69812b3a06326524852d965e6a79fa52f85 Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Thu, 3 May 2007 18:58:56 -0400 Subject: Allow PERL_PATH="/usr/bin/env perl" There is a mechanism PERL_PATH in the Makefile to specify path to Perl binary, but sometimes it is convenient to let 'env' figure out where Perl comes from, with PERL_PATH="/usr/bin/env perl". Allowing this would make things easier to MacPorts, where we wish to work with the MacPorts perl if it is installed, but fall back to the system perl if it isn't. Signed-off-by: Bryan Larsen Signed-off-by: Junio C Hamano diff --git a/perl/Makefile b/perl/Makefile index 17d004e..0d695fd 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -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 -- cgit v0.10.2-6-g49f6 From e4e92b3f4bead3ee17164db35a44f8904eac9104 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Thu, 3 May 2007 20:29:15 +0200 Subject: Document 'opendiff' value in config.txt and git-mergetool.txt Signed-off-by: Arjen Laarhoven Signed-off-by: Junio C Hamano diff --git a/Documentation/config.txt b/Documentation/config.txt index 7e41ca6..a7daa08 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -490,7 +490,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 diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 34288fe..add01e8 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -25,7 +25,7 @@ OPTIONS -t or --tool=:: Use the merge resolution program specified by . 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 -- cgit v0.10.2-6-g49f6 From c256acb8fbd0ac1dddb6ec39aa9b3c816493122c Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Wed, 2 May 2007 17:53:23 -0400 Subject: posix compatibility for t4200 Fix t4200 so that it also works on OS X by not relying on gnu extensions to sed. Signed-off-by: Bryan Larsen Signed-off-by: Junio C Hamano diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 6ba63d7..c64ebbb 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -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" -- cgit v0.10.2-6-g49f6 From e3ad95a8be82663d27cb501eaf9bad86a30f9cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Wed, 2 May 2007 00:12:13 +0300 Subject: gitweb: use decode_utf8 directly Using decode() tries to decode data that is already UTF-8 and borks, but decode_utf8 from Encode.pm has a built-in safety against that. Signed-off-by: Junio C Hamano diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 45ac9d7..12c2e66 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -560,12 +560,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 { @@ -590,7 +584,7 @@ sub esc_html ($;%) { my $str = shift; my %opts = @_; - $str = to_utf8($str); + $str = decode_utf8($str); $str = $cgi->escapeHTML($str); if ($opts{'-nbsp'}) { $str =~ s/ / /g; @@ -604,7 +598,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/ / /g; @@ -887,7 +881,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"}, @@ -1104,7 +1098,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 } @@ -1133,7 +1127,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; } } @@ -1607,7 +1601,7 @@ sub get_file_owner { } my $owner = $gcos; $owner =~ s/[,;].*$//; - return to_utf8($owner); + return decode_utf8($owner); } ## ...................................................................... @@ -1690,7 +1684,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) { @@ -1963,7 +1957,7 @@ sub git_print_page_path { print "
"; 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; @@ -2578,7 +2572,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'}) { @@ -3610,7 +3604,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", -- cgit v0.10.2-6-g49f6