summaryrefslogtreecommitdiff
path: root/ident.c
AgeCommit message (Collapse)Author
2007-02-05Rename get_ident() to fmt_ident() and make it available to outsideJunio C Hamano
This makes the functionality of ident.c::get_ident() available to other callers. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-29[PATCH] Rename git-repo-config to git-config.Tom Prince
Signed-off-by: Tom Prince <tom.prince@ualberta.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28Don't force everybody to call setup_ident().Junio C Hamano
Back when only handful commands that created commit and tag were the only users of committer identity information, it made sense to explicitly call setup_ident() to pre-fill the default value from the gecos information. But it is much simpler for programs to make the call automatic when get_ident() is called these days, since many more programs want to use the information when updating the reflog. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-26Allow non-developer to clone, checkout and fetch more easily.Junio C Hamano
The code that uses committer_info() in reflog can barf and die whenever it is asked to update a ref. And I do not think calling ignore_missing_committer_name() upfront like recent receive-pack did in the aplication is a reasonable workaround. What the patch does. - git_committer_info() takes one parameter. It used to be "if this is true, then die() if the name is not available due to bad GECOS, otherwise issue a warning once but leave the name empty". The reason was because we wanted to prevent bad commits from being made by git-commit-tree (and its callers). The value 0 is only used by "git var -l". Now it takes -1, 0 or 1. When set to -1, it does not complain but uses the pw->pw_name when name is not available. Existing 0 and 1 values mean the same thing as they used to mean before. 0 means issue warnings and leave it empty, 1 means barf and die. - ignore_missing_committer_name() and its existing caller (receive-pack, to set the reflog) have been removed. - git-format-patch, to come up with the phoney message ID when asked to thread, now passes -1 to git_committer_info(). This codepath uses only the e-mail part, ignoring the name. It used to barf and die. The other call in the same program when asked to add signed-off-by line based on committer identity still passes 1 to make sure it barfs instead of adding a bogus s-o-b line. - log_ref_write in refs.c, to come up with the name to record who initiated the ref update in the reflog, passes -1. It used to barf and die. The last change means that git-update-ref, git-branch, and commit walker backends can now be used in a repository with reflog by somebody who does not have the user identity required to make a commit. They all used to barf and die. I've run tests and all of them seem to pass, and also tried "git clone" as a user whose GECOS is empty -- git clone works again now (it was broken when reflog was enabled by default). But this definitely needs extra sets of eyeballs. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20simplify inclusion of system header files.Junio C Hamano
This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-17Default GIT_COMMITTER_NAME to login name in recieve-pack.Shawn O. Pearce
If GIT_COMMITTER_NAME is not available in receive-pack but reflogs are enabled we would normally die out with an error message asking the user to correct their environment settings. Now that reflogs are enabled by default in (what we guessed to be) non-bare Git repositories this may cause problems for some users who don't have their full name in the gecos field and who don't have access to the remote system to correct the problem. So rather than die()'ing out in receive-pack when we try to log a ref change and have no committer name we default to the username, as obtained from the host's password database. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-29ident.c: Trim hint printed when gecos is empty.Han-Wen Nienhuys
Also remove asterisks for readability, and suggest use of git-config for easy cut & pasting. Signed-off-by: Han-Wen Nienhuys <hanwen@xs4all.nl> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25Rename safe_strncpy() to strlcpy().Peter Eriksen
This cleans up the use of safe_strncpy() even more. Since it has the same semantics as strlcpy() use this name instead. Also move the definition from inside path.c to its own file compat/strlcpy.c, and use it conditionally at compile time, since some platforms already has strlcpy(). It's included in the same way as compat/setenv.c. Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-17Implement safe_strncpy() as strlcpy() and use it more.Peter Eriksen
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-19Delay "empty ident" errors until they really matter.Junio C Hamano
Previous one warned people upfront to encourage fixing their environment early, but some people just use repositories and git tools read-only without making any changes, and in such a case there is not much point insisting on them having a usable ident. This round attempts to move the error until either "git-var" asks for the ident explicitly or "commit-tree" wants to use it. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18Make "empty ident" error message a bit more helpful.Junio C Hamano
It appears that some people who did not care about having bogus names in their own commit messages are bitten by the recent change to require a sane environment [*1*]. While it was a good idea to prevent people from using bogus names to create commits and doing sign-offs, the error message is not very informative. This patch attempts to warn things upfront and hint people how to fix their environments. [Footnote] *1* The thread is this one. http://marc.theaimsgroup.com/?t=113868084800004 Especially this message. http://marc.theaimsgroup.com/?m=113932830015032 Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-09Do not allow empty name or email.Junio C Hamano
Instead of silently allowing to create a bogus commit that lacks information by mistake, complain loudly and die. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-29code comments: spellJunio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22git-var: constness and globalness cleanup.Junio C Hamano
var.c::git_var read function did not have to return writable strings; make it and the functions it points at return const char * instead. ident.c::get_ident() did not need to be global, so make it static. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-21Use sensible domain name (the DNS one) when guessing ident informationPetr Baudis
Currently, the code would use getdomainname() call, which however returns something usually unset and not necessarily related at all to the DNS domain name (it seems to be mostly some scary NIS/YP thing). This patch changes the code to actually use the DNS domain name, which is also what tends to be used in emails, and we aim at emails with our ident code. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18Remove unused include.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15Unlocalized isspace and friendsLinus Torvalds
Do our own ctype.h, just to get the sane semantics: we want locale-independence, _and_ we want the right signed behaviour. Plus we only use a very small subset of ctype.h anyway (isspace, isalpha, isdigit and isalnum). Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-12Use git config file for committer name and email infoLinus Torvalds
This starts using the "user.name" and "user.email" config variables if they exist as the default name and email when committing. This means that you don't have to use the GIT_COMMITTER_EMAIL environment variable to override your email - you can just edit the config file instead. The patch looks bigger than it is because it makes the default name and email information non-static and renames it appropriately. And it moves the common git environment variables into a new library file, so that you can link against libgit.a and get the git environment without having to link in zlib and libcrypt. In short, most of it is renaming and moving, the real change core is just a few new lines in "git_default_config()" that copies the user config values to the new base. It also changes "git-var -l" to list the config variables. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20Use GECOS field a bit better to produce default human readable name.Junio C Hamano
This updates the default human readable name we generate from GECOS field. We assume the "full-name, followed by additional information separated by commas" format, with an & expanding to the capitalized login name. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-17[PATCH] getdomainname should be usable on SunOS with -lnslJunio C Hamano
Jason Riedy suggests that we should be able to use getdomainname if we properly specify which libraries to link. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-09Retire support for old environment variables.Junio C Hamano
We have deprecated the old environment variable names for quite a while and now it's time to remove them. Gone are: SHA1_FILE_DIRECTORIES AUTHOR_DATE AUTHOR_EMAIL AUTHOR_NAME COMMIT_AUTHOR_EMAIL COMMIT_AUTHOR_NAME SHA1_FILE_DIRECTORY Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-08[PATCH] Portability fix for Solaris 10/x86Patrick Mauritz
* getdomainname unavailable there. * needs -lsocket for linkage. * needs __EXTENSIONS__ at the beginning of convert-objects.c [JC: I've done this slightly differently from what Patrick originally sent to the list and dropped the bit that deals with installations that has curl header and library at non-default location. I am resisting the slipperly slope called autoconf.] Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-24Replace C99 array initializers with code.Jason Riedy
The only use of C99 array initializers is in ident.c, so just replace it with initializing code. Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
2005-07-15[PATCH] ident.c: Disambiguate the error messages in setup_identEric W. Biederman
If your user name is too long it is your sysadmin who hates you not your parents! Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> [ Fixed grammar ] Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-15[PATCH] Move git_author_info and git_commiter_info to ident.cEric W. Biederman
Moving these functions allows all of the logic for figuring out what these values are to be shared between programs. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-12Abstract out the "name <email> date" handling of commit-tree.cLinus Torvalds
We'll want to use it for the tagging too.