All of lore.kernel.org
 help / color / mirror / Atom feed
* git instaweb - share all project files
@ 2013-04-07  3:02 Trenton D. Adams
  2013-04-10 17:03 ` Jakub Narębski
  0 siblings, 1 reply; 6+ messages in thread
From: Trenton D. Adams @ 2013-04-07  3:02 UTC (permalink / raw)
  To: git

Hello,

On that first page that shows up, it shows the .git folder.  It would
be kind of nice if it shared out both the git repo and the actual
current project files.  I frequently have stuff I'd like to see in a
web browser, and even requires one (i.e. Navigating to
file:///home/blah/blah doesn't work; ajax requests for example)

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git instaweb - share all project files
  2013-04-07  3:02 git instaweb - share all project files Trenton D. Adams
@ 2013-04-10 17:03 ` Jakub Narębski
  2013-04-10 22:42   ` Trenton D. Adams
  2013-04-14 10:35   ` Jakub Narębski
  0 siblings, 2 replies; 6+ messages in thread
From: Jakub Narębski @ 2013-04-10 17:03 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: git

W dniu 07.04.2013 05:02, Trenton D. Adams pisze:

> On that first page that shows up, it shows the .git folder.  It would
> be kind of nice if it shared out both the git repo and the actual
> current project files.  I frequently have stuff I'd like to see in a
> web browser, and even requires one (i.e. Navigating to
> file:///home/blah/blah doesn't work; ajax requests for example)

There are a few possible solutions, from simplest to most complicated:

1. Configure gitweb ran by git-instaweb to have 'worktree' link in
   the action bar pointing to 'file:///path/to/repo' (or rather
   'file:///path/to/workdir') via 'actions' feature, adding e.g.

     $feature{'actions'}{'default'} =
     	[('worktree', 'file:///path/to/repo', 'summary')];

   to gitweb_config.perl / gitweb.conf used by git-instaweb's gitweb.

   This of course works only for local use, so either git-instaweb
   or gitweb (in config) should check that we use it locally
   (e.g. if hostname is 'localhost' or equivalent).

2. In the web server configuration generated by git-instaweb, perhaps
   as an option, add serving of worktree (with mod_autoindex aka.
   'Options +Indexes' for Apache2, and equivalent solutions for *all*
   other supported web servers: lighttpd, mongoose, plack, webrick).

   This may require some fiddling with URI rewriting, or change of
   gitweb URI, to be able to have both worktree index and gitweb
   script (gitweb is now under '/'), so it should probably be protected
   by an option to git-instaweb.

3. Add proper support to gitweb: add 'worktree' action (similar to
   'tree' action / view).  Probably needs to be made somewhat
   configurable (and of course enabled in git-instaweb).


Unfortunately solution 1.) which is simplest is not enough for your
situation...

I can add 3.) to my gitweb TODO, but I don't know when I would be able
to get to implementing it.
-- 
Jakub Narębski

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git instaweb - share all project files
  2013-04-10 17:03 ` Jakub Narębski
@ 2013-04-10 22:42   ` Trenton D. Adams
  2013-04-13 15:21     ` Jakub Narębski
  2013-04-14 10:35   ` Jakub Narębski
  1 sibling, 1 reply; 6+ messages in thread
From: Trenton D. Adams @ 2013-04-10 22:42 UTC (permalink / raw)
  To: Jakub Narębski; +Cc: git

#1 would actually work.  Though long term it would be cool to view it
with all the most recent commit information, kind of like github does.
 You know, showing "updated 4 days ago".

