git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] daemon doc + code comments: reword "alice" example

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 15, 2021, 16:18 UTC
Message-ID
<patch-3.6-30cffc12410-20210615T161330Z-avarab@gmail.com>
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
Previous: Bagas SanjayaNext: Ævar Arnfjörð Bjarmason
Message 9 of 24 in “doc: replace "alice" and "bob" examples”
  1. 0/6 doc: replace "alice" and "bob" examplesÆvar Arnfjörð Bjarmason, Jun 15, 2021
  2. 1/6 gittutorial doc: replace "alice" and "bob" with "you" and "www-data"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  3. Bagas SanjayaJun 16, 2021
  4. Junio C HamanoJun 16, 2021
  5. Felipe ContrerasJun 16, 2021
  6. Ævar Arnfjörð BjarmasonJun 17, 2021
  7. 2/6 gitcvs-migration doc: replace "alice" and "bob" with "you" and "www-data"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  8. Bagas SanjayaJun 16, 2021
  9. 3/6 daemon doc + code comments: reword "alice" exampleÆvar Arnfjörð Bjarmason, Jun 15, 2021
  10. 4/6 fast-import doc: change "bob" in an example to "file.txt"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  11. 5/6 doc: replace "alice" and "bob" with "jdoe" and "msmith"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  12. 6/6 pack-protocol doc: use "www-data" in place of "alice"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  13. Robert P. J. DayJun 15, 2021
  14. Ævar Arnfjörð BjarmasonJun 15, 2021
  15. Felipe ContrerasJun 15, 2021
  16. Ævar Arnfjörð BjarmasonJun 15, 2021
  17. Felipe ContrerasJun 16, 2021
  18. Phillip SusiJun 17, 2021
  19. Ævar Arnfjörð BjarmasonJun 17, 2021
  20. Junio C HamanoJun 16, 2021
  21. Robert P. J. DayJun 16, 2021
  22. Jeff KingJun 16, 2021
  23. Felipe ContrerasJun 16, 2021
  24. Randall S. BeckerJun 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.