Commit graph

7771 commits

Author SHA1 Message Date
Linus Torvalds 2cdf9509df write-cache: do not leak the serialized cache-tree data.
It is not used after getting written, and just is leaking every time
we write the index out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-11 12:25:16 -08:00
Shawn O. Pearce c82d7117a1 Improve merge performance by avoiding in-index merges.
In the early days of Git we performed a 3-way read-tree based merge
before attempting any specific merge strategy, as our core merge
strategies of merge-one-file and merge-recursive were slower script
based programs which took far longer to execute.  This was a good
performance optimization in the past, as most merges were able to
be handled strictly by `read-tree -m -u`.

However now that merge-recursive is a C based program which performs
a full 3-way read-tree before it starts running we need to pay the
cost of the 3-way read-tree twice if we have to do any sort of file
level merging.  This slows down some classes of simple merges which
`read-tree -m -u` could not handle but which merge-recursive does
automatically.

For a really trivial merge which can be handled entirely by
`read-tree -m -u`, skipping the read-tree and just going directly
into merge-recursive saves on average 50 ms on my PowerPC G4 system.
May sound odd, but it does appear to be true.

In a really simple merge which needs to use merge-recursive to handle
a file that was modified on both branches, skipping the read-tree
in git-merge saves on average almost 100 ms (on the same PowerPC G4)
as we avoid doing some work twice.

We only avoid `read-tree -m -u` if the only strategy to use is
merge-recursive, as not all merge strategies perform as well as
merge-recursive does.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 15:57:44 -08:00
Shawn O. Pearce 7eff28a9b4 Disallow working directory commands in a bare repository.
If the user tries to run a porcelainish command which requires
a working directory in a bare repository they may get unexpected
results which are difficult to predict and may differ from command
to command.

Instead we should detect that the current repository is a bare
repository and refuse to run the command there, as there is no
working directory associated with it.

