git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Derrick Stolee" <stolee@gmail.com>, "Jeff King" <peff@peff.net>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Bagas Sanjaya" <bagasdotme@gmail.com>,
	"Robert Karszniewicz" <avoidr@posteo.de>,
	"Emily Shaffer" <emilyshaffer@google.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 3/6] daemon doc + code comments: reword "alice" example
Date: Tue, 15 Jun 2021 18:18:00 +0200	[thread overview]
Message-ID: <patch-3.6-30cffc12410-20210615T161330Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.6-00000000000-20210615T161330Z-avarab@gmail.com>

Improve on the "alice" example added in 603968d22b1 (daemon: extend
user-relative path notation., 2006-02-04). I found the previous
version of this documentation a bit confusing, and had to read the
code to see what it was doing.

I think explicitly spelling out that the --user-path option can be
user to provide an infix to stash in-between what we'll resolve
"~user" and the path after that is clearer, especially when coupled
with explicit examples of path resolution.

Finally, the previous documentation didn't mention that `path/foo`
could actually resolve to `path/foo.git`. That's implicitly covered
earlier in the documentation, let's make an explicit reference to that
here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/git-daemon.txt | 13 ++++++++-----
 daemon.c                     | 10 +++++-----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index fdc28c041c7..a109189756d 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -139,11 +139,14 @@ otherwise `stderr`.
 --user-path=<path>::
 	Allow {tilde}user notation to be used in requests.  When
 	specified with no parameter, requests to
-	git://host/{tilde}alice/foo is taken as a request to access
-	'foo' repository in the home directory of user `alice`.
-	If `--user-path=path` is specified, the same request is
-	taken as a request to access `path/foo` repository in
-	the home directory of user `alice`.
+	git://host/{tilde}user/foo is taken as a request to access
+	'foo' repository in the home directory of user `user`.
++
+If `--user-path=infix` is specified, the `infix` is appended to the path
+found with the {tilde}user notation. E.g. a request to access a `some/foo`
+repository (git://host/{tilde}user/some/foo) will resolve to (assuming that
+`$HOME` is `/home`) either `/home/user/infix/some/foo` (or `[...]/foo.git`
+etc., see `--strict-paths` above).
 
 --verbose::
 	Log details about the incoming connections and requested files.
diff --git a/daemon.c b/daemon.c
index 5c4cbad62d0..a939e5ee0e0 100644
--- a/daemon.c
+++ b/daemon.c
@@ -46,8 +46,8 @@ static const char *interpolated_path;
 static int base_path_relaxed;
 
 /* If defined, ~user notation is allowed and the string is inserted
- * after ~user/.  E.g. a request to git://host/~alice/frotz would
- * go to /home/alice/pub_git/frotz with --user-path=pub_git.
+ * after ~user/.  E.g. a request to git://host/~user/frotz would
+ * go to /home/user/pub_git/frotz with --user-path=pub_git.
  */
 static const char *user_path;
 
@@ -188,9 +188,9 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
 			return NULL;
 		}
 		if (*user_path) {
-			/* Got either "~alice" or "~alice/foo";
-			 * rewrite them to "~alice/%s" or
-			 * "~alice/%s/foo".
+			/* Got either "~user" or "~user/foo";
+			 * rewrite them to "~user/%s" or
+			 * "~user/%s/foo".
 			 */
 			int namlen, restlen = strlen(dir);
 			const char *slash = strchr(dir, '/');
-- 
2.32.0.555.g0268d380f7b


  parent reply	other threads:[~2021-06-15 16:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 16:17 [PATCH 0/6] doc: replace "alice" and "bob" examples Ævar Arnfjörð Bjarmason
2021-06-15 16:17 ` [PATCH 1/6] gittutorial doc: replace "alice" and "bob" with "you" and "www-data" Ævar Arnfjörð Bjarmason
2021-06-16  3:43   ` Bagas Sanjaya
2021-06-16  4:50     ` Junio C Hamano
2021-06-16 21:04     ` Felipe Contreras
2021-06-17 20:38     ` Ævar Arnfjörð Bjarmason
2021-06-15 16:17 ` [PATCH 2/6] gitcvs-migration " Ævar Arnfjörð Bjarmason
2021-06-16  4:02   ` Bagas Sanjaya
2021-06-15 16:18 ` Ævar Arnfjörð Bjarmason [this message]
2021-06-15 16:18 ` [PATCH 4/6] fast-import doc: change "bob" in an example to "file.txt" Ævar Arnfjörð Bjarmason
2021-06-15 16:18 ` [PATCH 5/6] doc: replace "alice" and "bob" with "jdoe" and "msmith" Ævar Arnfjörð Bjarmason
2021-06-15 16:18 ` [PATCH 6/6] pack-protocol doc: use "www-data" in place of "alice" Ævar Arnfjörð Bjarmason
2021-06-15 16:46 ` [PATCH 0/6] doc: replace "alice" and "bob" examples Robert P. J. Day
2021-06-15 18:45   ` Ævar Arnfjörð Bjarmason
2021-06-15 16:54 ` Felipe Contreras
2021-06-15 19:09   ` Ævar Arnfjörð Bjarmason
2021-06-16 20:56     ` Felipe Contreras
2021-06-17 15:48       ` Phillip Susi
2021-06-17 20:51         ` Ævar Arnfjörð Bjarmason
2021-06-16  1:52 ` Junio C Hamano
2021-06-16  9:30   ` Robert P. J. Day
2021-06-16 12:00     ` Jeff King
2021-06-16 20:59   ` Felipe Contreras
2021-06-16 21:02     ` Randall S. Becker

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=patch-3.6-30cffc12410-20210615T161330Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=avoidr@posteo.de \
    --cc=bagasdotme@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=stolee@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).