Commit graph

1896 commits

Author SHA1 Message Date
Junio C Hamano 152da3dfcf Plug a small race in update-ref.c.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-25 19:25:09 -07:00
Linus Torvalds 66bf85a462 [PATCH] Add "git-update-ref" to update the HEAD (or other) ref
This is a careful version of the script stuff that currently just
blindly writes HEAD with a new value.

You can use

	git-update-ref HEAD <newhead>

or

	git-update-ref HEAD <newhead> <oldhead>

where the latter version verifies that the old value of HEAD matches
oldhead.

It basically allows a "ref" file to be a symbolic pointer to another ref
file by starting with the four-byte header sequence of "ref:".

More importantly, it allows the update of a ref file to follow these
symbolic pointers, whether they are symlinks or these "regular file
symbolic refs".

NOTE! It follows _real_ symlinks only if they start with "refs/":
otherwise it will just try to read them and update them as a regular file
(ie it will allow the filesystem to follow them, but will overwrite such a
symlink to somewhere else with a regular filename).

In general, using

	git-update-ref HEAD "$head"

should be a _lot_ safer than doing

	echo "$head" > "$GIT_DIR/HEAD"

both from a symlink following standpoint _and_ an error checking
standpoint.  The "refs/" rule for symlinks means that symlinks that point
to "outside" the tree are safe: they'll be followed for reading but not
for writing (so we'll never write through a ref symlink to some other
tree, if you have copied a whole archive by creating a symlink tree).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-25 16:18:25 -07:00
Fredrik Kuivinen 8cc01e5019 [PATCH] More descriptive messages for conflict cases in merges
The merge strategies can give more descriptive error messages for
conflict cases if they are given the actual branch names instead of
the SHA1s.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-25 16:08:54 -07:00
Fredrik Kuivinen 0bed18998a [PATCH] recursive-merge: Don't print a stack trace when read-tree fails.
If the working tree is dirty read-tree will fail, and we don't want an
ugly stack trace in that case. Also make sure we don't print stack
traces when we use 'die'.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-25 16:08:53 -07:00
Junio C Hamano 946f5f7c24 Diff: --name-status output format.
The new output format shows only the status letter and paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:50:44 -07:00
Junio C Hamano 8082d8d305 Diff: -l<num> to limit rename/copy detection.
When many paths are modified, rename detection takes a lot of time.
The new option -l<num> can be used to disable rename detection when
more than <num> paths are possibly created as renames.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:50:44 -07:00
Junio C Hamano 6b5ee137e5 Diff clean-up.
This is a long overdue clean-up to the code for parsing and passing
diff options.  It also tightens some constness issues.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:50:43 -07:00
Junio C Hamano dbc3743868 Merge branch 'fixes' 2005-09-24 23:50:36 -07:00
Junio C Hamano a55797672d Clean generated files a bit more.
Now we conditionally compile things in compat/, so we should remove
object files there.  Python execution can leave *.pyc and *.pyo, which
need to be cleaned as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:48:29 -07:00
Junio C Hamano cf408cb4a0 Stop installing the backward compatible symlinks.
Also cmd-renames.sh can now be used to remove the backward compatible
symlinks -- this is not used by default in any way.

As discussed on the list with Pasky, git-ssh-push and git-ssh-pull will
keep calling each other for a while longer.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:42:34 -07:00
Junio C Hamano fbaf834de1 show-branch: fix commit naming breakage.
It was ignoring the generation number of the commit when naming 2nd
and later parents, showing "(linus^n)^2" for any <n> incorrectly as
"linus^2".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 23:33:02 -07:00
Daniel Barkalow 7061f5c2c5 [PATCH] Finish documenting trivial merge rules
Fix missing symbol explanations, a few incorrect cases, and add
two-way merge rules.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 22:05:55 -07:00
Junio C Hamano c9fc748f84 git-grep: fix 'git grep -e $pattern' handling
People typically say 'grep -e $pattern' because $pattern has a leading
dash which would be mistaken as a grep flag.  Make sure we pass -e in
front of $pattern when we invoke grep.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 15:09:48 -07:00
Junio C Hamano c3bc895c81 Remove use of 'xargs -0' from git-reset.
Even without the trouble it causes to people without GNU xargs,
it was not really necessary to print from Perl and then remove it
outside.  Just unlink it inside Perl.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 15:02:35 -07:00
Junio C Hamano d66189e2c9 Use 0.99.7.GIT as version between 0.99.7 and 0.99.8
Pasky taught me how he does his versioning for ELinks.  This will sort
after 0.99.7 and interim fixes 0.99.7a, and before 0.99.8.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 14:58:57 -07:00
Junio C Hamano 229a7ed7ab Solaris: give a bit more built-in defaults.
Taking the make command line Peter Eriksen uses, give defaults
to SHELL_PATH, TAR, CURLDIR, NO_STRCASESTR, and INSTALL.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:26:22 -07:00
Patrick Mauritz 6d9bbc50a3 [PATCH] CURLDIR in Makefile
Support systems that do not install curl headers and libraries
in /usr/{include,lib}.

