* maint:
  gitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh
  gitweb: Fix two 'uninitialized value' warnings in git_tree()
  Solaris: Use OLD_ICONV to avoid compile warnings
  gitweb: remove PATH_INFO from $my_url and $my_uri
This commit is contained in:
Shawn O. Pearce 2008-10-02 18:16:22 -07:00
Родитель 9126f0091f 9a1fd653b1
Коммит bf8f2ad5f2
3 изменённых файлов: 59 добавлений и 1 удалений

Просмотреть файл

@ -648,6 +648,7 @@ ifeq ($(uname_S),SunOS)
NO_MEMMEM = YesPlease
NO_HSTRERROR = YesPlease
NO_MKDTEMP = YesPlease
OLD_ICONV = UnfortunatelyYes
ifeq ($(uname_R),5.8)
NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease

Просмотреть файл

@ -27,6 +27,13 @@ our $version = "++GIT_VERSION++";
our $my_url = $cgi->url();
our $my_uri = $cgi->url(-absolute => 1);
# if we're called with PATH_INFO, we have to strip that
# from the URL to find our real URL
if (my $path_info = $ENV{"PATH_INFO"}) {
$my_url =~ s,\Q$path_info\E$,,;
$my_uri =~ s,\Q$path_info\E$,,;
}
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
our $GIT = "++GIT_BINDIR++/git";
@ -4445,6 +4452,7 @@ sub git_tree {
$hash = $hash_base;
}
}
die_error(404, "No such tree") unless defined($hash);
$/ = "\0";
open my $fd, "-|", git_cmd(), "ls-tree", '-z', $hash
or die_error(500, "Open git-ls-tree failed");
@ -4485,8 +4493,8 @@ sub git_tree {
if ($basedir ne '' && substr($basedir, -1) ne '/') {
$basedir .= '/';
}
}
git_print_page_path($file_name, 'tree', $hash_base);
}
print "<div class=\"page_body\">\n";
print "<table class=\"tree\">\n";
my $alternate = 1;

Просмотреть файл

@ -502,6 +502,55 @@ test_expect_success \
gitweb_run "p=.git;a=history;f=deleted_file"'
test_debug 'cat gitweb.log'
# ----------------------------------------------------------------------
# path_info links
test_expect_success \
'path_info: project' \
'gitweb_run "" "/.git"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch' \
'gitweb_run "" "/.git/b"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch:file' \
'gitweb_run "" "/.git/master:file"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch:dir/' \
'gitweb_run "" "/.git/master:foo/"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch:file (non-existent)' \
'gitweb_run "" "/.git/master:non-existent"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch:dir/ (non-existent)' \
'gitweb_run "" "/.git/master:non-existent/"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/branch:/file' \
'gitweb_run "" "/.git/master:/file"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/:/file (implicit HEAD)' \
'gitweb_run "" "/.git/:/file"'
test_debug 'cat gitweb.log'
test_expect_success \
'path_info: project/:/ (implicit HEAD, top tree)' \
'gitweb_run "" "/.git/:/"'
test_debug 'cat gitweb.log'
# ----------------------------------------------------------------------
# feed generation