On Wed, Apr 10, 2013 at 11:03 AM, Jakub Narębski <jnareb@gmail.com> wrote:
> W dniu 07.04.2013 05:02, Trenton D. Adams pisze:
>
>> On that first page that shows up, it shows the .git folder.  It would
>> be kind of nice if it shared out both the git repo and the actual
>> current project files.  I frequently have stuff I'd like to see in a
>> web browser, and even requires one (i.e. Navigating to
>> file:///home/blah/blah doesn't work; ajax requests for example)
>
> There are a few possible solutions, from simplest to most complicated:
>
> 1. Configure gitweb ran by git-instaweb to have 'worktree' link in
>    the action bar pointing to 'file:///path/to/repo' (or rather
>    'file:///path/to/workdir') via 'actions' feature, adding e.g.
>
>      $feature{'actions'}{'default'} =
>         [('worktree', 'file:///path/to/repo', 'summary')];
>
>    to gitweb_config.perl / gitweb.conf used by git-instaweb's gitweb.
>
>    This of course works only for local use, so either git-instaweb
>    or gitweb (in config) should check that we use it locally
>    (e.g. if hostname is 'localhost' or equivalent).
>
> 2. In the web server configuration generated by git-instaweb, perhaps
>    as an option, add serving of worktree (with mod_autoindex aka.
>    'Options +Indexes' for Apache2, and equivalent solutions for *all*
>    other supported web servers: lighttpd, mongoose, plack, webrick).
>
>    This may require some fiddling with URI rewriting, or change of
>    gitweb URI, to be able to have both worktree index and gitweb
>    script (gitweb is now under '/'), so it should probably be protected
>    by an option to git-instaweb.
>
> 3. Add proper support to gitweb: add 'worktree' action (similar to
>    'tree' action / view).  Probably needs to be made somewhat
>    configurable (and of course enabled in git-instaweb).
>
>
> Unfortunately solution 1.) which is simplest is not enough for your
> situation...
>
> I can add 3.) to my gitweb TODO, but I don't know when I would be able
> to get to implementing it.
> --
> Jakub Narębski
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git instaweb - share all project files
  2013-04-10 22:42   ` Trenton D. Adams
@ 2013-04-13 15:21     ` Jakub Narębski
  2013-04-13 20:02       ` Eric Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narębski @ 2013-04-13 15:21 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: git, Eric Wong

Please do not top-post.

On 11.04.2013, Trenton D. Adams wrote:

> #1 would actually work.  Though long term it would be cool to view it
> with all the most recent commit information, kind of like github does.
>  You know, showing "updated 4 days ago".
> 
> On Wed, Apr 10, 2013 at 11:03 AM, Jakub Narębski <jnareb@gmail.com> wrote:
>> W dniu 07.04.2013 05:02, Trenton D. Adams pisze:
>>
>>> On that first page that shows up, it shows the .git folder.  It would
>>> be kind of nice if it shared out both the git repo and the actual
>>> current project files.  I frequently have stuff I'd like to see in a
>>> web browser, and even requires one (i.e. Navigating to
>>> file:///home/blah/blah doesn't work; ajax requests for example)
>>
>> There are a few possible solutions, from simplest to most complicated:
>>
>> 1. Configure gitweb ran by git-instaweb to have 'worktree' link in
>>    the action bar pointing to 'file:///path/to/repo' (or rather
>>    'file:///path/to/workdir') via 'actions' feature, adding e.g.
>>
>>      $feature{'actions'}{'default'} =
>>         [('worktree', 'file:///path/to/repo', 'summary')];
>>
>>    to gitweb_config.perl / gitweb.conf used by git-instaweb's gitweb.
>>
>>    This of course works only for local use, so either git-instaweb
>>    or gitweb (in config) should check that we use it locally
>>    (e.g. if hostname is 'localhost' or equivalent).
[...]

Unfortunately it turns out such simple solution doesn't really work.

First, for some reason Firefox 20.0 refuses to follow file:/// link,
even though it shows correctly worktree if copy'n'pasted as URL in new
window / new tab.

Second, it would work only for the top git repository.  There can be
repositories being submodules, or in untracked subdirectories (like
e.g. 't/trash directory.tNNNN*/.git' in git/.git), and said 'worktree'
link would always lead to top git repository workdir.

But anyway, here you have it:
-- >8 --
Subject: [PATCH] git-instaweb: Show project files... kind of (WIP)

On first page that git-instaweb shows, it shows the .git folder.  It
would be kind of nice if it shared out both the git repo and the
actual current project files (i.e. current worktree). [...]

[...]

This commit implements solution 1.), with git-instaweb enabling it
only for local use, which means when it is run with `--local` option.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 git-instaweb.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index 01a1b05..43ae255 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -22,6 +22,13 @@ restart        restart the web server
 . git-sh-setup
 
 fqgitdir="$GIT_DIR"
+if test x"$(git rev-parse --is-bare-repository)" = xfalse
+then
+	fqworktree="$(git rev-parse --show-toplevel)"
+else
+	fqworktree=""
+fi
+
 local="$(git config --bool --get instaweb.local)"
 httpd="$(git config --get instaweb.httpd)"
 root="$(git config --get instaweb.gitwebdir)"
@@ -588,6 +595,13 @@ our \$projects_list = \$projectroot;
 
 \$feature{'remote_heads'}{'default'} = [1];
 EOF
+	test x"$fqworktree" != x &&
+	test x"$local" = xtrue &&
+	cat >>"$fqgitdir/gitweb/gitweb_config.perl" <<EOF
+\$feature{'actions'}{'default'} = [
+	('worktree', 'file://$fqworktree', 'summary')
+];
+EOF
 }
 
 configure_httpd() {
-- 
1.8.2.1.367.geafc030.dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: git instaweb - share all project files
  2013-04-13 15:21     ` Jakub Narębski