Signed-off-by: Patrick Mauritz <oxygene@studentenbude.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:26:22 -07:00
Petr Baudis da38641d7c [PATCH] Rename daemon.c's lognotice() to loginfo()
The syslog code logs with severity LOG_INFO in the loginfo() function, so make
things less confusing.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:20:45 -07:00
Petr Baudis 9048fe1c50 [PATCH] git-daemon --syslog to log through syslog
Well, this makes it even more clear that we need the packet reader and
friends to use the daemon logging code. :/  Therefore, we at least indicate
in the "Disconnect" log message if the child process exitted with an error
code or not.

Idea by Linus.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:20:45 -07:00
Petr Baudis b5cf3c8b77 [PATCH] Update git-daemon documentation wrt. the --verbose parameter
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:20:43 -07:00
Junio C Hamano e558e33b7b Really ignore generated distribution material.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-24 11:19:07 -07:00
Junio C Hamano 1bedd4ca21 daemon.c: pid_t is not int.
Reported by Morten Welinder <mwelinder@gmail.com>.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 23:26:55 -07:00
Junio C Hamano 348c4c66da Merge 'fixes' branch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 18:46:34 -07:00
Junio C Hamano dc56bc0341 Further clarify licensing status of compat/subprocess.py.
PSF license explicitly states the files in Python distribution is
compatible with GPL, and upstream clarified the licensing terms by
shortening its file header.  This version is a verbatim copy from
release24-maint branch form Python CVS.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 18:43:53 -07:00
H. Peter Anvin e433b071fe [PATCH] rsh.c unterminated string
The change I made to rsh.c would leave the string unterminated under
certain conditions, which unfortunately always applied!  This patch
fixes this.  For some reason this never bit on i386 or ppc, but bit me
on x86-64.

Fix situation where the buffer was not properly null-terminated.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 18:07:42 -07:00
Sergey Vlasov 628cd5430f [PATCH] git-local-fetch: Avoid confusing error messages on packed repositories
If the source repository was packed, and git-local-fetch needed to
fetch a pack file, it spewed a misleading error message about not
being able to find the unpacked object.  Fixed by adding the
warn_if_not_exists argument to copy_file(), which controls printing
of error messages in case the source file does not exist.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:46 -07:00
Sergey Vlasov e2b77f026a [PATCH] Fix "git-local-fetch -s" with packed source repository
"git-local-fetch -s" did not work with a packed repository, because
symlink() happily created a link to a non-existing object file,
therefore fetch_file() always returned success, and fetch_pack() was
not called.  Fixed by calling stat() before symlink() to ensure the
file really exists.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov 1a951815dd [PATCH] git-local-fetch: Avoid calling close(-1)
After open() failure, copy_file() called close(ifd) with ifd == -1
(harmless, but causes Valgrind noise).  The same thing was possible
for the destination file descriptor.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov 8be707de55 [PATCH] git-local-fetch: Fix error checking and leak in setup_indices()
setup_indices() did not check the return value of opendir(), and
did not have a corresponding closedir() call.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov d35bbe0b2e [PATCH] fetch.c: Plug memory leak in process_tree()
When freeing a tree entry, must free its name too.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov a95cb6fb6b [PATCH] fetch.c: Do not build object ref lists
The fetch code does not need object ref lists; by disabling them we
can save some time and memory.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:42 -07:00
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 7fe2fc7935 Merge branch 'fixes' 2005-09-23 00:53:43 -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
Jon Loeliger d154dcc8b6 [PATCH] Retitle 'inspecting what happened' section.
In the tutorial, there is a section entitled "Checking it out"
that shows how to use diff log and whatchanged to insect some
of the repository state.

As the phrase "checkout" ususally carries some baggage WRT
other revision control mechanism, I suggest that we re-title
this section something like "Inspecting Changes".

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 18:31:14 -07:00
Junio C Hamano c8b48ba476 Prettyprint octopus merge message.
Including the current branch in the list of heads being merged
was not a good idea, so drop it.  And shorten the message by
grouping branches and tags together to form a single line.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 18:09:07 -07:00
Petr Baudis f8ff0c0641 [PATCH] Verbose git-daemon logging
This patch makes git-daemon --verbose log some useful things on stderr -
in particular connects, disconnects and upload requests, and in such a
way to be able to trace a particular session. Some more errors are now
also logged (even when --verbose is not passed). It is still not perfect
since messages produced by the non-daemon-specific code are obviously
not formatted properly.

[jc: With minor fix up in the log line truncation, and
 use of write(2) as suggested by Linus.]

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 18:00:28 -07:00
Junio C Hamano 5cfcd07c93 Retire diff-helper.
The textual diff generation with built-in '-p' in diff-* brothers has
proven to be useful enough that git-diff-helper outlived its usefulness.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 01:54:13 -07:00
Junio C Hamano 9dcc829fe1 Retire rev-tree.
Some old scripts might still use git-rev-tree, but it really is
clearly inferior in every way to git-rev-list that such scripts should
be fixed anyway. Fixing them should be pretty easy.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 01:54:12 -07:00
Junio C Hamano 0fe51391a8 Retire git-export.
git-export was done as a concept example on how easy it is to export
the git data to something else. It's much less powerful than any
number of trivial one-liner scripts now, and real exporters would not
ever use git-export.

It's obviously much less powerful than "git-whatchanged", or just
about any combination of git-rev-list + git-diff-tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 01:54:12 -07:00