[jc: updated Shawn's original somewhat -- bugs are mine.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 15:03:09 -08:00
Junio C Hamano 8b944b5678 merge-recursive: do not use on-file index when not needed.
This revamps the merge-recursive implementation following the
outline in:

	Message-ID: <7v8xgileza.fsf@assigned-by-dhcp.cox.net>

There is no need to write out the index until the very end just
once from merge-recursive.  Also there is no need to write out
the resulting tree object for the simple case of merging with a
single merge base.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 14:45:20 -08:00
Alex Riesen f5184380f0 Speed-up recursive by flushing index only once for all entries
The merge-recursive implementation in C inherited the invariant
that the on-file index file is written out and later read back
after any index operations and writing trees from the original
Python implementation.  But it was only because the original
implementation worked at the scripting level.

There is no need to write out the index file after handling
every path.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 14:45:20 -08:00
Jürgen Rühle 2a3a3c247e Provide better feedback for the untracked only case in status output
Since 98bf8a47c2 status would claim that
git-commit could be useful even if there are no changes except untracked files.

Since wt-status is already computing all the information needed go the whole
way and actually track the (non-)emptiness of all three sections separately,
unify the code, and provide useful messages for each individual case.

Thanks to Junio and Michael Loeffler for suggestions.

Signed-off-by: Jürgen Rühle <j-r@online.de>
2007-01-10 14:29:21 -08:00
Junio C Hamano ccd14e569d Merge branch 'js/reflog'
* js/reflog:
  Sanitize for_each_reflog_ent()
2007-01-10 14:16:16 -08:00
Junio C Hamano 6fc301bbf6 Makefile: remove $foo when $foo.exe is built/installed.
On Cygwin, newly builtins are not recognized, because there exist both
the executable binaries (with .exe extension) _and_ the now-obsolete
scripts (without extension), but the script is executed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 13:56:02 -08:00
Jürgen Rühle 374c59056a send-email: work around double encoding of in-body From field.
git-send-email sends out the message taken from format-patch
output without quoting nor encoding.  When copying the From:
line to form in-body From: field, it should not copy it
verbatim, because the From: for the header is quoted according
to RFC 2047 when not ASCII.

The original came from Jürgen Rühle, but I moved the
string munging into a separate function so that later other
people can tweak it more easily.  Bugs introduced during the
translation are mine.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 13:39:16 -08:00
Nicolas Pitre c2cb959fe7 Add git-init documentation.
Oops. Commit 515377ea9e missed one
file, git-init documentation.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 13:38:03 -08:00
Johannes Schindelin 1b510aa442 Fix t1410 for core.filemode==false
Since c869753e, core.filemode is hardwired to false on Cygwin.
So this test had no chance to succeed, since an early commit
(changing just the filemode) failed, and therefore all subsequent
tests.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 08:31:29 -08:00
Shawn O. Pearce 9a0eaf83ea Make git-describe a builtin.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 08:27:01 -08:00
Shawn O. Pearce 8c599c749f Don't save the commit buffer in git-describe.
The commit buffer (message of the commit) is not actually
used by the git-describe process.  We can save some memory
by not keeping it around.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 08:26:50 -08:00
Pavel Roskin e05db0fd4f Fix warnings in sha1_file.c - use C99 printf format if available
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 22:43:58 -08:00
Junio C Hamano bb1091a475 -u is now default for 'git-mailinfo'.
Originally from David Woodhouse, but also adjusts the callers of
mailinfo to the new default.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 21:32:49 -08:00
Junio C Hamano 62c89c662f -u is now default for 'git-applymbox'
It has '-n' to disable it just in case, but do not even bother
documenting it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 21:20:39 -08:00
Junio C Hamano 3cf167ba4b git-am: should work when "--no-utf8 --utf8" is given
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 21:16:45 -08:00
Junio C Hamano bfbbb8f8cf git-checkout: handle local changes sanely when detaching HEAD
When switching branches, we usually first try read-tree to make
sure that we do not lose the local changes and then updated the
HEAD using update-ref.  However, we detached and updated HEAD
before these checks, which was quite bad in a repository with
local changes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 20:40:39 -08:00
Shawn O. Pearce 1c23d794bf Don't die in git-http-fetch when fetching packs.
My sp/mmap changes to pack-check.c modified the function such that
it expects packed_git.pack_size to be populated with the total
bytecount of the packfile by the caller.

But that isn't the case for packs obtained by git-http-fetch as
pack_size was not initialized before being accessed.  This caused
verify_pack to think it had 2^32-21 bytes available when the
downloaded pack perhaps was only 305 bytes in length.  The use_pack
function then later dies with "offset beyond end of packfile"
when computing the overall file checksum.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 17:54:25 -08:00
Junio C Hamano 75b364dfe2 git-checkout: safety check for detached HEAD checks existing refs
Checking for reachability from refs does not help much if the
state we are currently on is somewhere in the middle.  We will
lose where we were.

So this makes sureh that HEAD is something directly pointed at
by one of the existing refs (most likely a tag for a user who
has been "sightseeing").

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 17:44:59 -08:00
Steven Grimm cec21ca7cf Update git-svn manpage to remove the implication that SVN::* is optional.
Now that git-svn requires the SVN::* Perl library, the manpage doesn't need
to describe what happens when you don't have it.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 17:08:09 -08:00
Stefan-W. Hahn 6900679c2f Replacing the system call pread() with lseek()/xread()/lseek() sequence.
Using cygwin with cygwin.dll before 1.5.22 the system call pread() is buggy.
This patch introduces NO_PREAD. If NO_PREAD is set git uses a sequence of
lseek()/xread()/lseek() to emulate pread.

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:40:40 -08:00
Jakub Narebski 0bdb28c9cc gitweb: Fix git_patchset_body not closing <div class="patch">
Fix case when git_patchset_body didn't close <div class="patch">,
for patchsets with last patch empty.

This patch also removes some commented out code in git_patchset_body.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:23:39 -08:00
Alexandre Julliard 03d311eda2 git.el: Define the propertize function if needed, for XEmacs compatibility.
Also use `concat' instead of `format' in the pretty-printer since
format doesn't preserve properties under XEmacs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:15:07 -08:00
Alexandre Julliard 3fe71f3a6f git-clone: Make sure the master branch exists before running cat on it.
Otherwise we get an error like this on stderr:

  cat: [...]/.git/refs/remotes/origin/master: No such file or directory

which makes it look like git-clone failed.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:14:41 -08:00
Alexandre Julliard d234b21c69 git-apply: Remove directories that have become empty after deleting a file.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 16:05:00 -08:00
Jeff King d93b7d1c30 get_tree_entry: map blank requested entry to tree root
This means that
  git show HEAD:
will now return HEAD^{tree}, which is logically consistent with
  git show HEAD:Documentation

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 14:08:41 -08:00
Junio C Hamano 2740b2b853 builtin-archive: do not free a tree held by the object layer.
Found by running "git archive --format=tar HEAD" in Documentation/
directory.

It's surprising that nobody has noticed this from the beginning...

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 14:07:59 -08:00
Junio C Hamano 240897e908 Merge branch 'maint'
* maint:
  Fix "Do not ignore a detected patchfile brokenness."
  Do not ignore a detected patchfile brokenness.
2007-01-09 12:04:30 -08:00
Junio C Hamano 6534141151 Fix "Do not ignore a detected patchfile brokenness."
Returning negative value from there does not stop the caller from using
the earlier part.

Noticed by Linus.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 11:50:53 -08:00
Johannes Schindelin 883d60fa97 Sanitize for_each_reflog_ent()
It used to ignore the return value of the helper function; now, it
expects it to return 0, and stops iteration upon non-zero return
values; this value is then passed on as the return value of
for_each_reflog_ent().

Further, it makes no sense to force the parsing upon the helper
functions; for_each_reflog_ent() now calls the helper function with
old and new sha1, the email, the timestamp & timezone, and the message.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 03:04:04 -08:00
Junio C Hamano 5a17b54ad5 Do not ignore a detected patchfile brokenness.
find_header() function is used to read and parse the patchfile
and it detects errors in the patch, but one place ignored the
error and went ahead, which was quite bad.

Noticed by Jeff Garzik.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 02:56:43 -08:00
Junio C Hamano 1295228d1f merge-base: do not leak commit list
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 23:10:49 -08:00
Brian Gernhardt cdd4fb15cf Auto-quote config values in config.c:store_write_pair()
Suggested by Jakub Narebski <jnareb@gmail.com> on the list.

When we send a value to store_write_pair(), make sure that the value
that gets read out matches the one passed in.  This means that for any
value that contains leading or trailing whitespace or any comment
character (# and ;), we need to surround it in quotes.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 22:00:18 -08:00
Brian Gernhardt baee1e91ed Ignore git-init and git-remote
These new commands weren't added to .gitignore.  Add them so we don't
end up with copies of them in the repo.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 21:53:23 -08:00
Junio C Hamano 3f43d72392 rm git-rerere.perl -- it is now a built-in.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 21:52:38 -08:00
Martin Langhoff 3486595bf1 cvsserver: fix revision number during file adds
With this patch, cvs add / cvs commit echoes back to the client
the correct file version (1.1) so that the file in the checkout
is recognised as up-to-date.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 21:45:13 -08:00
Martin Langhoff 49fb940e40 cvsserver: detect early of we are up to date and avoid costly rev-list
if the SHA1 of our head matches the last SHA1 seen in the DB, avoid further
processing.

[jc: an "Oops, please amend" patch rolled in]

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 21:44:07 -08:00
J. Bruce Fields 041e69c998 Documentation: add git-remote man page
Add a preliminary man page for git-remote.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 21:42:37 -08:00
Junio C Hamano c326246acc Merge branch 'jc/reflog'
* jc/reflog:
  reflog --fix-stale: do not check the same trees and commits repeatedly.
  reflog expire --fix-stale
  Move traversal of reachable objects into a separate library.
  builtin-prune: separate ref walking from reflog walking.
  builtin-prune: make file-scope static struct to an argument.
2007-01-08 15:56:51 -08:00
Andy Whitcroft 480c9e521b short i/o: fix config updates to use write_in_full
We need to check that the writes we perform during the update of
the users configuration work.  Convert to using write_in_full().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 15:44:47 -08:00
Andy Whitcroft 93822c2239 short i/o: fix calls to write to use xwrite or write_in_full
We have a number of badly checked write() calls.  Often we are
expecting write() to write exactly the size we requested or fail,
this fails to handle interrupts or short writes.  Switch to using
the new write_in_full().  Otherwise we at a minimum need to check
for EINTR and EAGAIN, where this is appropriate use xwrite().

Note, the changes to config handling are much larger and handled
in the next patch in the sequence.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 15:44:47 -08:00
Andy Whitcroft 93d26e4cb9 short i/o: fix calls to read to use xread or read_in_full
We have a number of badly checked read() calls.  Often we are
expecting read() to read exactly the size we requested or fail, this
fails to handle interrupts or short reads.  Add a read_in_full()
providing those semantics.  Otherwise we at a minimum need to check
for EINTR and EAGAIN, where this is appropriate use xread().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 15:44:47 -08:00
Andy Whitcroft e08140568a short i/o: clean up the naming for the write_{in,or}_xxx family
We recently introduced a write_in_full() which would either write
the specified object or emit an error message and fail.  In order
to fix the read side we now want to introduce a read_in_full()
but without an error emit.  This patch cleans up the naming
of this family of calls:

1) convert the existing write_or_whine() to write_or_whine_pipe()
   to better indicate its pipe specific nature,
2) convert the existing write_in_full() calls to write_or_whine()
   to better indicate its nature,
