Commit Graph

35 Commits

Author SHA1 Message Date
Peter Eriksen
8e44025925 Use blob_, commit_, tag_, and tree_type throughout.
This replaces occurences of "blob", "commit", "tag", and "tree",
where they're really used as type specifiers, which we already
have defined global constants for.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-04 00:11:19 -07:00
Junio C Hamano
7561d9f544 commit-tree: check return value from write_sha1_file()
... found by Matthias Kestenholz.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-24 22:23:25 -08:00
Junio C Hamano
749be728d4 Delay "empty ident" errors until they really matter.
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-18 20:31:05 -08:00
Junio C Hamano
ce1610ead6 call git_config() after setup_git_directory()
If you call setup_git_directory() to work from a subdirectory,
that should be run first before running git_config().  Otherwise
you would not read the configuration file from the correct place.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-09 14:41:39 -08:00
Junio C Hamano
53228a5fb8 Make the rest of commands work from a subdirectory.
These commands are converted to run from a subdirectory.

    commit-tree convert-objects merge-base merge-index mktag
    pack-objects pack-redundant prune-packed read-tree tar-tree
    unpack-file unpack-objects update-server-info write-tree

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 23:13:02 -08:00
Junio C Hamano
5e5f8091e5 Remove unused include.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18 15:41:43 -07:00
Linus Torvalds
4546738b58 Unlocalized isspace and friends
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-14 17:17:27 -07:00
Linus Torvalds
e1b10391ea Use git config file for committer name and email info
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-10-11 18:47:34 -07:00
Petr Baudis
4d1f119033 [PATCH] Unify usage strings declaration
All usage strings are now declared as static const char [].

This is carried over from my old git-pb branch.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-29 17:21:50 -07:00
Eric W. Biederman
d289d13625 [PATCH] Move git_author_info and git_commiter_info to ident.c
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-15 10:00:35 -07:00
Linus Torvalds
6aa33f4035 Abstract out the "name <email> date" handling of commit-tree.c
We'll want to use it for the tagging too.
2005-07-12 11:49:27 -07:00
Linus Torvalds
b389237ae8 git-commit-tree: ignore duplicate parents
But warn about them.  If somebody really ends up later wanting to
explicitly add a note that something has the same parent twice (who
knows, there are strange people around), we can add a flag to say that
it's expected and ok.

This was brought on by a commit in the kernel tree, where a repeated
merge caused a duplicate parent.

Parent duplicates aren't "wrong" per se, they're just in practice not
something you are ever interested in.
2005-06-19 10:40:10 -07:00
Rene Scharfe
c504aae2a6 [PATCH] fix and testcase for git-commit-tree option
Actually use GIT_COMMITTER_DATE in git-commit-tree.

(It used to mistakenly re-use the author date)

Add test-case for it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 16:21:13 -07:00
Linus Torvalds
c4bd907d95 git-commit-tree: allow overriding of commit date
Using GIT_COMMITTER_DATE, of course..
2005-05-24 10:21:13 -07:00
Linus Torvalds
6b0c312106 Include file cleanups..
Add <limits.h> to the include files handled by "cache.h", and remove
extraneous #include directives from various .c files. The rule is that
"cache.h" gets all the basic stuff, so that we'll have as few system
dependencies as possible.
2005-05-22 11:54:17 -07:00
Alexey Nezhdanov
667bb59b2d [PATCH] cleanup of in-code names
Fixes all in-code names that leaved during "big name change".

Signed-off-by: Alexey Nezhdanov <snake@penza-gsm.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-19 10:52:00 -07:00
Junio C Hamano
d19938ab60 Rename environment variables.
H. Peter Anvin mentioned that using SHA1_whatever as an
environment variable name is not nice and we should instead use
names starting with "GIT_" prefix to avoid conflicts.  Here is
what this patch does:

 * Renames the following environment variables:

    New name                           Old Name

    GIT_AUTHOR_DATE                    AUTHOR_DATE
    GIT_AUTHOR_EMAIL                   AUTHOR_EMAIL
    GIT_AUTHOR_NAME                    AUTHOR_NAME
    GIT_COMMITTER_EMAIL                COMMIT_AUTHOR_EMAIL
    GIT_COMMITTER_NAME                 COMMIT_AUTHOR_NAME
    GIT_ALTERNATE_OBJECT_DIRECTORIES   SHA1_FILE_DIRECTORIES
    GIT_OBJECT_DIRECTORY               SHA1_FILE_DIRECTORY

 * Introduces a compatibility macro, gitenv(), which does an
   getenv() and if it fails calls gitenv_bc(), which in turn
   picks up the value from old name while giving a warning about
   using an old name.

 * Changes all users of the environment variable to fetch
   environment variable with the new name using gitenv().

 * Updates the documentation and scripts shipped with Linus GIT
   distribution.

The transition plan is as follows:

 * We will keep the backward compatibility list used by gitenv()
   for now, so the current scripts and user environments
   continue to work as before.  The users will get warnings when
   they have old name but not new name in their environment to
   the stderr.

 * The Porcelain layers should start using new names.  However,
   just in case it ends up calling old Plumbing layer
   implementation, they should also export old names, taking
   values from the corresponding new names, during the
   transition period.

 * After a transition period, we would drop the compatibility
   support and drop gitenv().  Revert the callers to directly
   call getenv() but keep using the new names.

   The last part is probably optional and the transition
   duration needs to be set to a reasonable value.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-09 17:57:56 -07:00
