unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] githttpbackend: allow git to be a regular scalar string
Date: Fri,  1 Jul 2016 01:17:02 +0000	[thread overview]
Message-ID: <20160701011703.16578-2-e@80x24.org> (raw)
In-Reply-To: <20160701011703.16578-1-e@80x24.org>

No point in forcing users to pass a hashref/object to
get a single git directory.
---
 lib/PublicInbox/GitHTTPBackend.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 7267a1d..4f58c6b 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -80,7 +80,7 @@ sub serve_dumb {
 		return r(404);
 	}
 
-	my $f = "$git->{git_dir}/$path";
+	my $f = (ref $git ? $git->{git_dir} : $git) . '/' . $path;
 	return r(404) unless -f $f && -r _; # just in case it's a FIFO :P
 	my @st = stat(_);
 	my $size = $st[7];
@@ -179,7 +179,7 @@ sub serve_smart {
 		my $val = $env->{$name};
 		$env{$name} = $val if defined $val;
 	}
-	my $git_dir = $git->{git_dir};
+	my $git_dir = ref $git ? $git->{git_dir} : $git;
 	$env{GIT_HTTP_EXPORT_ALL} = '1';
 	$env{PATH_TRANSLATED} = "$git_dir/$path";
 	my %rdr = ( 0 => fileno($in) );

  reply	other threads:[~2016-07-01  1:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
2016-07-01  1:17 ` Eric Wong [this message]
2016-07-01  1:17 ` [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm Eric Wong
2016-07-01  2:15 ` [PATCH 3/2] git: allow cloning from the URL root, too Eric Wong
2016-07-01  2:20   ` [PATCH 4/2] www_stream: fix stupid typo :x Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160701011703.16578-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).