Re: Transition plan for git to move to a new hash function

2017-02-27 Thread Tony Finch
Ian Jackson  wrote:

A few questions and one or two suggestions...

> TEXTUAL SYNTAX
> ==
>
> We also reserve the following syntax for private experiments:
>   E[A-Z]+[0-9a-z]+
> We declare that public releases of git will never accept such
> object names.

Instead of this I would suggest that experimental hash names should have
multi-character prefixes and an easy registration process - rationale:
https://tools.ietf.org/html/rfc6648

> A single object may refer to other objects the hash function which
> names the object itself, or by other hash functions, in any
> combination.

If I understand it correctly, this freedom is greatly restricted later on
in this document, depending on the object type in question. If so, it's
probably worth saying so at this point.

> Commits
> ---
>
> The hash function naming an origin commit is controlled by the hint
> left in .git for the ref named by HEAD (or for HEAD itself, if HEAD is
> detached) by git checkout --orphan or git init.

This confused me for a while - I think you mean "root commit"?

> TRANSITION PLAN
> ===
>
> Y4: BLAKE by default for new projects.
>
> When creating a new working tree, it starts using BLAKE.
>
> Servers which have been updated will accept BLAKE.

Why not allow newhash pushes before making it the default for new
projects? Wouldn't it make sense to get the server side ready some time
before projects start actively using new hashes?

Or is the idea that newhash upgrade is driven from the server?

What's the upgrade process for send-email patch exchange?

Tony.
-- 
f.anthony.n.finch    http://dotat.at/  -  I xn--zr8h punycode
Fair Isle: Southwest 6 to gale 8, backing east 5 or 6, backing north 6 to gale
8 later. Rough or very rough. Rain or showers. Moderate or good.


Re: What's cooking in git.git (Jul 2015, #01; Wed, 1)

2015-07-22 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:


Thanks for the review!

  * tf/gitweb-project-listing (2015-03-19) 5 commits
   - gitweb: make category headings into links when they are directories
   - gitweb: optionally set project category from its pathname
   - gitweb: add a link under the search box to clear a project filter
   - gitweb: if the PATH_INFO is incomplete, use it as a project_filter
 
   Update gitweb to make it more pleasant to deal with a hierarchical
   forest of repositories.

By the way, you can see this patch series in action at
https://git.csx.cam.ac.uk/x/ucs/

 Second one, gitweb: if the PATH_INFO is incomplete, use it as a
 project_filter looks interesting and quite useful. Though it doesn't
 do much: it allows for handcrafted URL, and provides mechanism to
 create breadcrumbs. It doesn't use this feature in its output...
 Well, I think it doesn't: I cannot check it at this moment.

Hmm, I think this means I need a better commit message.

This patch fixes the ugly query-parameter URLs in the breadcrumbs that
you get even in path-info mode. Have a look at the breadcrumbs on the
following pages:

https://git.csx.cam.ac.uk/g/ucs/git/git.git (unpatched)
https://git.csx.cam.ac.uk/x/ucs/git/git.git (patched)

If you click on the antepenultimate /git/ in the breadcumbs you get query
parameters without the patch and path_info with the patch. With the patch
the breadcrumbs match the URL.

 What is missing is a support for query parameters path, and not only
 path info.

Query parameter support is already present, in the form of project
filters.

 Thought some thought is needed for generating (or not) breadcrumbs
 if path_info is turned off.

That already works in unpatched gitweb.

 The third, gitweb: add a link under the search box to clear a project
 filter notices a problem... then solves it in strange way. IMVHO
 a better solution would be to add List all projects URL together
 with  /  (or other separator) conditionally, if $project_filter
 is set. Or have List all projects and add List projects$limit
 if $project_filter is set.

Yes, that is exactly what the patch does. I used a suffix if to align
the print statements and markup:
+   if $project_filter;

Compare and contrast the search box on these pages:

https://git.csx.cam.ac.uk/g/ucs/?a=project_list;pf=u/fanf2
https://git.csx.cam.ac.uk/x/ucs/u/fanf2/

Perhaps you would prefer the following?

--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5549,10 +5549,14 @@ sub git_project_search_form {
  /span\n .
  $cgi-submit(-name = 'btnS', -value = 'Search') .
  $cgi-end_form() . \n .
- $cgi-a({-href = href(project = undef, searchtext = undef,
-project_filter = $project_filter)},
- esc_html(List all projects$limit)) . br /\n;
-   print /div\n;
+ $cgi-a({-href = $my_uri}, esc_html(List all projects));
+   if ($project_filter) {
+   print  /  .
+   $cgi-a({-href = href(project = undef, action = 
project_list,
+  project_filter = $project_filter)},
+   esc_html(List projects$limit));
+   }
+   print br /\n/div\n;
 }

 # entry for given @keys needs filling if at least one of keys in list

 The last two, which form the crux of this patch series, looks like
 a good idea, though not without a few caveats. I am talking here
 only about conceptual level, not about how it is coded (which has
 few issues as well):

 - I think that non-bare repositories repo/.git should be
   treated as one directory entry, i.e. gitweb should not create
   a separate category for repo/.  This is admittedly a corner
   case, but useful for git-instaweb

Yes, that's a bug, thanks for spotting it!

 - I think that people would want to be able to configure how
   many levels of directory hierarchy gets turned into categories.
   Perhaps only top level should be turned into category? Deep
   hierarchies means deep categories (usually with very few
   repositories) with current implementation.

Good question. I was assuming flat-ish directory hierarchies, but that's
clearly not very true, e.g. https://git.kernel.org/cgit/

I think it would be right to make this a %feature since categories already
nearly fit the %feature per-project override style.

I will send a new version of the series shortly.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Viking, North Utsire: Westerly 4 or 5, occasionally 6 at first, backing
southerly 3 or 4. Moderate becoming slight. Occasional rain in north. Good,
occasionally moderate.

Re: What's cooking in git.git (Jul 2015, #01; Wed, 1)

2015-07-22 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

 A question about implementation: why emptying $path_info in
 evaluate_path_info()?

That was for consistency with other parts of the subroutine which (mostly)
remove items from the global $path_info variable when they are added to
%input_params. But since $path_info isn't used after it has been parsed, I
suppose it is redundant.

  - I think that people would want to be able to configure how
many levels of directory hierarchy gets turned into categories.
Perhaps only top level should be turned into category? Deep
hierarchies means deep categories (usually with very few
repositories) with current implementation.
 
  Good question. I was assuming flat-ish directory hierarchies, but that's
  clearly not very true, e.g. https://git.kernel.org/cgit/
 
  I think it would be right to make this a %feature since categories already
  nearly fit the %feature per-project override style.

 On the other hand $projects_list_group_categories is a global gitweb
 configuration variable, and $projects_list_directory_is_category was
 patterned after it.

Yes... Which do you prefer? :-)

 A few thoughts about implementation:

Helpful, thanks!

 - can we turn category header into link even if the category didn't
   came from $projects_list_directory_is_category?

That would mean changing the project filter to match categories as well as
paths. I don't know if this is the right thing to do; perhaps it is,
because the current behaviour of my category headings is a bit surprising.

At the moment, clicking on the git category heading on the page linked
below takes you to a page that does not list all the repos that were under
the category heading on the main page.

https://git.csx.cam.ac.uk/x/ucs/

 - even if $projects_list_directory_is_category is true, the category
   could came from 'category' file, or otherwise manually set category,
   though I wonder how we can easily detect this...

Yes - I use this to list my personal/experimental repos alongside
the production repos.

I'm not sure why gitweb would need to detect this or what it would do in
response. At the moment it just works, apart from the oddity with
categories vs project filters i described above.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Viking, North Utsire: Westerly 4 or 5, occasionally 6 at first, backing
southerly 3 or 4. Moderate becoming slight. Occasional rain in north. Good,
occasionally moderate.

Re: What's cooking in git.git (Jul 2015, #01; Wed, 1)

2015-07-22 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

 Food for thought

Yes, very helpful, thanks. I got mobbed by other things today so I won't
be able to get back to this until next week.

Tony (off for a few days holiday).
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Lundy, Fastnet, Irish Sea, Shannon: West or southwest, veering north later in
Shannon and Fastnet, 4 or 5. Slight or moderate, occasionally rough at first
in north Shannon. Rain or showers. Good, occasionally poor.

Re: What's cooking in git.git (Jun 2015, #06; Wed, 24)

2015-06-29 Thread Tony Finch
What can I do to help un-stall my gitweb patches?

 [Stalled]

 * tf/gitweb-project-listing (2015-03-19) 5 commits
  - gitweb: make category headings into links when they are directories
  - gitweb: optionally set project category from its pathname
  - gitweb: add a link under the search box to clear a project filter
  - gitweb: if the PATH_INFO is incomplete, use it as a project_filter
  - gitweb: fix typo in man page

  Update gitweb to make it more pleasant to deal with a hierarchical
  forest of repositories.

  Any comments from those who use or have their own code in Gitweb?

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
South Utsire: Westerly 4, occasionally 5 in east. Smooth or slight,
occasionally moderate in east. Fog patches later. Moderate, occasionally very
poor later.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitweb: Update logo and favicon

2015-04-13 Thread Tony Finch
Thomas Schneider thosc...@gmail.com wrote:

 The new images were downloaded from 
 https://git-scm.herokuapp.com/downloads/logos
 and converted with ImageMagick:
   convert -resize 72x30 Git-Logo-2Color.eps git-logo.png
   convert -resize 16x16 Git-Icon-1788C.eps git-favicon.png
 The old logo was only 27 pixels in height, the 3 additional pixels are 
 necessary
 for the slightly different aspect ratio of the new one.

This is a good improvement :-) I did something similar for the logos on my
installation of gitweb, including exactly the same command to create the
favicon.

https://git.csx.cam.ac.uk/x/ucs/git/gitcam.git/blob/HEAD:/bin/make-icons.sh

