Commit Graph

1830 Commits

Author SHA1 Message Date
Robert Watson
ff8489cb0a [PATCH] document command to show diff of a commit
Document the best way to show the change introduced by a
commit, based on the suggestion by Linus on the list.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:28:40 -07:00
Junio C Hamano
e20b134d72 Ignore a bit more generated files.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:02:57 -07:00
Junio C Hamano
9f92f15f89 Make 'git diff --cached' synonymous to 'git diff --cached HEAD'.
When making changes to different files (i.e. dirty working tree) and
committing logically separate changes in groups, often it is necessary
to run 'git diff --cached HEAD' to make sure that the changes being
committed makes sense.  Saying 'git diff --cached' by mistake gives
rather uninformative error message from git-diff-files complaining it
does not understand --cached flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 00:53:02 -07:00
Sergey Vlasov
2c08b36383 [PATCH] fetch.c: Remove call to parse_object() from process()
The call to parse_object() in process() is not actually needed - if
the object type is unknown, parse_object() will be called by loop();
if the type is known, the object will be parsed by the appropriate
process_*() function.

After this change blobs which exist locally are no longer parsed,
which gives about 2x CPU usage improvement; the downside is that there
will be no warnings for existing corrupted blobs, but detecting such
corruption is the job of git-fsck-objects, not the fetch programs.
Newly fetched objects are still checked for corruption in http-fetch.c
and ssh-fetch.c (local-fetch.c does not seem to do it, but the removed
parse_object() call would not be reached for new objects anyway).

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 21:52:12 -07:00
Sergey Vlasov
24451c3103 [PATCH] fetch.c: Clean up object flag definitions
Remove holes left after deleting flags, and use shifts to emphasize
that flags are single bits.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
2449696bcd [PATCH] fetch.c: Remove redundant test of TO_SCAN in process()
If the SEEN flag was not set, the TO_SCAN flag cannot be set,
therefore testing it is pointless.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
7b64d06b2e [PATCH] fetch.c: Remove some duplicated code in process()
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>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
51d8faf860 [PATCH] fetch.c: Remove redundant TO_FETCH flag
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>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
754ac00e71 [PATCH] fetch.c: Remove redundant SCANNED flag
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>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
a82d07e5e6 [PATCH] fetch.c: Make process() look at each object only once
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>
2005-09-22 21:52:11 -07:00
Sergey Vlasov
80077f0716 [PATCH] fetch.c: Remove useless lookup_object_type() call in process()
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>
2005-09-22 21:52:10 -07:00
Junio C Hamano
bc7ccfd2d7 Do not give alarming error message from rsync in fetch and clone.
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>
(cherry picked from 89d844d084 commit)
2005-09-22 21:43:19 -07:00
Junio C Hamano
b163512d4e Fix documentation dependency.
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>
2005-09-21 12:29:59 -07:00
Junio C Hamano
09d920831e Make object creation in http fetch a bit safer.
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>
2005-09-21 02:47:16 -07:00
Linus Torvalds
af61c6e008 Fix extended short SHA1 name completion
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>
2005-09-20 15:04:19 -07:00
Junio C Hamano
343d35c916 Ship our own copy of subprocess.py
so people without the latest Python could run merge-recursive.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-19 19:47:54 -07:00
Junio C Hamano
0a2ba73860 show-branch: Be nicer when running in a corrupt repository.
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)
2005-09-19 19:20:26 -07:00
Petr Baudis
1f961c196c [PATCH] Fix git-init-db creating crap directories.
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>
2005-09-19 17:41:13 -07:00
Patrick Mauritz
bfb73b2ebc [PATCH] Do not install compatibility symlink for what we do not install
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>
2005-09-19 17:35:49 -07:00
Linus Torvalds
3b944aac3b [PATCH] Remove total confusion from "git checkout"
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>
2005-09-19 17:35:30 -07:00
Linus Torvalds
ef34af24dc [PATCH] strcasestr compatibility replacement
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>
2005-09-19 08:49:39 -07:00
Junio C Hamano
727132834e GIT 0.99.7 2005-09-18 15:45:59 -07:00
Junio C Hamano
87c6aeb4ef Arrgh -- another asciidoc caret workaround.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-18 15:45:09 -07:00
Petr Baudis
34143b2639 [PATCH] Improve git-update-index error reporting
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>
2005-09-18 14:18:57 -07:00
Linus Torvalds
37539fbda5 [PATCH] Improved "git add"
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>
2005-09-18 14:18:38 -07:00
Linus Torvalds
a8783eeb79 [PATCH] Add "--git-dir" flag to git-rev-parse
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>
2005-09-18 14:18:34 -07:00
Daniel Barkalow
1b0c1e672a [PATCH] Support alternates and http-alternates in http-fetch
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>
2005-09-18 14:14:52 -07:00
Junio C Hamano
3a45f625ae Document extended SHA1 used by git-rev-parse.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-18 14:12:43 -07:00
Junio C Hamano
029f6de377 fetch() assumes we do not have the object.
Bugfix for the previous one.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-18 14:11:53 -07:00
Junio C Hamano
8ac93bc98f Merge branch 'master' of . 2005-09-18 01:18:15 -07:00
Junio C Hamano
85d106c267 Improve the safety check used in fetch.c
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>
2005-09-18 01:01:07 -07:00
Junio C Hamano
490e23d22a Archive-destroying "git repack -a -d" bug.
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>
2005-09-17 23:35:49 -07:00
Junio C Hamano
434d036fe4 Do not fail after calling bisect_auto_next()
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>
2005-09-17 13:51:03 -07:00
Daniel Barkalow
b3661567cf [PATCH] Add support for alternates in HTTP
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>
2005-09-17 11:57:50 -07:00
Junio C Hamano
50d69ef4f5 Fix typo in test comment.
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>
2005-09-17 11:57:50 -07:00
Junio C Hamano
5a90d4ac1a [PATCH] getdomainname should be usable on SunOS with -lnsl
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-17 11:57:50 -07:00
Linus Torvalds
aa894d8887 [PATCH] Make "git shortlog" understand raw logs
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>
2005-09-17 11:57:50 -07:00
Linus Torvalds
2a7055ae98 [PATCH] Fix "git-rev-list" revision range parsing
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>
2005-09-17 11:57:50 -07:00
Junio C Hamano
a09af243fb Add git-send-email to .gitignore
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-17 11:57:49 -07:00
Junio C Hamano
4447badcd2 Teach rsync transport about alternates.
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>
2005-09-17 11:56:41 -07:00
Linus Torvalds
8805ccac40 [PATCH] Avoid building object ref lists when not needed
The object parsing code builds a generic "this object references that
object" because doing a full connectivity check for fsck requires it.

