This adds a function for inserting an item in a commit list, a function
for sorting a commit list by date, and a function for progressively
scanning a commit history from most recent to least recent.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Added files were errorneously reported with the - prefix by diff-cache,
obviously leading to great confusion.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This includes the old-style "flat tree" object, and the old broken
date format. Well, enough of the date format to convert the sparse
archive, at least.
We really don't care about atime, and it sucks to dirty the
inode cache just for it.
This is more than a one-liner only because we need to be able to
clear the O_NOATIME flag in case some of the objects are owned
by others (in which case open will return EPERM), and because not
everybody has the O_NOATIME flag.
Here is a SHA1 implementation with the core written in PPC assembly.
On my 2GHz G5, it does 218MB/s, compared to 135MB/s for the openssl
version or 45MB/s for the mozilla version.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This one is about a million times simpler, and much more likely to be
correct too.
Instead of trying to match up a tree object against the index, we just
read in the tree object side-by-side into the index, and just walk the
resulting index file. This was what all the read-tree cleanups were
all getting to.
This one includes the Mozilla SHA1 implementation sent in by Edgar Toernig.
It's dual-licenced under MPL-1.1 or GPL, so in the context of git, we
obviously use the GPL version.
Side note: the Mozilla SHA1 implementation is about twice as fast as the
default openssl one on my G5, but the default openssl one has optimized
x86 assembly language on x86. So choose wisely.
We use that to specify alternative index files, which can be useful
if you want to (for example) generate a temporary index file to do
some specific operation that you don't want to mess with your main
one with.
It defaults to the regular ".git/index" if it hasn't been specified.
This basically makes it trivial to use checkout-cache as a "export as
tree" function. Just read the desired tree into the index, and do a
checkout-cache --prefix=export-dir/ -a
and checkout-cache will "export" the cache into the specified directory.
NOTE! The final "/" is important. The exported name is literally just
prefixed with the specified string, so you can also do something like
checkout-cache --prefix=.merged- Makefile
to check out the currently cached copy of "Makefile" into the file
".merged-Makefile".
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>
Updates read-tree to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with
this patch.
The change involves a slight modification of how it recurses down
the tree. Earlier the caller only supplied SHA1 and the recurser
read the object using it, but now it is the caller's responsibility
to read the object and give it to the recurser. This matches the
way recursive behaviour is done in other tree- related commands.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Updates ls-tree.c to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with
this patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Updates diff-tree.c to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with this patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Updates diff-cache.c to use read_tree_with_tree_or_commit_sha1()
function. The end-user visible result is the same --- the command
takes either tree or commit ID.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch implements read_tree_with_tree_or_commit_sha1(),
which can be used when you are interested in reading an unpacked
raw tree data but you do not know nor care if the SHA1 you
obtained your user is a tree ID or a commit ID. Before this
function's introduction, you would have called read_sha1_file(),
examined its type, parsed it to call read_sha1_file() again if
it is a commit, and verified that the resulting object is a
tree. Instead, this function does that for you. It returns
NULL if the given SHA1 is not either a tree or a commit.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Use a generic rule for executables that depend only on the corresponding
.o and on $(LIB_FILE).
Signed-Off-By: Andre Noll <maan@systemlinux.org>
Signed-Off-By: Linus Torvalds <torvalds@osdl.org>
Normalize init-db environment variable handling, allowing the creation
of object directories with something other than DEFAULT_DB_ENVIRONMENT.
Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Sometimes it's just easier to not have to look up the "commit"->"tree"
translation by hand first. It's trivial to do inside diff-tree, and
it's just being polite.
the current cache state and/or working directory.
Very useful to see what has changed since the last commit, either in
the index file or in the whole working directory.
Also very possibly very buggy. Matching the two up is not entirely
trivial.
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.
as a set of patches and commentary.
You'd want something like this if you are tracking a git archive
in another SCM format. Notably, we want something like that for
BK users.
reading a single tree too. That should speed up a
trivial merge noticeably.
Also, don't bother reading back the tree we just wrote
when we committed a real merge. It had better be the
same one we still have..
Yes, the "parse_commit()" already checks for this condition, but
we need to check for it in rev-tree too, so that we don't start
walking the parent chain unnecessarily.
Doing the latest SCSI merge exposed two bugs in your merge script:
1) It doesn't like a completely new directory (the misc tree contains a
new drivers/scsi/lpfc)
2) the merge testing logic is wrong. You only want to exit 1 if the
merge fails.
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>
Patch 1/6 in the series has already cleaned the interface to
call sq_expand(), but the comment before that function still
carries the stale interface warning. Remove it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>