Linus Torvalds
3c249c9506 Add "get_sha1()" helper function.
This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

	git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.
2005-05-01 16:36:56 -07:00
Edgar Toernig
ecee9d9e79 [PATCH] Do date parsing by hand...
...since everything out there is either strange (libc mktime has issues
with timezones) or introduces unnecessary dependencies for people (libcurl).

This goes back to the old date parsing, but moves it out into a file of
its own, and does the "struct tm" to "seconds since epoch" handling by
hand. 

I grepped through the tz-database and it seems there's one "country"
left that has non-60-minute DST: Lord Howe Island.  All others dropped
that before 1970.
2005-04-30 09:46:49 -07:00
tony.luck@intel.com
d167f147dc [PATCH] Fix AUTHOR_DATE timezone confusion
This switches git-commit-tree to using curl_getdate() for the
AUTHOR_DATE, and thus fixes the problem with "mktime()" parsing dates in
the local timezone.  It also ends up being more permissive about the
format of the date. 

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-29 20:27:04 -07:00
Christopher Li
812666c8e6 [PATCH] introduce xmalloc and xrealloc
Introduce xmalloc and xrealloc to die gracefully with a descriptive
message when out of memory, rather than taking a SIGSEGV. 

Signed-off-by: Christopher Li<chrislgit@chrisli.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-26 12:00:58 -07:00
Linus Torvalds
a44c9a5e2e Simplify "write_sha1_file()" interfaces
The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.
2005-04-25 10:19:53 -07:00
Junio C Hamano
c5bac17ad2 [PATCH] Usage-string fixes.
Usage string fixes to make maintenance easier (only one instance
of a string to update not multiple copies).  I've spotted and
corrected inconsistent usage text in diff-tree while doing this.

Also diff-cache and read-tree usage text have been corrected to
match their up-to-date features.  Earlier, neither "--cached"
form of diff-cache nor "-m single-merge" form of read-tree were
described. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-20 19:49:16 -07:00
Linus Torvalds
b96afa59eb Make us be better at guessing a good hostname for the email.
It's still just a guess, and the result is not a real email
address anyway. If you want to, you can use COMMIT_AUTHOR_EMAIL
to correct for any git guesses.
2005-04-19 15:46:06 -07:00
Greg KH
b70070f020 [PATCH] provide better committer information to commit-tree.c
Here's a small patch to commit-tree.c that does two things:
	- allows the committer email address and name to be overridden
	  by environment variables (if you don't like the environment
	  variable names I've used (COMMIT_AUTHOR_NAME,
	  COMMIT_AUTHOR_EMAIL), feel free to change them.)
	- provide the proper domainname to the author/committer email
	  address (otherwise, my address was only showing up as from the
	  hostname.)

This allows people to set sane values for the commit names and email
addresses, preventing odd, private hostnames and domains from being
exposed to the world.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 17:37:32 -07:00
Brad Roberts
74b2428f55 [PATCH] fork optional branch point normazilation
Fix remove_specials for real.  The second half logic needs the original
head of the string.

Signed-off-by: Brad Roberts <braddr@puremagic.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-17 19:12:14 -07:00
Linus Torvalds
5e5128ed1c Remove extraneous ',' ';' and '.' characters from the full name gecos field.
Apparently some distributions tend to have space for phone numbers etc there.
2005-04-17 16:52:54 -07:00
Linus Torvalds
d0d7cbe730 Make "commit-tree" check the input objects more carefully.
Let's not allow trivially bogus commits. I did one for the first
trial of the first kernel git merge. fsck found it ok, but..
2005-04-17 15:26:13 -07:00
David Woodhouse
27de946d0e [PATCH] Simplify date handling and make it more reliable
This make all dates be stores as seconds since UTC epoch, with the
author's or committer's timezone as auxiliary data so that dates can be
pretty-printed in the original timezone later if anyone cares.  I left
the date parsing in rev-tree.c for backward compatibility but it can be
dropped when we change to base64 :)

commit-tree now eats RFC2822 dates as AUTHOR_DATE because that's
what you're going to want to feed it.

Yes, glibc sucks and strptime is a pile of crap. We have to parse it
ourselves.
2005-04-15 08:39:57 -07:00
Ingo Molnar
aebb267908 [PATCH] Whitespace Fixes
Trivial whitespace fixes.

From: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:35:04 -07:00
Petr Baudis
2de381f919 [PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application"
errors. usage() is now used strictly only for usage errors.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:28:48 -07:00
Linus Torvalds
bf16c71e2f Fix up commit-tree/diff-tree user interface issues.
No, this doesn't make them easy to use, but makes diff-tree use
the "-r" flag for "recursive" (not "-R") and makes commit-tree
use AUTHOR_xxx environment flags (not COMMITTER_xxx) to match what
it actually does.
2005-04-11 08:37:17 -07:00
Linus Torvalds
d6d3f9d012 This implements the new "recursive tree" write-tree.
It's got some debugging printouts etc still in it, but testing on the
kernel seems to show that it does indeed fix the issue with huge tree
files for each commit.
2005-04-09 17:09:34 -07:00
Linus Torvalds
8bc9a0c769 Add copyright notices.
The tool interface sucks (especially "committing" information, which is just
me doing everything by hand from the command line), but I think this is in
theory actually a viable way of describing the world. So copyright it.
2005-04-07 15:16:10 -07:00
Linus Torvalds
e83c516331 Initial revision of "git", the information manager from hell 2005-04-07 15:13:13 -07:00