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@xxxxxxxxx> --- 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