Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 22 Apr 2008 07:10:20 +0000 (00:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Apr 2008 07:10:20 +0000 (00:10 -0700)
* maint:
post-receive-email: fix accidental removal of a trailing space in signature line
Escape project names before creating pathinfo URLs
Escape project name in regexp
bash: Add completion for git diff --base --ours --theirs
diff-options.txt: document the new "--dirstat" option

1  2 
contrib/completion/git-completion.bash
gitweb/gitweb.perl
index 6012047ee55cb846f1ab05a9bca13aafe3267f64,6949cac45d0342ee6aa57bbdee5f6fe142d72c5d..665a895f5eafff619d30034afba27ac9f597eb4e
@@@ -152,7 -152,7 +152,7 @@@ __git_heads (
                done
                return
        fi
 -      for i in $(git-ls-remote "$1" 2>/dev/null); do
 +      for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@@ -173,7 -173,7 +173,7 @@@ __git_tags (
                done
                return
        fi
 -      for i in $(git-ls-remote "$1" 2>/dev/null); do
 +      for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@@ -200,7 -200,7 +200,7 @@@ __git_refs (
                done
                return
        fi
 -      for i in $(git-ls-remote "$dir" 2>/dev/null); do
 +      for i in $(git ls-remote "$dir" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@@ -223,7 -223,7 +223,7 @@@ __git_refs2 (
  __git_refs_remotes ()
  {
        local cmd i is_hash=y
 -      for i in $(git-ls-remote "$1" 2>/dev/null); do
 +      for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                n,refs/heads/*)
                        is_hash=y
@@@ -641,6 -641,7 +641,7 @@@ _git_diff (
                        --ignore-all-space --exit-code --quiet --ext-diff
                        --no-ext-diff
                        --no-prefix --src-prefix= --dst-prefix=
+                       --base --ours --theirs
                        "
                return
                ;;
@@@ -1052,7 -1053,6 +1053,7 @@@ _git_remote (
        local subcommands="add rm show prune update"
        local subcommand="$(__git_find_subcommand "$subcommands")"
        if [ -z "$subcommand" ]; then
 +              __gitcomp "$subcommands"
                return
        fi
  
diff --combined gitweb/gitweb.perl
index a48bebb1bc01ec6af718cf014db0155145508e8b,12843a4846563842aef8f0311096794ad70011c3..f83567ec39e8781cc10d3f3f3cb39c7cb6aa11ef
@@@ -369,12 -369,7 +369,12 @@@ sub filter_snapshot_fmts 
  }
  
  our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
 -do $GITWEB_CONFIG if -e $GITWEB_CONFIG;
 +if (-e $GITWEB_CONFIG) {
 +      do $GITWEB_CONFIG;
 +} else {
 +      our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
 +      do $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;
 +}
  
  # version of the core git binary
  our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
@@@ -511,7 -506,7 +511,7 @@@ sub evaluate_path_info 
        }
        # do not change any parameters if an action is given using the query string
        return if $action;
-       $path_info =~ s,^$project/*,,;
+       $path_info =~ s,^\Q$project\E/*,,;
        my ($refname, $pathname) = split(/:/, $path_info, 2);
        if (defined $pathname) {
                # we got "project.git/branch:filename" or "project.git/branch:dir/"
@@@ -633,7 -628,7 +633,7 @@@ sub href(%) 
        my ($use_pathinfo) = gitweb_check_feature('pathinfo');
        if ($use_pathinfo) {
                # use PATH_INFO for project name
-               $href .= "/$params{'project'}" if defined $params{'project'};
+               $href .= "/".esc_url($params{'project'}) if defined $params{'project'};
                delete $params{'project'};
  
                # Summary just uses the project path URL
@@@ -2575,7 -2570,7 +2575,7 @@@ EO
                my $action = $my_uri;
                my ($use_pathinfo) = gitweb_check_feature('pathinfo');
                if ($use_pathinfo) {
-                       $action .= "/$project";
+                       $action .= "/".esc_url($project);
                } else {
                        $cgi->param("p", $project);
                }