I think it is a bad idea to change the height of the logo: gitweb
generates an img src element with a fixed 72x27 size, and the
gitweb.conf documentation suggests that site admins can replace the logo
with a custom one of the same size. My version of the new logo includes a
bit of horizontal padding so that it matches this specification.

(The higher-resolution icons are used by my server's documentation pages
but not by gitweb.)

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Humber, Thames: Northwest backing south or southwest later, 4 or 5,
occasionally 6 later. Slight or moderate. Fair. Moderate or good.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How to send a warning message from git hosting server?

2015-04-08 Thread Tony Finch
Yi, EungJun semtlen...@gmail.com wrote:

 I want a way to response a remote message when a client send any kind
 of request. Is it possible?

Yes, though you need a wrapper around git. Recent versions of gitolite
have a motd message of the day feature.

http://gitolite.com/gitolite/list-non-core.html#triggers

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Fisher: Northwest backing southwest 4 or 5, occasionally 6 at first. Slight or
moderate. Fog patches. Moderate or good, occasionally very poor.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gitweb: avoid double / in search form action link

2015-04-08 Thread Tony Finch
The in-project search form needs to duplicate some of the logic of
the href() subroutine, because the parameters need to be encoded
in the form rather than in the URL.  However it failed to correctly
append the project PATH_INFO in cases when there is a trailing slash
on gitweb's self-referential URL, and failed to correctly follow
PATH_INFO escaping rules.

This change makes the form action URL consistent with the URL
generated by href().

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a02f3e4..05acd73 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4129,10 +4129,14 @@ sub print_search_form {
} else {
$search_hash = HEAD;
}
+   # We can't use href() here because we need to encode the
+   # URL parameters into the form, not into the action link.
my $action = $my_uri;
my $use_pathinfo = gitweb_check_feature('pathinfo');
if ($use_pathinfo) {
-   $action .= /.esc_url($project);
+   # See notes about doubled / in href()
+   $action =~ s,/$,,;
+   $action .= /.esc_path_info($project);
}
print $cgi-start_form(-method = get, -action = $action) .
  div class=\search\\n .
-- 
2.2.1.68.g56d9796

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] gitweb: make category headings into links when they are directories

2015-03-26 Thread Tony Finch

 On 26 Mar 2015, at 19:49, Junio C Hamano gits...@pobox.com wrote:
 
 Any comments from those who use or have their own code in Gitweb on
 this topic?

Thanks for chasing up my patches. I should have written a covering letter, to 
say that you can see these patches in action at 
https://git.csx.cam.ac.uk/x/ucs/ - try clicking on the category headings, and 
observe the pathinfo, breadcrumbs, and links under the search box.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] gitweb: optionally set project category from its pathname

2015-03-19 Thread Tony Finch
When repositories are organized in a hierarchial directory tree
it is convenient if gitweb project categories can be set
automatically based on their parent directory, so that users
do not have to set the same information twice.

Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/gitweb.conf.txt |  6 ++
 gitweb/gitweb.perl| 13 ++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index 29f1e06..7c0de18 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -492,6 +492,12 @@ $projects_list_group_categories::
`$GIT_DIR/category` file or the `gitweb.category` variable in each
repository's configuration.  Disabled by default (set to 0).

+$projects_list_directory_is_category::
+   Whether to set a project's category to its parent directory, i.e. its
+   pathname excluding the `/repo.git` leaf name. This is only used if
+   the repo has no explicit setting, and if the pathname has more than
+   one component. Disabled by default (set to 0).
+
 $project_list_default_category::
Default category for projects for which none is specified.  If this is
set to the empty string, such projects will remain uncategorized and
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9abc5bc..0aab3e0 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -133,6 +133,10 @@ our $projects_list_description_width = 25;
 # (enabled if this variable evaluates to true)
 our $projects_list_group_categories = 0;

+# project's category defaults to its parent directory
+# (enabled if this variable evaluates to true)
+our $projects_list_directory_is_category = 0;
+
 # default category if none specified
 # (leave the empty string for no category)
 our $project_list_default_category = ;
@@ -2908,7 +2912,11 @@ sub git_get_project_description {

 sub git_get_project_category {
my $path = shift;
-   return git_get_file_or_project_config($path, 'category');
+   my $cat = git_get_file_or_project_config($path, 'category');
+   return $cat if $cat;
+   return $1 if $projects_list_directory_is_category
+  $path =~ m,^(.*)/[^/]*$,;
+   return $project_list_default_category;
 }


@@ -5622,8 +5630,7 @@ sub fill_project_list_info {
}
if ($projects_list_group_categories 
project_info_needs_filling($pr, $filter_set-('category'))) 
{
-   my $cat = git_get_project_category($pr-{'path'}) ||
-  
$project_list_default_category;
+   my $cat = git_get_project_category($pr-{'path'});
$pr-{'category'} = to_utf8($cat);
}

-- 
2.2.1.68.g56d9796


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] gitweb: make category headings into links when they are directories

2015-03-19 Thread Tony Finch
When $projects_list_category_is_directory is turned on, project
categories can be useful as project filters, so with that setting
gitweb now makes the category headings into project_filter links
(like the breadcrumbs).

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0aab3e0..a02f3e4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5838,8 +5838,18 @@ sub git_project_list_body {
if ($check_forks) {
print td/td\n;
}
-   print td class=\category\ 
colspan=\5\.esc_html($cat)./td\n;
-   print /tr\n;
+   print td class=\category\ colspan=\5\;
+   if ($projects_list_directory_is_category) {
+   print $cgi-a({-href =
+   href(project = undef,
+   project_filter = $cat,
+   action = project_list),
+   -class = list},
+   esc_html($cat));
+   } else {
+   print esc_html($cat);
+   }
+   print /td\n/tr\n;
}

git_project_list_rows($categories{$cat}, undef, undef, 
$check_forks);
-- 
2.2.1.68.g56d9796

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] gitweb: if the PATH_INFO is incomplete, use it as a project_filter

2015-03-19 Thread Tony Finch
Previously gitweb would ignore partial PATH_INFO. For example,
it would produce a project list for the top URL
https://www.example.org/projects/
and a project summary for
https://www.example.org/projects/git/git.git
but if you tried to list just the git-related projects with
https://www.example.org/projects/git/
you would get a list of all projects, same as the top URL.

