On Fri, Aug 29, 2008 at 02:29:00AM -0700, Karl Chen wrote:
> core.excludesfile::
> In addition to '.gitignore' (per-directory) and
> '.git/info/exclude', git looks into this file for patterns
> - of files which are not meant to be tracked. See
> + of files which are not meant to be tracked. "~" and "~user"
> + are expanded to the user's home directory. See
> linkgit:gitignore[5].
How about:
A leading "~" or "~user" is expanded to the home directory of the
current user or "user", as in the shell.
Specifically:
1. We obviously handle only leading cases, so /path/to/~file~with~tildes
is ok.
2. It was a little unclear to me whether both "~" and "~user" expande
to the same thing. I.e., can one use this for arbitrary "user" (and
the answer of course is yes).
> +char *expand_user_path(char *buf, const char *path, int bufsz)
> +{
> + if (path == NULL)
> + return NULL;
> +
> + if (path[0] != '~')
> + return concatstr(buf, path, NULL, bufsz);
> +
> + const char *username = path + 1;
> + size_t username_len = strchrnul(username, '/') - username;
> + struct passwd *pw = getpw_str(username, username_len);
Declaration after statement (we try to remain portable to non-C99
systems).
Other than that, I think the patch is fine (though I am not opposed to
the improvements Junio has mentioned).
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
[hidden email]
More majordomo info at
http://vger.kernel.org/majordomo-info.html