3) introduce a write_in_full() providing a write or fail semantic,
   and
4) convert write_or_whine() and write_or_whine_pipe() to use
   write_in_full().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 15:44:47 -08:00
Junio C Hamano 0f018baba6 --prune is now default for 'pack-refs'
There is no reason not to, really.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 14:46:00 -08:00
Junio C Hamano d84029b673 --utf8 is now default for 'git-am'
Since we are talking about allowing potentially incompatible UI
changes in v1.5.0 iff the change improves the general situation,
I would say why not.

There is --no-utf8 flag to avoid re-coding from botching the log
message just in case, but we may not even need it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 14:45:59 -08:00
Michael Loeffler 521f9c4def git-commit: do not fail to print the diffstat even if there is a file named HEAD
Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 14:45:59 -08:00
Andy Whitcroft d677db86d9 ssh-upload: prevent buffer overrun
Prevent a client from overrunning the on stack ref buffer.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 14:45:54 -08:00
Junio C Hamano 8d78b5af23 git-checkout: fix branch name output from the command
When switching branches with "git checkout", we internally did $arg^0
(aka $arg^{commit}) suffix but there was no need to.

The improvement is easily visible in the change to an existing
test t/3200-branch.sh in this commit; it was expecting rather
ugly message.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00
Junio C Hamano ead80606d4 git-checkout: safety when coming back from the detached HEAD state.
After making commits in the detached HEAD state, if you run "git
checkout" to switch to an existing branch, you will lose your
work.  Make sure the switched-to branch is a fast-forward of the
current HEAD, or require -f when switching.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00