As well as fixing that omission, this change also makes gitweb
generate PATH_INFO-style URLs for project filter links, such
as in the breadcrumbs.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7a5b23a..073f324 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -895,7 +895,17 @@ sub evaluate_path_info {
while ($project  !check_head_link($projectroot/$project)) {
$project =~ s,/*[^/]*$,,;
}
-   return unless $project;
+   # If there is no project, use the PATH_INFO as a project filter if it
+   # is a directory in the projectroot. (It can't be a subdirectory of a
+   # repo because we just verified that isn't the case.)
+   unless ($project) {
+   if (-d $projectroot/$path_info) {
+   $path_info =~ s,/+$,,;
+   $input_params{'project_filter'} = $path_info;
+   $path_info = ;
+   }
+   return;
+   }
$input_params{'project'} = $project;

# do not change any parameters if an action is given using the query 
string
@@ -1360,6 +1370,18 @@ sub href {
}

my $use_pathinfo = gitweb_check_feature('pathinfo');
+
+   # we have to check for a project_filter first because handling the full
+   # project-plus-parameters deletes some of the paramaters we check here
+   if (!defined $params{'project'}  $params{'project_filter'} 
+   $params{'action'} eq project_list 
+   (exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) 
{
+   $href =~ s,/$,,;
+   $href .= /.esc_path_info($params{'project_filter'})./;
+   delete $params{'project_filter'};
+   delete $params{'action'};
+   }
+
if (defined $params{'project'} 
(exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) 
{
# try to put as many parameters as possible in PATH_INFO:
-- 
2.2.1.68.g56d9796


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] gitweb: add a link under the search box to clear a project filter

2015-03-19 Thread Tony Finch
Previously when a project filter was active, the only simple way
to clear it was by clicking the home link in the breadcrumbs, which
is not very obvious.

This change adds another home link under the search box which clears
both project filter and search, next to the existing link that
clears the search and keeps the project filter.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 073f324..9abc5bc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5549,10 +5549,13 @@ sub git_project_search_form {
  /span\n .
  $cgi-submit(-name = 'btnS', -value = 'Search') .
  $cgi-end_form() . \n .
- $cgi-a({-href = href(project = undef, searchtext = undef,
-project_filter = $project_filter)},
- esc_html(List all projects$limit)) . br /\n;
-   print /div\n;
+ $cgi-a({-href = $my_uri}, esc_html(List all projects));
+   print  /  .
+ $cgi-a({-href = href(project = undef, action = project_list,
+project_filter = $project_filter)},
+ esc_html(List projects$limit))
+   if $project_filter;
+   print br /\n/div\n;
 }

 # entry for given @keys needs filling if at least one of keys in list
-- 
2.2.1.68.g56d9796


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] gitweb: fix typo in man page

2015-03-19 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/gitweb.conf.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index ebe7a6c..29f1e06 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -487,7 +487,7 @@ By default it is set to (), i.e. an empty list.  This means 
that gitweb
 would not try to create project URL (to fetch) from project name.

 $projects_list_group_categories::
-   Whether to enables the grouping of projects by category on the project
+   Whether to enable the grouping of projects by category on the project
list page. The category of a project is determined by the
`$GIT_DIR/category` file or the `gitweb.category` variable in each
repository's configuration.  Disabled by default (set to 0).
-- 
2.2.1.68.g56d9796


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-prompt: preserve value of $? in all cases

2015-01-14 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 contrib/completion/git-prompt.sh | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 3c3fc6d..3e70e74 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -288,6 +288,7 @@ __git_eread ()
 # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
 __git_ps1 ()
 {
+   # preserve exit status
local exit=$?
local pcmode=no
local detached=no
@@ -303,7 +304,7 @@ __git_ps1 ()
;;
0|1)printf_format=${1:-$printf_format}
;;
-   *)  return
+   *)  return $exit
;;
esac

@@ -355,7 +356,7 @@ __git_ps1 ()
#In PC mode PS1 always needs to be set
PS1=$ps1pc_start$ps1pc_end
fi
-   return
+   return $exit
fi

local short_sha
@@ -416,7 +417,7 @@ __git_ps1 ()
if [ $pcmode = yes ]; then
PS1=$ps1pc_start$ps1pc_end
fi
-   return
+   return $exit
fi
# is it a symbolic ref?
b=${head#ref: }
@@ -513,6 +514,5 @@ __git_ps1 ()
printf -- $printf_format $gitstring
fi

-   # preserve exit status
return $exit
 }
-- 
2.2.1.68.g56d9796

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] git-prompt: preserve value of $? inside shell prompt

2015-01-14 Thread Tony Finch
SZEDER Gábor sze...@ira.uka.de wrote:

 Makes sense, but the patch doesn't cover all cases, because
 __git_ps1() can exit early

Thanks for looking at the patch. I feel quite silly for missing the other
return points :-( Follow-up patch on the way...

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Faeroes, Southeast Iceland: Cyclonic for a time in Faeroes, otherwise
northeasterly 6 to gale 8, increasing gale 8 to storm 10. Very rough or high.
Rain, snow or wintry showers. Moderate or poor, occasionally very poor.

[PATCH] git-prompt: preserve command exit status

2014-12-22 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 contrib/completion/git-prompt.sh | 4 
 1 file changed, 4 insertions(+)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index c5473dc..5fe69d0 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -288,6 +288,7 @@ __git_eread ()
 # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
 __git_ps1 ()
 {
+   local exit=$?
local pcmode=no
local detached=no
local ps1pc_start='\u@\h:\w '
@@ -511,4 +512,7 @@ __git_ps1 ()
else
printf -- $printf_format $gitstring
fi
+
+   # preserve exit status
+   return $exit
 }
-- 
2.1.0.rc1.12.g1e9b79d

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] git-prompt: preserve value of $? inside shell prompt

2014-12-22 Thread Tony Finch
If you have a prompt which displays the command exit status,
__git_ps1 without this change corrupts it, although it has
the correct value in the parent shell:

~/src/git (master) 0 $ set | grep ^PS1
PS1='\w$(__git_ps1) $? \$ '
~/src/git (master) 0 $ false
~/src/git (master) 0 $ echo $?
1
~/src/git (master) 0 $

There is a slightly ugly workaround:

~/src/git (master) 0 $ set | grep ^PS1
PS1='\w$(x=$?; __git_ps1; exit $x) $? \$ '
~/src/git (master) 0 $ false
~/src/git (master) 1 $

This change makes the workaround unnecessary.

Signed-off-by: Tony Finch d...@dotat.at
---
 contrib/completion/git-prompt.sh | 4 
 1 file changed, 4 insertions(+)

I hope that explains it properly :-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index c5473dc..5fe69d0 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -288,6 +288,7 @@ __git_eread ()
 # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
 __git_ps1 ()
 {
+   local exit=$?
local pcmode=no
local detached=no
local ps1pc_start='\u@\h:\w '
@@ -511,4 +512,7 @@ __git_ps1 ()
else
printf -- $printf_format $gitstring
fi
+
+   # preserve exit status
+   return $exit
 }
-- 
2.2.1.68.g56d9796

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] git-prompt: preserve value of $? inside shell prompt

2014-12-22 Thread Tony Finch
Junio C Hamano gits...@pobox.com wrote:

 Yes.  I wouldn't have spent 20 minutes experimenting with various
 hypothetical use cases if the above were there in the first place.

Sorry for wasting your time, and thanks for reviewing the patch.

(I am so used to having $? in my prompt it took me ages to find and
explain the problem too... Sigh!)

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Trafalgar: Easterly 6 to gale 8 far southeast, otherwise northeasterly veering
southeasterly 4 or 5. Slight or moderate, occasionally rough at first in
south. Occasional drizzle. Good, occasionally moderate.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Uplift from SCCS to Git

2014-11-27 Thread Tony Finch
I have just completed a project to convert an old and scruffy SCCS working
tree to Git. This conversion involved a fair amount of toolsmithing.

I have published my conversion scripts at
https://git.csx.cam.ac.uk/x/ucs/ipreg/sccs2rcs2cvs2git.git

And there is a report on the conversion process at
https://git.csx.cam.ac.uk/x/ucs/ipreg/sccs2rcs2cvs2git.git/blob_plain/HEAD:/ABOUT.html

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Dogger, Fisher, German Bight: Southeasterly 5 to 7, but 4 at first in west
Dogger, occasionally gale 8 in Fisher and later in German Bight. Moderate or
rough. Rain at times. Moderate or good, occasionally poor.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Branch objects (was: Re: cherry picking and merge)

2014-08-07 Thread Tony Finch
Nico Williams n...@cryptonector.com wrote:
 On Wed, Aug 06, 2014 at 08:31:18PM +0200, Jakub Narębski wrote:
  On Wed, Aug 6, 2014 at 6:26 PM, Nico Williams n...@cryptonector.com wrote:
  
   My proposal was to put this sort of ancillary history info in a
   branch object (and that branches should be objects).
 
  Is it something like object-ified reflog, similar to how replacement
  objects (git-replace) can be thought to be object-ified grafts (I know
  they are more)? Do I understand it correctly?

 Yes, per-branch.  At push time a commit would be pushed to the upstream
 branch listing the commits pushed now (and who by).  Locally every
 rebase/cherry-pick/merge/commit onto the branch would appear in the
 branch object's history, kinda just like the reflog.  The main
 difference is that the upstream branch's history could be viewed.

  With rebases the problem is that it would be nice to have (at least
  for a short time) the history of series of patches (the metahistory,
  or history of a branch), but usually one doesn't need old pre-rebase
  version after cleaning up the history for publishing.

 Right.

I have been fiddling around in this area.

What I want to be able to do is develop fixes for open source code that I
run, and get those fixes upstream. This means I need a rebasing workflow,
to keep the patches up-to-date and to deal with code review feedback.

But this is inconvenient for deploying the patched version to production
(which is the point of developing the fixes) - I want a fast-forwarding
branch for that. And it would be nice to be able to share the history of
the patch series, so others can see what changed between revisions more
easily.

So I have a small tool which maintains a publication branch which tracks
the head of a rebasing branch. It's reasonably satisfactory so far...

https://git.csx.cam.ac.uk/x/ucs/git/git-repub.git

... though the structure of the publication branch is weird and not very
easy to navigate. You can see it in action in my git.git repo:

https://git.csx.cam.ac.uk/x/ucs/git/git.git/shortlog/refs/heads/ucam/fanf2/patch

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Irish Sea: Variable 4. Slight. Showers. Good.

Re: Branch objects (was: Re: cherry picking and merge)

2014-08-07 Thread Tony Finch
Nico Williams n...@cryptonector.com wrote:
 On Thu, Aug 07, 2014 at 12:38:48PM +0100, Tony Finch wrote:

  But [a rebasing workflow] is inconvenient for deploying the patched
  version to production (which is the point of developing the fixes) - I
  want a fast-forwarding branch for that.

 I'm not sure I follow this.  You deploy what you build, and you build
 the HEAD of the production branch, whatever that is.  If it gets
 rebased, so it it does.

The problem is that the production branch gets copied around: pushed to
the repo server, pulled by other team members, etc. Forced pushes
are accident-prone, as is resetting a rebased branch after a pull.

  So I have a small tool which maintains a publication branch which
  tracks the head of a rebasing branch. It's reasonably satisfactory so
  far...
 
  https://git.csx.cam.ac.uk/x/ucs/git/git-repub.git

 Yeah, that's useful.

Glad you think so :-)

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Thames: Northeast veering southeast 4 or 5, occasionally 6. Slight, becoming
slight or moderate. Fair then rain or thundery showers. Good, becoming
moderate or poor for a time.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Branch objects (was: Re: cherry picking and merge)

2014-08-07 Thread Tony Finch
Nico Williams n...@cryptonector.com wrote:
 On Thu, Aug 07, 2014 at 05:42:34PM +0100, Tony Finch wrote:
 
  The problem is that the production branch gets copied around: pushed to
  the repo server, pulled by other team members, etc. Forced pushes
  are accident-prone, as is resetting a rebased branch after a pull.

 When I rebase and I need the old HEAD around I do something like this:
 [...]
 Either way I retain the old HEAD with some name.

Hmm, yes, I can see that would work. However my previous workflow was
rather branch-heavy and I found the accumulation of names annoying. I have
not yet had enough usage out of git-repub to see if it goes too far in the
direction of lack-of-names. A big omission is no opportunity to edit its
commit messages.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Rockall: Southwesterly becoming cyclonic in north, 5 to 7. Moderate or rough.
Rain or showers. Moderate or good.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] imap-send: clarify CRAM-MD5 vs LOGIN documentation

2014-08-01 Thread Tony Finch
Explicitly mention that leaving imap.authMethod unset makes
git imap-send use the basic IMAP plaintext LOGIN command.

Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/git-imap-send.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index 875d283..770cbe8 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -76,7 +76,8 @@ imap.preformattedHTML::

 imap.authMethod::
Specify authenticate method for authentication with IMAP server.
-   Current supported method is 'CRAM-MD5' only.
+   Current supported method is 'CRAM-MD5' only. If this is not set
+   then 'git imap-send' uses the basic IMAP plaintext LOGIN command.

 Examples
 
-- 
2.1.0.rc0.60.gb5b18e5


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] imap-send: create target mailbox if it is missing

2014-08-01 Thread Tony Finch
Some MUAs delete their drafts folder when it is empty, so
git imap-send should be able to create it if necessary.

This change checks that the folder exists immediately after
login and tries to create it if it is missing.

There was some vestigial code to handle a [TRYCREATE] response
from the server when an APPEND target is missing. However this
code never ran (the create and trycreate flags were never set)
and when I tried to make it run I found that the code had already
thrown away the contents of the message it was trying to append.

Signed-off-by: Tony Finch d...@dotat.at
---
 imap-send.c | 57 ++---
 1 file changed, 26 insertions(+), 31 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 524fbab..a29d03e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -128,7 +128,6 @@ struct imap_cmd_cb {
char *data;
int dlen;
int uid;
-   unsigned create:1, trycreate:1;
 };

 struct imap_cmd {
@@ -714,8 +713,8 @@ static int parse_response_code(struct imap_store *ctx, 
struct imap_cmd_cb *cb,
 static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
 {
struct imap *imap = ctx-imap;
-   struct imap_cmd *cmdp, **pcmdp, *ncmdp;
-   char *cmd, *arg, *arg1, *p;
+   struct imap_cmd *cmdp, **pcmdp;
+   char *cmd, *arg, *arg1;
int n, resp, resp2, tag;

for (;;) {
@@ -801,30 +800,9 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
if (!strcmp(OK, arg))
resp = DRV_OK;
else {
-   if (!strcmp(NO, arg)) {
-   if (cmdp-cb.create  cmd  
(cmdp-cb.trycreate || !memcmp(cmd, [TRYCREATE], 11))) { /* SELECT, APPEND or 
UID COPY */
-   p = strchr(cmdp-cmd, '');
-   if (!issue_imap_cmd(ctx, NULL, 
CREATE \%.*s\, (int)(strchr(p + 1, '') - p + 1), p)) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   /* not waiting here violates 
the spec, but a server that does not
-  grok this nonetheless 
violates it too. */
-   cmdp-cb.create = 0;
-   if (!(ncmdp = 
issue_imap_cmd(ctx, cmdp-cb, %s, cmdp-cmd))) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   free(cmdp-cmd);
-   free(cmdp);
-   if (!tcmd)
-   return 0;   /* 
ignored */
-   if (cmdp == tcmd)
-   tcmd = ncmdp;
-   continue;
-   }
+   if (!strcmp(NO, arg))
resp = RESP_NO;
-   } else /*if (!strcmp(BAD, arg))*/
+   else /*if (!strcmp(BAD, arg))*/
resp = RESP_BAD;
fprintf(stderr, IMAP command '%s' returned 
response (%s) - %s\n,
 memcmp(cmdp-cmd, LOGIN, 5) ?
@@ -833,7 +811,6 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
}
if ((resp2 = parse_response_code(ctx, cmdp-cb, cmd)) 
 resp)
