It does not matter if we call prefetch() or set the TO_SCAN flag before
or after adding the object to process_queue. However, doing it before
object_list_insert() allows us to kill 3 lines of duplicated code.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The TO_FETCH flag also became redundant after adding the SEEN flag -
it was set and checked in process() to prevent adding the same object
to process_queue multiple times, but now SEEN guards against this.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
After adding the SEEN flag, the SCANNED flag became obviously
redundant - each object can get into process_queue through process()
only once, and therefore multiple calls to process_object() for the
same object are not possible.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The process() function is very often called multiple times for the
same object (because lots of trees refer to the same blobs), but did
not have a fast check for this, therefore a lot of useless calls to
has_sha1_file() and parse_object() were made before discovering that
nothing needs to be done.
This patch adds the SEEN flag which is used in process() to make it
look at each object only once. When testing git-local-fetch on the
repository of GIT, this gives a 14x improvement in CPU usage (mainly
because the redundant calls to parse_object() are now avoided -
parse_object() always unpacks and parses the object data, even if it
was already parsed before).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
In all places where process() is called except the one in pull() (which
is executed only once) the pointer to the object is already available,
so pass it as the argument to process() instead of sha1 and avoid an
unneeded call to lookup_object_type().
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Randal L. Schwartz noticed that 'make install' does not rebuild what
is installed. Make the 'install' rule depend on 'man'.
I noticed also 'touch' of the source files were used to express include
dependencies, which is a no-no. Rewrite it to do dependencies properly,
and add missing include dependencies while we are at it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Unlike write_sha1_file() that tries to create the object file in a
temporary location and then move it to the final location, fetch_object
could have been interrupted in the middle, leaving a corrupt file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The author of the file we stole from Python 2.4 distribution, Peter
Astrand <astrand@lysator.liu.se>, OK'ed to add this at the end of the
licensing terms section of the file:
Use of this file within git is permitted under GPLv2.
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 089f20dce1 commit)
Linus says that 'of .' to mean the commits came from the local repository
was too confusing and ugly -- I tend to agree with him.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The trick is to consider the time-based filtering a limiter, the same way
we do for release ranges.
That means that the time-based filtering runs _before_ the topological
sorting, which makes it meaningful again. It also simplifies the code
logic.
This makes "gitk" useful with time ranges.
[ Second version: --merge-order now unaffected by the re-org ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This adds the options "--since=date" and "--before=date" to git-rev-parse,
which knows how to translate them into seconds since the epoch for
git-rev-list.
With this, you can do
git log --since="2 weeks ago"
or
git log --until=yesterday
to show the commits that have happened in the last two weeks or are
older than 24 hours, respectively.
The flags "--after=" and "--before" are synonyms for --since and --until,
and you can combine them, so
git log --after="Aug 5" --before="Aug 10"
is a valid (but strange) thing to do.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is my ARM assembly SHA1 implementation for GIT. It is approximately
50% faster than the generic C version. On an XScale processor running at
400MHz:
generic C version: 9.8 MB/s
my version: 14.5 MB/s
It's not that I expect a lot of big GIT users on ARM, but I stillknow
about one important ARM user that might benefit from it, and writing
that code was fun.
I also reworked the makefile a bit so any optimized SHA1 implementations
is used regardless of whether NO_OPENSSL is defined or not.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Actually report what exactly is wrong with the object, instead of an
ambiguous 'bad sha1 file' or such. In places where we already do, unify
the format and clean the messages up.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
When we check the optional objects/info/alternates file at the remote
repository, we forgot to really squelch error message from rsync.
Not having that file is not a crime.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Right now we don't return any error value at all from parse_date(), and if
we can't parse it, we just silently leave the result buffer unchanged.
That's fine for the current user, which will always default to the current
date, but it's a crappy interface, and we might well be better off with an
error message rather than just the default date.
So let's change the thing to return a negative value if an error occurs,
and the length of the result otherwise (snprintf behaviour: if the buffer
is too small, it returns how big it _would_ have been).
[ I started looking at this in case we could support date-based revision
names. Looks ugly. Would have to parse relative dates.. ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add -m/--modified to show files that have been modified wrt. the index.
[jc: The original came from Brian Gerst on Sep 1st but it only checked
if the paths were cache dirty without actually checking the files were
modified. I also added the usage string and a new test.]
Signed-off-by: Junio C Hamano <junkio@cox.net>
If the length in the stat information does not match what is recorded
in the index, there is no point rehashing the contents to see if the
index entry can be refreshed.
We need to be a bit careful. Immediately after read-tree or
checkout-index without -u, ce_size is set to zero and does not match
the length of the blob that is recorded, and we need to actually look
at the contents to see if it has been changed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
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>
Somehow I missed it when we updated read-tree to support the recursive
merge strategy. Also -i should require -m as well, which the command
did not check.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The replacement was performed automatically by these commands:
perl -pi -e 's/link:(git.+)\.html\[\1\]/gitlink:$1\[1\]/g' \
README Documentation/*.txt
perl -pi -e 's/link:git\.html\[git\]/gitlink:git\[7\]/g' \
README Documentation/*.txt
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Introduce an asciidoc.conf file with the purpose of adding a gitlink:
macro which will improve the manpage output.
Original cogito patch by Jonas Fonseca <fonseca@diku.dk>;
asciidoc.conf from that patch was further enhanced to use the proper
DocBook tag <citerefentry> for references to man pages.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
get_sha1() would not do sha1 completion of short SHA1's when they were
part of a more complex expression. So doing
git-rev-parse 727132834e6be48a93c1bd6458a29d474ce7d5d5^
would work, and return 87c6aeb4ef. But using
the shorthand version
git-rev-list 72713^
wouldn't work.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
We may end up trying to print a commit we do not actually have but we
know about its existence only because another commit we do have refers
to it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from b204feab9371040982d2c60611925e7693106c84 commit)
The base target directory for the templates copying was initialized
to git_dir, but git_dir[len] is not zero but / at the time we do the
initialization. This is not what we want for our target directory string
since we pass it to mkdir(), so make it zero-terminated manually.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
We sometimes do not install git-send-email nor git-http-pull; do not
unconditionally create symlinks to them.
Signed-off-by: Patrick Mauritz <oxygene@studentenbude.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The target to check out does not need to be a branch. The _result_ of the
checkout needs to be a branch. Don't confuse the two, and then insult the
user.
Insulting is ok, but I personally get really pissed off is a tool is both
confused and insulting. At least be _correct_ and insulting.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Some C libraries lack strcasestr(); add a stupid replacement
to help folks with such.
[jc: original Linus posting, updated with his "also need <ctype.h>",
updated further with a fix from Joachim B Haga <cjhaga@fys.uio.no>"]
Signed-off-by: Junio C Hamano <junkio@cox.net>
This makes git-update-index error reporting much less confusing. The
user will know what went wrong with better precision, and will be given
a hopefully less confusing advice.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This fixes everybodys favourite complaint about "git add", namely that it
doesn't take directories.
We use "git-ls-files --others" to generate an arbitrary list of filenames,
and thus also automatically honor ignore-files while we're at it.
Side note: there's a lot of room for improvement here. In particular, if
we have a long list of filenames (importing a big archive), this will just
do a big stupid for-loop and add them one at a time. Maybe it should use
generate-list | xargs -0 git-update-idex --add --
instead.
Also, I think we should have a default ignore list if we don't find a
.git/info/exclude file. Ignoring "*.o" and ".*" by default would probably
be the right thing to do.
But I think this is a good first step.
Use the "-n" flag to just show the list of files to be added without
adding them.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Especially when you're deep inside the git repository, it's not all that
trivial for scripts to figure out where GIT_DIR is if it isn't set.
So add a flag to git-rev-parse to show where it is, since it will have
figured it out anyway.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This allows the remote repository to refer to additional repositories
in a file objects/info/http-alternates or
objects/info/alternates. Each line may be:
a relative path, starting with ../, to get from the objects directory
of the starting repository to the objects directory of the added
repository.
an absolute path of the objects directory of the added repository (on
the same server).
(only in http-alternates) a full URL of the objects directory of the
added repository.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The recent safety check to trust only the commits we have made
things impossibly slow and turn out to waste a lot of memory.
This commit fixes it with the following improvements:
- mark already scanned objects and avoid rescanning the same
object again;
- free the tree entries when we have scanned the tree entries;
this is the same as b0d8923ec0
which reduced memory usage by rev-list;
- plug memory leak from the object_list dequeuing code;
- use the process_queue not just for fetching but for scanning,
to make things tail recursive to avoid deep recursion; the
deep recursion was especially prominent when we cloned a big
pack.
- avoid has_sha1_file() call when we already know we do not have
that object.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Using "git repack -a -d" can destroy your git archive if you use it
twice in succession, because the new pack can be called the same as
the old pack. Found by Linus.
Signed-off-by: Junio C Hamano <junkio@cox.net>
As a convenience measure, 'bisect bad' or 'bisect good' automatically
does 'bisect next' when it knows it can, but the result of that test
to see if it can was leaking through as the exit code from the whole
thing, which was bad. Noticed by Anton Blanchard.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This tries .../objects/info/http-alternates and then
.../objects/info/alternates, looking for a file which specifies where
else to download objects and packs from.
It currently only supports absolute paths, and doesn't support full URLs.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
I do not know why it was spelled git-rev-tree when I meant to say
git-read-tree, but the typo was left since day one.
Signed-off-by: Junio C Hamano <junkio@cox.net>
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>
This is a nicer fix for git-shortlog being unable to handle the raw log
format. Just use a more permissive regexp instead of doing two nearly
identical ones.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
There were two bugs in there:
- if the range didn't end up working, we restored the '.' character in
the wrong place.
- an empty end-of-range should be interpreted as HEAD.
See rev-parse.c for the reference implementation of this.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
For local operations and downloading and uploading via git aware protocols,
use of $GIT_OBJECT_DIRECTORY/info/alternates is recommended on the server
side for big projects that are derived from another one (like Linux kernel).
However, dumb protocols and rsync transport needs to resolve this on the
client end, which we did not bother doing until this week.
I noticed we use "rsync -z" but most of our payload is already compressed,
which was not quite right. This commit also fixes it.
Signed-off-by: Junio C Hamano <junkio@cox.net>