@ 2013-04-13 20:02       ` Eric Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2013-04-13 20:02 UTC (permalink / raw)
  To: Jakub Narębski; +Cc: Trenton D. Adams, git

Jakub Narębski <jnareb@gmail.com> wrote:
> Unfortunately it turns out such simple solution doesn't really work.
> 
> First, for some reason Firefox 20.0 refuses to follow file:/// link,
> even though it shows correctly worktree if copy'n'pasted as URL in new
> window / new tab.

I can confirm this behavior with chromium on Debian testing
(25.0.1364.160 (Developer Build 186726) Debian 7.0)

I can guess this is likely for security reasons.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git instaweb - share all project files
  2013-04-10 17:03 ` Jakub Narębski
  2013-04-10 22:42   ` Trenton D. Adams
@ 2013-04-14 10:35   ` Jakub Narębski
  1 sibling, 0 replies; 6+ messages in thread
From: Jakub Narębski @ 2013-04-14 10:35 UTC (permalink / raw)
  To: Jakub Narębski; +Cc: Trenton D. Adams, git

W dniu 10.04.2013 19:03, Jakub Narębski pisze:
> W dniu 07.04.2013 05:02, Trenton D. Adams pisze:
> 
>> On that first page that shows up, it shows the .git folder.  It would
>> be kind of nice if it shared out both the git repo and the actual
>> current project files.  I frequently have stuff I'd like to see in a
>> web browser, and even requires one (i.e. Navigating to
>> file:///home/blah/blah doesn't work; ajax requests for example)
> 
> There are a few possible solutions, from simplest to most complicated:
[...]

> 2. In the web server configuration generated by git-instaweb, perhaps
>    as an option, add serving of worktree (with mod_autoindex aka.
>    'Options +Indexes' for Apache2, and equivalent solutions for *all*
>    other supported web servers: lighttpd, mongoose, plack, webrick).
> 
>    This may require some fiddling with URI rewriting, or change of
>    gitweb URI, to be able to have both worktree index and gitweb
>    script (gitweb is now under '/'), so it should probably be protected
>    by an option to git-instaweb.

The trouble (besides writing the same code for 5 web servers) is that
you have to make web server detect whether you want to access workdir or
gitweb from URL alone...

...and still you wouldn't have nice UI integration.

> 3. Add proper support to gitweb: add 'worktree' action (similar to
>    'tree' action / view).  Probably needs to be made somewhat
>    configurable (and of course enabled in git-instaweb).

I wonder if this should be solved via new actions, for example
'worktree' and 'file' (which could also be a solution to problem in 2.)
via URI rewriting), or via new symbolic "hash" name, for example
'WORKTREE' (like 'HEAD').

Hmmm... while at it, perhaps we can add browsing of INDEX version of files?

-- 
Jakub Narębski

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-14 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07  3:02 git instaweb - share all project files Trenton D. Adams
2013-04-10 17:03 ` Jakub Narębski
2013-04-10 22:42   ` Trenton D. Adams
2013-04-13 15:21     ` Jakub Narębski
2013-04-13 20:02       ` Eric Wong
2013-04-14 10:35   ` Jakub Narębski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.