resp = resp2;
-   normal:
if (cmdp-cb.done)
cmdp-cb.done(ctx, cmdp, resp);
free(cmdp-cb.data);
@@ -944,7 +921,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct 
imap_cmd *cmd, const cha
return 0;
 }

-static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
+static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char 
*folder)
 {
struct credential cred = CREDENTIAL_INIT;
struct imap_store *ctx;
@@ -1156,6 +1133,25 @@ static struct imap_store *imap_open_store(struct 
imap_server_conf *srvc)
credential_approve(cred);
credential_clear(cred);

+   /* check the target mailbox exists */
+   ctx-name = folder;
+   switch (imap_exec(ctx, NULL, EXAMINE \%s\, ctx-name)) {
+   case RESP_OK:
+   /* ok */
+   break;
+   case RESP_BAD

Re: [PATCH] imap-send: clarify CRAM-MD5 vs LOGIN documentation

2014-07-31 Thread Tony Finch
Junio C Hamano gits...@pobox.com wrote:

 Both patches make sense to me, but can you please sign-off your
 patches?

Oops, sorry about that. Re-roll on its way...

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Thames, Dover: Southwest 4 or 5, increasing 6 at times. Slight or moderate.
Fair. Good.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] imap-send: create target mailbox if it is missing

2014-07-31 Thread Tony Finch
Some MUAs delete their drafts folder when it is empty, so
git imap-send should be able to create it if necessary.

This change checks that the folder exists immediately after
login and tries to create it if it is missing.

There was some vestigial code to handle a [TRYCREATE] response
from the server when an APPEND target is missing. However this
code never ran (the create and trycreate flags were never set)
and when I tried to make it run I found that the code had already
thrown away the contents of the message it was trying to append.

Signed-off-by: Tony Finch d...@dotat.at
---
 imap-send.c | 56 +---
 1 file changed, 25 insertions(+), 31 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 524fbab..5e4a24e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -128,7 +128,6 @@ struct imap_cmd_cb {
char *data;
int dlen;
int uid;
-   unsigned create:1, trycreate:1;
 };

 struct imap_cmd {
@@ -714,8 +713,8 @@ static int parse_response_code(struct imap_store *ctx, 
struct imap_cmd_cb *cb,
 static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
 {
struct imap *imap = ctx-imap;
-   struct imap_cmd *cmdp, **pcmdp, *ncmdp;
-   char *cmd, *arg, *arg1, *p;
+   struct imap_cmd *cmdp, **pcmdp;
+   char *cmd, *arg, *arg1;
int n, resp, resp2, tag;

for (;;) {
@@ -801,30 +800,9 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
if (!strcmp(OK, arg))
resp = DRV_OK;
else {
-   if (!strcmp(NO, arg)) {
-   if (cmdp-cb.create  cmd  
(cmdp-cb.trycreate || !memcmp(cmd, [TRYCREATE], 11))) { /* SELECT, APPEND or 
UID COPY */
-   p = strchr(cmdp-cmd, '');
-   if (!issue_imap_cmd(ctx, NULL, 
CREATE \%.*s\, (int)(strchr(p + 1, '') - p + 1), p)) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   /* not waiting here violates 
the spec, but a server that does not
-  grok this nonetheless 
violates it too. */
-   cmdp-cb.create = 0;
-   if (!(ncmdp = 
issue_imap_cmd(ctx, cmdp-cb, %s, cmdp-cmd))) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   free(cmdp-cmd);
-   free(cmdp);
-   if (!tcmd)
-   return 0;   /* 
ignored */
-   if (cmdp == tcmd)
-   tcmd = ncmdp;
-   continue;
-   }
+   if (!strcmp(NO, arg))
resp = RESP_NO;
-   } else /*if (!strcmp(BAD, arg))*/
+   else /*if (!strcmp(BAD, arg))*/
resp = RESP_BAD;
fprintf(stderr, IMAP command '%s' returned 
response (%s) - %s\n,
 memcmp(cmdp-cmd, LOGIN, 5) ?
@@ -833,7 +811,6 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
}
if ((resp2 = parse_response_code(ctx, cmdp-cb, cmd)) 
 resp)
resp = resp2;
-   normal:
if (cmdp-cb.done)
cmdp-cb.done(ctx, cmdp, resp);
free(cmdp-cb.data);
@@ -944,7 +921,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct 
imap_cmd *cmd, const cha
return 0;
 }

-static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
+static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char 
*folder)
 {
struct credential cred = CREDENTIAL_INIT;
struct imap_store *ctx;
@@ -1156,6 +1133,25 @@ static struct imap_store *imap_open_store(struct 
imap_server_conf *srvc)
credential_approve(cred);
credential_clear(cred);

+   /* check the target mailbox exists */
+   ctx-name = folder;
+   switch (imap_exec(ctx, NULL, EXAMINE \%s\, ctx-name)) {
+   case RESP_OK:
+   /* ok */
+   break;
+   case RESP_BAD

[PATCH 1/2] imap-send: clarify CRAM-MD5 vs LOGIN documentation

2014-07-31 Thread Tony Finch
Explicitly mention that leaving imap.authMethod unset makes
git imap-send use the basic IMAP plaintext LOGIN command.

Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/git-imap-send.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index 875d283..770cbe8 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -76,7 +76,8 @@ imap.preformattedHTML::

 imap.authMethod::
Specify authenticate method for authentication with IMAP server.
-   Current supported method is 'CRAM-MD5' only.
+   Current supported method is 'CRAM-MD5' only. If this is not set
+   then 'git imap-send' uses the basic IMAP plaintext LOGIN command.

 Examples
 
-- 
2.1.0.rc0.229.gaee38de


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] gitweb: fix typo in man page

2014-07-31 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/gitweb.conf.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index ebe7a6c..29f1e06 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -487,7 +487,7 @@ By default it is set to (), i.e. an empty list.  This means 
that gitweb
 would not try to create project URL (to fetch) from project name.

 $projects_list_group_categories::
-   Whether to enables the grouping of projects by category on the project
+   Whether to enable the grouping of projects by category on the project
list page. The category of a project is determined by the
`$GIT_DIR/category` file or the `gitweb.category` variable in each
repository's configuration.  Disabled by default (set to 0).
-- 
2.1.0.rc0.229.gaee38de


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] gitweb: improve directory hierarchy handling

2014-07-31 Thread Tony Finch
There are two main things in this little seris:

The second and third patches improve gitweb's project filter feature,
which is for listing just the projects in a subdirectory.

The fourth and fifth allow the admin to use a directory hierarchy
to automatically categorize projects in gitweb.

Tony Finch (5):
  gitweb: fix typo in man page
  gitweb: if the PATH_INFO is incomplete, use it as a project_filter
  gitweb: add a link under the search box to clear a project filter
  gitweb: optionally set project category from its pathname
  gitweb: make category headings into links when they are directories

 Documentation/gitweb.conf.txt |  8 +-
 gitweb/gitweb.perl| 62 ---
 2 files changed, 59 insertions(+), 11 deletions(-)

-- 
2.1.0.rc0.229.gaee38de

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] gitweb: add a link under the search box to clear a project filter

2014-07-31 Thread Tony Finch
Previously when a project filter was active, the only simple way
to clear it was by clicking the home link in the breadcrumbs, which
is not very obvious.

This change adds another home link under the search box which clears
both project filter and search, next to the existing link that
clears the search and keeps the project filter.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 12aba8f..d1e6b79 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5545,10 +5545,13 @@ sub git_project_search_form {
  /span\n .
  $cgi-submit(-name = 'btnS', -value = 'Search') .
  $cgi-end_form() . \n .
- $cgi-a({-href = href(project = undef, searchtext = undef,
-project_filter = $project_filter)},
- esc_html(List all projects$limit)) . br /\n;
-   print /div\n;
+ $cgi-a({-href = $my_uri}, esc_html(List all projects));
+   print  /  .
+ $cgi-a({-href = href(project = undef, action = project_list,
+project_filter = $project_filter)},
+ esc_html(List projects$limit))
+   if $project_filter;
+   print br /\n/div\n;
 }

 # entry for given @keys needs filling if at least one of keys in list
-- 
2.1.0.rc0.229.gaee38de


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] gitweb: optionally set project category from its pathname

2014-07-31 Thread Tony Finch
When repositories are organized in a hierarchial directory tree
it is convenient if gitweb project categories can be set
automatically based on their parent directory, so that users
do not have to set the same information twice.

Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/gitweb.conf.txt |  6 ++
 gitweb/gitweb.perl| 13 ++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index 29f1e06..7c0de18 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -492,6 +492,12 @@ $projects_list_group_categories::
`$GIT_DIR/category` file or the `gitweb.category` variable in each
repository's configuration.  Disabled by default (set to 0).

+$projects_list_directory_is_category::
+   Whether to set a project's category to its parent directory, i.e. its
+   pathname excluding the `/repo.git` leaf name. This is only used if
+   the repo has no explicit setting, and if the pathname has more than
+   one component. Disabled by default (set to 0).
+
 $project_list_default_category::
Default category for projects for which none is specified.  If this is
set to the empty string, such projects will remain uncategorized and
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d1e6b79..edbc058 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -129,6 +129,10 @@ our $projects_list_description_width = 25;
 # (enabled if this variable evaluates to true)
 our $projects_list_group_categories = 0;

+# project's category defaults to its parent directory
+# (enabled if this variable evaluates to true)
+our $projects_list_directory_is_category = 0;
+
 # default category if none specified
 # (leave the empty string for no category)
 our $project_list_default_category = ;
@@ -2904,7 +2908,11 @@ sub git_get_project_description {

 sub git_get_project_category {
my $path = shift;
-   return git_get_file_or_project_config($path, 'category');
+   my $cat = git_get_file_or_project_config($path, 'category');
+   return $cat if $cat;
+   return $1 if $projects_list_directory_is_category
+  $path =~ m,^(.*)/[^/]*$,;
+   return $project_list_default_category;
 }


@@ -5618,8 +5626,7 @@ sub fill_project_list_info {
}
if ($projects_list_group_categories 
project_info_needs_filling($pr, $filter_set-('category'))) 
{
-   my $cat = git_get_project_category($pr-{'path'}) ||
-  
$project_list_default_category;
+   my $cat = git_get_project_category($pr-{'path'});
$pr-{'category'} = to_utf8($cat);
}

-- 
2.1.0.rc0.229.gaee38de


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] gitweb: make category headings into links when they are directories

2014-07-31 Thread Tony Finch
When $projects_list_category_is_directory is turned on, project
categories can be useful as project filters, so with that setting
gitweb now makes the category headings into project_filter links
(like the breadcrumbs).

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index edbc058..32e65ae 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5834,8 +5834,18 @@ sub git_project_list_body {
if ($check_forks) {
print td/td\n;
}
-   print td class=\category\ 
colspan=\5\.esc_html($cat)./td\n;
-   print /tr\n;
+   print td class=\category\ colspan=\5\;
+   if ($projects_list_directory_is_category) {
+   print $cgi-a({-href =
+   href(project = undef,
+   project_filter = $cat,
+   action = project_list),
+   -class = list},
+   esc_html($cat));
+   } else {
+   print esc_html($cat);
+   }
+   print /td\n/tr\n;
}

git_project_list_rows($categories{$cat}, undef, undef, 
$check_forks);
-- 
2.1.0.rc0.229.gaee38de

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] gitweb: if the PATH_INFO is incomplete, use it as a project_filter

2014-07-31 Thread Tony Finch
Previously gitweb would ignore partial PATH_INFO. For example,
it would produce a project list for the top URL
https://www.example.org/projects/
and a project summary for
https://www.example.org/projects/git/git.git
but if you tried to list just the git-related projects with
https://www.example.org/projects/git/
you would get a list of all projects, same as the top URL.

As well as fixing that omission, this change also makes gitweb
generate PATH_INFO-style URLs for project filter links, such
as in the breadcrumbs.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a9f57d6..12aba8f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -891,7 +891,17 @@ sub evaluate_path_info {
while ($project  !check_head_link($projectroot/$project)) {
$project =~ s,/*[^/]*$,,;
}
-   return unless $project;
+   # If there is no project, use the PATH_INFO as a project filter if it
+   # is a directory in the projectroot. (It can't be a subdirectory of a
+   # repo because we just verified that isn't the case.)
+   unless ($project) {
+   if (-d $projectroot/$path_info) {
+   $path_info =~ s,/+$,,;
+   $input_params{'project_filter'} = $path_info;
+   $path_info = ;
+   }
+   return;
+   }
$input_params{'project'} = $project;

# do not change any parameters if an action is given using the query 
string
@@ -1356,6 +1366,18 @@ sub href {
}

my $use_pathinfo = gitweb_check_feature('pathinfo');
+
+   # we have to check for a project_filter first because handling the full
+   # project-plus-parameters deletes some of the paramaters we check here
+   if (!defined $params{'project'}  $params{'project_filter'} 
+   $params{'action'} eq project_list 
+   (exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) 
{
+   $href =~ s,/$,,;
+   $href .= /.esc_path_info($params{'project_filter'})./;
+   delete $params{'project_filter'};
+   delete $params{'action'};
+   }
+
if (defined $params{'project'} 
(exists $params{-path_info} ? $params{-path_info} : $use_pathinfo)) 
{
# try to put as many parameters as possible in PATH_INFO:
-- 
2.1.0.rc0.229.gaee38de


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-push: fix link in man page

2014-07-31 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/git-push.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 21cd455..c0d7403 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -33,7 +33,7 @@ When the command line does not specify what to push with 
`refspec...`
 arguments or `--all`, `--mirror`, `--tags` options, the command finds
 the default `refspec` by consulting `remote.*.push` configuration,
 and if it is not found, honors `push.default` configuration to decide
-what to push (See gitlink:git-config[1] for the meaning of `push.default`).
+what to push (See linkgit:git-config[1] for the meaning of `push.default`).


 OPTIONS[[OPTIONS]]
-- 
2.1.0.rc0.229.gaee38de

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] imap-send: create target mailbox if it is missing

2014-07-31 Thread Tony Finch
Junio C Hamano gits...@pobox.com wrote:

 The basic idea looks good, but I have doubts on one point.

Thanks for spotting the mistake in the error handling. I'll send an update
with a fix.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
South Utsire: Southwesterly 4 or 5, occasionally 6 at first in south, backing
southeasterly later. Moderate. Thundery showers. Good.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] imap-send: create target mailbox if it is missing

2014-07-28 Thread Tony Finch
Some MUAs delete their drafts folder when it is empty, so
git imap-send should be able to create it if necessary.

This change checks that the folder exists immediately after
login and tries to create it if it is missing.

There was some vestigial code to handle a [TRYCREATE] response
from the server when an APPEND target is missing. However this
code never ran (the create and trycreate flags were never set)
and when I tried to make it run I found that the code had already
thrown away the contents of the message it was trying to append.
---
 imap-send.c | 56 +---
 1 file changed, 25 insertions(+), 31 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 524fbab..5e4a24e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -128,7 +128,6 @@ struct imap_cmd_cb {
char *data;
int dlen;
int uid;
-   unsigned create:1, trycreate:1;
 };

 struct imap_cmd {
@@ -714,8 +713,8 @@ static int parse_response_code(struct imap_store *ctx, 
struct imap_cmd_cb *cb,
 static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
 {
struct imap *imap = ctx-imap;
-   struct imap_cmd *cmdp, **pcmdp, *ncmdp;
-   char *cmd, *arg, *arg1, *p;
+   struct imap_cmd *cmdp, **pcmdp;
+   char *cmd, *arg, *arg1;
int n, resp, resp2, tag;

for (;;) {
@@ -801,30 +800,9 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
if (!strcmp(OK, arg))
resp = DRV_OK;
else {
-   if (!strcmp(NO, arg)) {
-   if (cmdp-cb.create  cmd  
(cmdp-cb.trycreate || !memcmp(cmd, [TRYCREATE], 11))) { /* SELECT, APPEND or 
UID COPY */
-   p = strchr(cmdp-cmd, '');
-   if (!issue_imap_cmd(ctx, NULL, 
CREATE \%.*s\, (int)(strchr(p + 1, '') - p + 1), p)) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   /* not waiting here violates 
the spec, but a server that does not
-  grok this nonetheless 
violates it too. */
-   cmdp-cb.create = 0;
-   if (!(ncmdp = 
issue_imap_cmd(ctx, cmdp-cb, %s, cmdp-cmd))) {
-   resp = RESP_BAD;
-   goto normal;
-   }
-   free(cmdp-cmd);
-   free(cmdp);
-   if (!tcmd)
-   return 0;   /* 
ignored */
-   if (cmdp == tcmd)
-   tcmd = ncmdp;
-   continue;
-   }
+   if (!strcmp(NO, arg))
resp = RESP_NO;
-   } else /*if (!strcmp(BAD, arg))*/
+   else /*if (!strcmp(BAD, arg))*/
resp = RESP_BAD;
fprintf(stderr, IMAP command '%s' returned 
response (%s) - %s\n,
 memcmp(cmdp-cmd, LOGIN, 5) ?
@@ -833,7 +811,6 @@ static int get_cmd_result(struct imap_store *ctx, struct 
imap_cmd *tcmd)
}
if ((resp2 = parse_response_code(ctx, cmdp-cb, cmd)) 
 resp)
resp = resp2;
-   normal:
if (cmdp-cb.done)
cmdp-cb.done(ctx, cmdp, resp);
free(cmdp-cb.data);
@@ -944,7 +921,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct 
imap_cmd *cmd, const cha
return 0;
 }