However, nothing else really needs it, and it's quite expensive for
git-rev-list that can have tons of objects in flight.

So, exactly like the commit buffer save thing, add a global flag to
disable it, and use it in git-rev-list.

Before:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	12.28user 0.29system 0:12.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+26718minor)pagefaults 0swaps
	59124

After this change:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	10.33user 0.18system 0:10.54elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+18509minor)pagefaults 0swaps
	59124

and note how the number of pages touched by git-rev-list for this
particular object list has shrunk from 26,718 (104 MB) to 18,509 (72 MB).

Calculating the total object difference between two git revisions is still
clearly the most expensive git operation (both in memory and CPU time),
but it's now less than 40% of what it used to be.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:32:23 -07:00
Linus Torvalds
b0d8923ec0 [PATCH] Improve git-rev-list memory usage further
This avoids keeping tree entries around, and free's them as it traverses
the list. This avoids building up a huge memory footprint just for these
small but very common allocations.

Before:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	11.65user 0.38system 0:12.65elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+42934minor)pagefaults 0swaps
	59124

After:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	12.28user 0.29system 0:12.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+26718minor)pagefaults 0swaps
	59124

Note how the minor fault numbers - which ends up being how many pages we
needed to map - go down from 42934 (167 MB) to 26718 (104 MB).  That is:

Before:
	42934 minor pagefaults

After:

	26718 minor pagefaults

This is all in _addition_ to the previous fixes.  It used to be
~48,000 pagefaults.

That's still a honking big memory footprint, but it's about half of what
it was just a day or two ago (and this is the object list for a pretty big
update - almost 60,000 objects. Smaller updates need less memory).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:19:07 -07:00
Junio C Hamano
d0ac30f20c [PATCH] fetch.c: cleanups
Clean-ups suggested by Sergey Vlasov and acked by Daniel Barkalow.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:45 -07:00
Matthias Urlichs
2842375859 [PATCH] Debian: build-depend on "bc"
Build systems should run tests. This patch adds the necessary
debian/control and debian/rules bits ("bc" was missing,
t/t4002-diff-basic.sh wants it).

Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:42 -07:00
Junio C Hamano
6b82d16bfc [PATCH] Make git-checkout failure message more friendly.
... or less so, perhaps ;-).  Suggested by Jeff Garzik.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:40 -07:00
Chris Wright
0e60471c2a [PATCH] Update git-core.spec.in
Update git-core spec file based on feedback from Fedora Extras review.

- update BuildRoot to be more specific
- eliminate Requires that must be satisfied for base system install
- drop Vendor
- use dist tag to differentiate between branches
- own %{_datadir}/git-core/
- use RPM_OPT_FLAGS in spec file

Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:37 -07:00
Peter Hagervall
ed0a84883e [PATCH] PATCH Documentation/git-rev-list.txt typo fix
An earlier commit causes a mismatch in <emphasis> and <superscript>
tags, one way of fixing it is having no more than one caret symbol per
line, which is the only solution I found in the asciidoc
documentation. Ugly, but it works.

[jc: ugly indeed but that is not Peter's fault.]

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:35 -07:00
Junio C Hamano
b93aa3ec95 Recommend 'less' for Debian.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 23:33:03 -07:00
Horst von Brand
c6ae61590f [PATCH] Require less in RPM spec
... and the next one will be the one to do Debian, naturally.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 23:31:44 -07:00
Junio C Hamano
b4416b432b Revert breakage introduced by c80522e30f.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 17:38:26 -07:00