-static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
+static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char 
*folder)
 {
struct credential cred = CREDENTIAL_INIT;
struct imap_store *ctx;
@@ -1156,6 +1133,25 @@ static struct imap_store *imap_open_store(struct 
imap_server_conf *srvc)
credential_approve(cred);
credential_clear(cred);

+   /* check the target mailbox exists */
+   ctx-name = folder;
+   switch (imap_exec(ctx, NULL, EXAMINE \%s\, ctx-name)) {
+   case RESP_OK:
+   /* ok */
+   break;
+   case RESP_BAD:
+   fprintf(stderr, IMAP error: could not 

[PATCH] imap-send: clarify CRAM-MD5 vs LOGIN documentation

2014-07-28 Thread Tony Finch
Explicitly mention that leaving imap.authMethod unset makes
git imap-send use the basic IMAP plaintext LOGIN command.
---
 Documentation/git-imap-send.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index 875d283..770cbe8 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -76,7 +76,8 @@ imap.preformattedHTML::

 imap.authMethod::
Specify authenticate method for authentication with IMAP server.
-   Current supported method is 'CRAM-MD5' only.
+   Current supported method is 'CRAM-MD5' only. If this is not set
+   then 'git imap-send' uses the basic IMAP plaintext LOGIN command.

 Examples
 
-- 
2.0.3.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] imap-send: clarify CRAM-MD5 vs LOGIN documentation

2014-07-28 Thread Tony Finch
Explicitly mention that leaving imap.authMethod unset makes
git imap-send use the basic IMAP plaintext LOGIN command.
---
 Documentation/git-imap-send.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index 875d283..770cbe8 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -76,7 +76,8 @@ imap.preformattedHTML::

 imap.authMethod::
Specify authenticate method for authentication with IMAP server.
-   Current supported method is 'CRAM-MD5' only.
+   Current supported method is 'CRAM-MD5' only. If this is not set
+   then 'git imap-send' uses the basic IMAP plaintext LOGIN command.

 Examples
 
-- 
2.0.3.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitweb: Avoid overflowing page body frame with large images

2014-02-07 Thread Tony Finch
Andrew Keller and...@kellerfarm.com wrote:

 With that said, I don't think it's unreasonable for a software project
 to contain images larger than a browser window.  And, when that happens,
 I'm pretty confident that the default behavior should be to scale the
 image down so the user can see the whole thing.

Right. And if you want to see the unscaled version of the image you can
view the blob_plain version instead of the (scaled html-wrapped) blob.

Seems sensible in principle to me but I have not reviewed the code.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: A workflow for local patch maintenance

2013-10-10 Thread Tony Finch
Jeff King p...@peff.net wrote:

 Do you need to keep the modifications you make on top of upstream as a
 nice, clean series of rebased patches? If not, then you can avoid the
 repeated rebasing, and just use a more traditional topic-branch
 workflow. Treat modifications from upstream as just another topic.

Thanks for the suggestion!

Our aim is to get as many patches into the upstream version as we can,
which is why my starting point is a clean rebased patch series. I am also
thinking that this will help me to know when a patch can be dropped from
the series because upstream have incorporated something like it. If
upstream works like git upstream (incorporating patches verbatim after
they pass review) then git can handle this automatically, but if the patch
gets re-worked it might be easier for me to drop it when rebasing rather
than resolve conflicts. I'm also thinking that for packages which we
update relatively infrequently, having a clean patch series makes it
easier to review whether they are all still necessary when updating. But
perhaps I am too wedded to manual patch management...

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


A workflow for local patch maintenance

2013-10-08 Thread Tony Finch
This is a copy of an article I published at
http://fanf.livejournal.com/128282.html
I'm sending a copy here because I'm interested to know what other ways
there might be of handling this situation.

--

We often need to patch the software that we run in order to fix bugs
quickly rather than wait for an official release, or to add functionality
that we need. In many cases we have to maintain a locally-developed patch
for a significant length of time, across multiple upstream releases,
either because it is not yet ready for incorporation into a stable
upstream version, or because it is too specific to our setup so will not
be suitable for passing upstream without significant extra work.

I have been experimenting with a git workflow in which I have a feature
branch per patch. (Usually there is only one patch for each change we
make.) To move them on to a new feature release, I tag the feature branch
heads (to preserve history), rebase them onto the new release version, and
octopus merge them to create a new deployment version. This is rather
unsatisfactory, because there is a lot of tedious per-branch work, and I
would prefer to have branches recording the development of our patches
rather than a series of tags.

Here is a git workflow suggested by Ian Jackson which I am trying out
instead. I don't yet have much experience with it; I am writing it down
now as a form of documentation.

There are three branches:

upstream, which is where public releases live
working, which is where development happens
deployment, which is what we run

Which branch corresponds to upstream may change over time, for instance
when we move from one stable version to the next one.

The working branch exists on the developer's workstation and is not
normally published. There might be multiple working branches for
work-in-progress. They get rebased a lot.

Starting from an upstream version, a working branch will have a number of
mature patches. The developer works on top of these in
commit-early-commit-often mode, without worrying about order of changes or
cleanliness. Every so often we use git rebase --interactive to tidy up the
patch set. Often we'll use the squash command to combine new commits
with the mature patches that they amend. Sometimes it will be rebased onto
a new upstream version.

When the working branch is ready, we use the commands below to update the
deployment branch. The aim is to make it look like updates from the
working branch are repeatedly merged into the deployment branch. This is
so that we can push updated versions of the patch set to a server without
having to use --force, and pulling updates into a checked out version is
just a fast-forward. However this isn't a normal merge since the tree at
the head of deployment always matches the most recent good version of
working. (This is similar to what stg publish does.) Diagramatically,

 |
1.1
 | \
 |  `A---B-- 1.1-patched
 |\   |
 | \  |
 |  `C-- 1.1-revised
 ||
2.0   |
 | \  |
 |  `-C--D-- 2.0-patched
 ||
3.1   |
 | \  |
 |  `-C--E-- 3.1-patched
 ||
  upstream|
  deployment

The horizontal-ish lines are different rebased versions of the patch set.
Letters represent patches and numbers represent version tags. The tags on
the deployment branch are for the install scripts so I probably won't need
one on every update.

Ideally we would be able to do this with the following commands:

$ git checkout deployment
$ git merge -s theirs working

However there is an ours merge strategy but not a theirs merge
strategy. Johannes Sixt described how to simulate git merge -s theirs in a
post to the git mailing list in 2010.
http://article.gmane.org/gmane.comp.version-control.git/163631
So the commands are:

$ git checkout deployment
$ git merge --no-commit -s ours working
$ git read-tree -m -u working
$ git commit -m Update to $(git describe working)

Mark Wooding suggested the following more plumbing-based version, which
unlike the above does not involve switching to the deployment branch.

$ d=$(git rev-parse deployment)
$ w=$(git rev-parse working)
$ c=$(echo Update to $(git describe working) |
  git commit-tree -p $d -p $w working^{tree})
$ git update-ref deployment $c $d
$ unset c d w

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/4] gitweb: vertically centre contents of page footer

2013-08-21 Thread Tony Finch
Junio C Hamano gits...@pobox.com wrote:
 Tony Finch d...@dotat.at writes:

   div.page_footer {
  -   height: 17px;
  +   height: 22px;
  padding: 4px 8px;
  background-color: #d9d8d1;
   }
 
   div.page_footer_text {
  +   line-height: 22px;
  float: left;
  color: #55;
  font-style: italic;

 Hmmm, is it a good idea to do px here, or are they ways to do
 relative to x-height or something to make sure the text fits?

Good question. I also don't know much about css. I basically followed the
style that was already there, and found out about vertical centering using
line-height by searching the web.

I think font-size relative scaling would require a bigger overhaul.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/4] gitweb: omit the repository owner when it is unset

2013-08-20 Thread Tony Finch
On the repository summary page, leave the owner line out if the
repo does not have an owner, rather than displaying a labelled empty
field. This does not affect the owner column in the projects list
page, which is present unless $omit_owner is true.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..c029b98 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6463,7 +6463,7 @@ sub git_summary {
print div class=\title\nbsp;/div\n;
print table class=\projects_list\\n .
  tr id=\metadata_desc\tddescription/tdtd . 
esc_html($descr) . /td/tr\n;
-unless ($omit_owner) {
+if ($owner and not $omit_owner) {
print  tr id=\metadata_owner\tdowner/tdtd . 
esc_html($owner) . /td/tr\n;
 }
if (defined $cd{'rfc2822'}) {
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/4] gitweb: Ensure OPML text fits inside its box.

2013-08-20 Thread Tony Finch
The rss_logo CSS style has a fixed width which is too narrow for
the string OPML. Replace the fixed width with horizontal padding
so the text fits with nice margins.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/static/gitweb.css | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index cb86d2d..a869be1 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -548,8 +548,7 @@ a.linenr {
 
 a.rss_logo {
float: right;
-   padding: 3px 0px;
-   width: 35px;
+   padding: 3px 5px;
line-height: 10px;
border: 1px solid;
border-color: #fcc7a5 #7d3302 #3e1a01 #ff954e;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 4/4] gitweb: make search help link less ugly

2013-08-20 Thread Tony Finch
The search help link was a superscript question mark right next to
a drop-down menu, which looks misaligned and is a cramped and
awkward click target. Remove the superscript tags and add some
spacing to fix these nits. Add a title attribute to provide an
explanatory mouseover.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..59af7de 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4030,8 +4030,8 @@ sub print_search_form {
  $cgi-input({-name=h, -value=$search_hash, -type=hidden}) 
. \n .
  $cgi-popup_menu(-name = 'st', -default = 'commit',
   -values = ['commit', 'grep', 'author', 
'committer', 'pickaxe']) .
- $cgi-sup($cgi-a({-href = href(action=search_help)}, ?)) .
-  search:\n,
+   . $cgi-a({-href = href(action=search_help),
+-title = search help }, ?) .  search:\n,
  $cgi-textfield(-name = s, -value = $searchtext, -override = 
1) . \n .
  span title=\Extended regular expression\ .
  $cgi-checkbox(-name = 'sr', -value = 1, -label = 're',
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/4] gitweb: vertically centre contents of page footer

2013-08-20 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/static/gitweb.css | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index a869be1..3b4d833 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -68,12 +68,13 @@ div.page_path {
 }
 
 div.page_footer {
-   height: 17px;
+   height: 22px;
padding: 4px 8px;
background-color: #d9d8d1;
 }
 
 div.page_footer_text {
+   line-height: 22px;
float: left;
color: #55;
font-style: italic;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/4] Four small gitweb tweaks

2013-08-20 Thread Tony Finch
This is mostly just a repost to un-stall this topic.

I have fixed the tab damage problem spotted by Jakub in the search
help link patch, and I have improved the commit message for the
repository owner patch. No other changes.

Tony Finch (4):
  gitweb: Ensure OPML text fits inside its box.
  gitweb: vertically centre contents of page footer
  gitweb: omit the repository owner when it is unset
  gitweb: make search help link less ugly

 gitweb/gitweb.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] gitweb: make search help link less ugly

2013-08-05 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

  -  -values = ['commit', 'grep', 'author', 
  'committer', 'pickaxe']) .
  +  -values = ['commit', 'grep', 'author', 
  'committer', 'pickaxe']) .

 Nb. what changed here (in line above)?

Whoops, tab damage. I will re-roll. Thanks for the review.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

Re: [PATCH 3/4] gitweb: omit the repository owner when it is unset

2013-08-05 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:
 On Tue, Jul 2, 2013 at 6:24 PM, Tony Finch d...@dotat.at wrote:

  On the repository summary page, leave the whole owner line out if
  the repo does not have an owner, rather than displaying a labelled
  empty field..

 Note that if $omit_owner is true, whole _column_ is skipped.

There are two places where the owner is displayed: on the list of
projects, and on each project's summary page. This change affects the
summary page (where it removes a row, not a column) and it leaves the
projects list alone. I'll make that clearer in the commit message (and fix
the extraneous dot).

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

git-http-backend vs gitweb pathinfo mode

2013-08-05 Thread Tony Finch
Background:

You cam make the same URL work for gitwe and git clone as described in
git-http-backend(1). It says:

   To serve gitweb at the same url, use a ScriptAliasMatch to only
   those URLs that git http-backend can handle, and forward the rest
   to gitweb:

   ScriptAliasMatch \
   (?x)^/git/(.*/(HEAD | \
   info/refs | \
   objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
   git-(upload|receive)-pack))$ \
   /usr/libexec/git-core/git-http-backend/$1

   ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/

Gitweb has a friendly URL mode that uses pathinfo instead of query
parameters.

Problem:

In pathinfo mode, gitweb sometimes produces URLs ending in /HEAD which
match the git-http-backend regex and therefore get passed to the wrong
CGI.

For example, go to https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree
and click on the gitweb subdirectory which takes you to
https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD:/gitweb
then click on [git/git.git] to go back, which takes you to
https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD

Half-arsed solution:

I have amended the regex to start like

   (?x)^/git/(.*/((?=[.]git/)HEAD | \

which solves the problem for me since all my repos have names ending in
.git and this doesn't clash with any gitweb action names. I don't think
this is a general solution because some people like bare extensionless
repo names. On the other hand I don't think the regex should list all the
dozens of gitweb action names. So I'm not sure what the best fix is.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git-http-backend vs gitweb pathinfo mode

2013-08-05 Thread Tony Finch
Tony Finch d...@dotat.at wrote:

 For example, go to https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree
 and click on the gitweb subdirectory which takes you to
 https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD:/gitweb
 then click on [git/git.git] to go back, which takes you to
 https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD

Whoops, those are the internal not the external URLs... try:

   https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree
- https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree/HEAD:/gitweb
- https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree/HEAD

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitweb: Ensure OPML text fits inside its box.

2013-07-15 Thread Tony Finch
Jonathan Nieder jrnie...@gmail.com wrote:

 Sounds sensible.  Can we have your sign-off?  (Likewise for the next
 patch.)

Doh! Thanks for looking at the patches. I'll post revised versions, plus a
couple more tweaks.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] gitweb: vertically centre contents of page footer

2013-07-15 Thread Tony Finch
Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/static/gitweb.css | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index a869be1..3b4d833 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -68,12 +68,13 @@ div.page_path {
 }
 
 div.page_footer {
-   height: 17px;
+   height: 22px;
padding: 4px 8px;
background-color: #d9d8d1;
 }
 
 div.page_footer_text {
+   line-height: 22px;
float: left;
color: #55;
font-style: italic;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] gitweb: make search help link less ugly

2013-07-15 Thread Tony Finch
The search help link was a superscript question mark right next to
a drop-down menu, which looks misaligned and is a cramped and
awkward click target. Remove the superscript tags and add some
spacing to fix these nits. Add a title attribute to provide an
explanatory mouseover.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c029b98..874c948 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4029,9 +4029,9 @@ sub print_search_form {
  $cgi-input({-name=a, -value=search, -type=hidden}) . 
\n .
  $cgi-input({-name=h, -value=$search_hash, -type=hidden}) 
. \n .
  $cgi-popup_menu(-name = 'st', -default = 'commit',
-  -values = ['commit', 'grep', 'author', 
'committer', 'pickaxe']) .
- $cgi-sup($cgi-a({-href = href(action=search_help)}, ?)) .
-  search:\n,
+  -values = ['commit', 'grep', 'author', 
'committer', 'pickaxe']) .
+   . $cgi-a({-href = href(action=search_help),
+-title = search help }, ?) .  search:\n,
  $cgi-textfield(-name = s, -value = $searchtext, -override = 
1) . \n .
  span title=\Extended regular expression\ .
  $cgi-checkbox(-name = 'sr', -value = 1, -label = 're',
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] gitweb: omit the repository owner when it is unset

2013-07-15 Thread Tony Finch
On the repository summary page, leave the whole owner line out if
the repo does not have an owner, rather than displaying a labelled
empty field..

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/gitweb.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..c029b98 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6463,7 +6463,7 @@ sub git_summary {
print div class=\title\nbsp;/div\n;
print table class=\projects_list\\n .
  tr id=\metadata_desc\tddescription/tdtd . 
esc_html($descr) . /td/tr\n;
-unless ($omit_owner) {
+if ($owner and not $omit_owner) {
print  tr id=\metadata_owner\tdowner/tdtd . 
esc_html($owner) . /td/tr\n;
 }
if (defined $cd{'rfc2822'}) {
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] gitweb: Ensure OPML text fits inside its box.

2013-07-15 Thread Tony Finch
The rss_logo CSS style has a fixed width which is too narrow for
the string OPML. Replace the fixed width with horizontal padding
so the text fits with nice margins.

Signed-off-by: Tony Finch d...@dotat.at
---
 gitweb/static/gitweb.css | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index cb86d2d..a869be1 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -548,8 +548,7 @@ a.linenr {
 
 a.rss_logo {
float: right;
-   padding: 3px 0px;
-   width: 35px;
+   padding: 3px 5px;
line-height: 10px;
border: 1px solid;
border-color: #fcc7a5 #7d3302 #3e1a01 #ff954e;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gitweb: Ensure OPML text fits inside its box.

2013-07-09 Thread Tony Finch
The rss_logo CSS style has a fixed width which is too narrow for
the string OPML. Replace the fixed width with horizontal padding
so the text fits with nice margins.
---

For before/after examples, see http://dotat.at/cgi/git (overflow)
and https://git.csx.cam.ac.uk/x/ucs/ (padded).

 gitweb/static/gitweb.css | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index cb86d2d..a869be1 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -548,8 +548,7 @@ a.linenr {
 
 a.rss_logo {
float: right;
-   padding: 3px 0px;
-   width: 35px;
+   padding: 3px 5px;
line-height: 10px;
border: 1px solid;
border-color: #fcc7a5 #7d3302 #3e1a01 #ff954e;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gitweb: vertically centre contents of page footer

2013-07-09 Thread Tony Finch
---
 gitweb/static/gitweb.css | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index a869be1..3b4d833 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -68,12 +68,13 @@ div.page_path {
 }
 
 div.page_footer {
-   height: 17px;
+   height: 22px;
padding: 4px 8px;
background-color: #d9d8d1;
 }
 
 div.page_footer_text {
+   line-height: 22px;
float: left;
color: #55;
font-style: italic;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:
 On Wed, Jul 3, 2013 at 11:59 PM, Jonathan Nieder jrnie...@gmail.com wrote:
  Tony Finch wrote:

  +@extra_breadcrumbs::
  + Additional links to be added to the start of the breadcrumb trail,
  + that are logically above the gitweb projects list. For example,
  + links to the organization and department which host the gitweb
  + server. Each element of the list is a reference to an array,
  + in which element 0 is the link text and element 1 is the
  + target URL.
 
  Is arbitrary HTML permitted in the link text?

I had the same question when I was wondering about abusing $home_link_str
to do this without a patch :-)

  I think it makes sense to permit it for consistency with $home_link_str,
  but it might be worth mentioning in the manpage so the administrator
  knows not to set it to something user-controlled --- e.g.:

I left this detail out of the man page for consistency with the
documentation for $home_link_str.

 Nb. it would be nice to have relation of @extra_breadcrumbs with
 $home_link_str explained.

I will make that clearer.

Thanks for reviewing the patch.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

[PATCH v2] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
There are often parent pages logically above the gitweb projects
list, e.g. home pages of the organization and department that host
the gitweb server. This change allows you to include links to those
pages in gitweb's breadcrumb trail.

Signed-off-by: Tony Finch d...@dotat.at
Reviewed-by: Jonathan Nieder jrnie...@gmail.com
---

This update includes the documentation improvements suggested by
Jonathan Nieder and Jakub Narębski.

 Documentation/gitweb.conf.txt | 22 --
 gitweb/gitweb.perl|  6 ++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index ea0526e..305db63 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -336,8 +336,26 @@ $home_link_str::
used as the first component of gitweb's breadcrumb trail:
`home link / project / action`.  Can be set at build time using
the `GITWEB_HOME_LINK_STR` variable.  By default it is set to 
projects,
-   as this link leads to the list of projects.  Other popular choice it to
-   set it to the name of site.
+   as this link leads to the list of projects.  Another popular choice is 
to
+   set it to the name of site.  Note that it is treated as raw HTML so it
+   should not be set from untrusted sources.
+
+@extra_breadcrumbs::
+   Additional links to be added to the start of the breadcrumb trail before
+   the home link, to pages that are logically above the gitweb projects
+   list, such as the organization and department which host the gitweb
+   server. Each element of the list is a reference to an array, in which
+   element 0 is the link text (equivalent to `$home_link_str`) and element
+   1 is the target URL (equivalent to `$home_link`).
++
+For example, the following setting produces a breadcrumb trail like
+home / dev / projects / ... where projects is the home link.
+
+our @extra_breadcrumbs = (
+  [ 'home' = 'https://www.example.org/' ],
+  [ 'dev'  = 'https://dev.example.org/' ],
+);
+
 
 $logo_url::
 $logo_label::
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..436f17a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -85,6 +85,9 @@ our $project_maxdepth = ++GITWEB_PROJECT_MAXDEPTH++;
 # string of the home link on top of all pages
 our $home_link_str = ++GITWEB_HOME_LINK_STR++;
 
+# extra breadcrumbs preceding the home link
+our @extra_breadcrumbs = ();
+
 # name of your site or organization to appear in page titles
 # replace this with something more descriptive for clearer bookmarks
 our $site_name = ++GITWEB_SITENAME++
@@ -3982,6 +3985,9 @@ sub print_nav_breadcrumbs_path {
 sub print_nav_breadcrumbs {
my %opts = @_;
 
+   for my $crumb (@extra_breadcrumbs) {
+   print $cgi-a({-href = esc_url($crumb-[1])}, $crumb-[0]) .  
/ ;
+   }
print $cgi-a({-href = esc_url($home_link)}, $home_link_str) .  / ;
if (defined $project) {
my @dirname = split '/', $project;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

 It would be better to improve documentation, than follow current bad
 practice... ;-P

The v2 patch does just that :-)

 Perhaps even make ( [ $home_link_str, $home_link ] ) to be default
 value for @extra_breadcrumbs, making new feature generalization
 of $home_link*, similarly to how it was done for $stylesheet - @stylesheets
 transition.

I don't think that's a win. There's a lot of existing gitweb.conf out
there which sets $home_link_str, so the code would have to either print
the last element of @extra_breadcrumbs or the $home_link variables
depending on whether the variables were modified. And the documentation
would have to explain this complicated arrangement.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

Re: [PATCH] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

 First, do I understand corrctly that @extra_breadcrumbs are rendered *after*
 $home_link*, and in exactly the same manner?

Before the home link, and yes, in the same manner. The extra breadcrumbs
are for links to parent pages above gitweb in some hierarchy.

 But now I think that we can do better, simply put $home_link_str and 
 $home_link
 in @extra_breadcrumbs / @top_level_breadcrumbs / @nav_breadcrumbs before
 using it,

We could save a line that way:

-   print $cgi-a({-href = esc_url($home_link)}, $home_link_str) .  / ;
+   for my $crumb (@extra_breadcrumbs, [ $home_link_str = $home_link ]) {
+   print $cgi-a({-href = esc_url($crumb-[1])}, $crumb-[0]) .  
/ ;
+   }

 P.S. It is a bit late, but wouldn't { name = $link_name, href = $link_url }
 (like %features hash) be a better solution than [ $link_name, $link_url ],
 i.e. hashref (named parameters) instead of arrayref (positional parameters).
 You wouldn't have to remember which is first: text or URL.

I thought the fat arrow would be mnemonic enough, and less verbose.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

Re: [PATCH] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
Jakub Narębski jna...@gmail.com wrote:

 In what situation do you need those extra breadcrumbs useful? What
 necessity / itch to scratch is behind idea of this patch?

For an example, see https://git.csx.cam.ac.uk/x/ucs/git/git.git

I have three items in @extra_breadcrumbs which point to the University
home page, my department home page, and my git server's home page; there
are a number of gitolite accounts on the server each of which has a
project listing which is where gitweb's home link points.

(I expect to change the link texts to make it less confusing when you
happen to be looking at my department's account on the git server...)

our @extra_breadcrumbs = (
  [ cam = 'http://www.cam.ac.uk/'  ],
  [ ucs = 'http://www.ucs.cam.ac.uk/'  ],
  [ git = 'https://git.csx.cam.ac.uk/' ],
);

This is in line with our house style (none of which I have implemented on
this server yet) - there are other examples of similar breadcrumb trails
at https://raven.cam.ac.uk and http://new-webmail.hermes.cam.ac.uk

There is a more generic version of this description and config example in
v2 of my patch. I hope it is clear enough. I'll send a v3 patch with the
code tweak.

Tony.
-- 
f.anthony.n.finch  d...@dotat.at  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

[PATCH v3] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-04 Thread Tony Finch
There are often parent pages logically above the gitweb projects
list, e.g. home pages of the organization and department that host
the gitweb server. This change allows you to include links to those
pages in gitweb's breadcrumb trail.

Signed-off-by: Tony Finch d...@dotat.at
Reviewed-by: Jonathan Nieder jrnie...@gmail.com
---
 Documentation/gitweb.conf.txt | 22 --
 gitweb/gitweb.perl|  7 ++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index ea0526e..305db63 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -336,8 +336,26 @@ $home_link_str::
used as the first component of gitweb's breadcrumb trail:
`home link / project / action`.  Can be set at build time using
the `GITWEB_HOME_LINK_STR` variable.  By default it is set to 
projects,
-   as this link leads to the list of projects.  Other popular choice it to
-   set it to the name of site.
+   as this link leads to the list of projects.  Another popular choice is 
to
+   set it to the name of site.  Note that it is treated as raw HTML so it
+   should not be set from untrusted sources.
+
+@extra_breadcrumbs::
+   Additional links to be added to the start of the breadcrumb trail before
+   the home link, to pages that are logically above the gitweb projects
+   list, such as the organization and department which host the gitweb
+   server. Each element of the list is a reference to an array, in which
+   element 0 is the link text (equivalent to `$home_link_str`) and element
+   1 is the target URL (equivalent to `$home_link`).
++
+For example, the following setting produces a breadcrumb trail like
+home / dev / projects / ... where projects is the home link.
+
+our @extra_breadcrumbs = (
+  [ 'home' = 'https://www.example.org/' ],
+  [ 'dev'  = 'https://dev.example.org/' ],
+);
+
 
 $logo_url::
 $logo_label::
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..f429f75 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -85,6 +85,9 @@ our $project_maxdepth = ++GITWEB_PROJECT_MAXDEPTH++;
 # string of the home link on top of all pages
 our $home_link_str = ++GITWEB_HOME_LINK_STR++;
 
+# extra breadcrumbs preceding the home link
+our @extra_breadcrumbs = ();
+
 # name of your site or organization to appear in page titles
 # replace this with something more descriptive for clearer bookmarks
 our $site_name = ++GITWEB_SITENAME++
@@ -3982,7 +3985,9 @@ sub print_nav_breadcrumbs_path {
 sub print_nav_breadcrumbs {
my %opts = @_;
 
-   print $cgi-a({-href = esc_url($home_link)}, $home_link_str) .  / ;
+   for my $crumb (@extra_breadcrumbs, [ $home_link_str = $home_link ]) {
+   print $cgi-a({-href = esc_url($crumb-[1])}, $crumb-[0]) .  
/ ;
+   }
if (defined $project) {
my @dirname = split '/', $project;
my $projectbasename = pop @dirname;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gitweb: allow extra breadcrumbs to prefix the trail

2013-07-02 Thread Tony Finch
There are often parent pages logically above the gitweb projects
list, e.g. home pages of the organization and department that host
the gitweb server. This change allows you to include links to those
pages in gitweb's breadcrumb trail.

Signed-off-by: Tony Finch d...@dotat.at
---
 Documentation/gitweb.conf.txt | 8 
 gitweb/gitweb.perl| 6 ++
 2 files changed, 14 insertions(+)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index ea0526e..4579578 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -339,6 +339,14 @@ $home_link_str::
as this link leads to the list of projects.  Other popular choice it to
set it to the name of site.
 
+@extra_breadcrumbs::
+   Additional links to be added to the start of the breadcrumb trail,
+   that are logically above the gitweb projects list. For example,
+   links to the organization and department which host the gitweb
+   server. Each element of the list is a reference to an array,
+   in which element 0 is the link text and element 1 is the
+   target URL.
+
 $logo_url::
 $logo_label::
URI and label (title) for the Git logo link (or your site logo,
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d69ada..436f17a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -85,6 +85,9 @@ our $project_maxdepth = ++GITWEB_PROJECT_MAXDEPTH++;
 # string of the home link on top of all pages
 our $home_link_str = ++GITWEB_HOME_LINK_STR++;
 
+# extra breadcrumbs preceding the home link
+our @extra_breadcrumbs = ();
+
 # name of your site or organization to appear in page titles
 # replace this with something more descriptive for clearer bookmarks
 our $site_name = ++GITWEB_SITENAME++
@@ -3982,6 +3985,9 @@ sub print_nav_breadcrumbs_path {
 sub print_nav_breadcrumbs {
my %opts = @_;
 
+   for my $crumb (@extra_breadcrumbs) {
+   print $cgi-a({-href = esc_url($crumb-[1])}, $crumb-[0]) .  
/ ;
+   }
print $cgi-a({-href = esc_url($home_link)}, $home_link_str) .  / ;
if (defined $project) {
my @dirname = split '/', $project;
-- 
1.8.3.1.605.g85318f5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html