Commit graph

7232 commits

Author SHA1 Message Date
Shawn O. Pearce 1510fea781 Avoid accessing a slow working copy during diffcore operations.
The Cygwin folks have done a fine job at creating a POSIX layer
on Windows That Just Works(tm).  However it comes with a penalty;
accessing files in the working tree by way of stat/open/mmap can
be slower for diffcore than inflating the data from a blob which
is stored in a packfile.

This performance problem is especially an issue in merge-recursive
when dealing with nearly 7000 added files, as we are loading
each file's content from the working directory to perform rename
detection.  I have literally seen (and sadly watched) paint dry in
less time than it takes for merge-recursive to finish such a merge.
On the other hand this very same merge runs very fast on Solaris.

If Git is compiled with NO_FAST_WORKING_DIRECTORY set then we will
avoid looking at the working directory when the blob in question
is available within a packfile and the caller doesn't need the data
unpacked into a temporary file.

We don't use loose objects as they have the same open/mmap/close
costs as the working directory file access, but have the additional
CPU overhead of needing to inflate the content before use.  So it
is still faster to use the working tree file over the loose object.

If the caller needs the file data unpacked into a temporary file
its likely because they are going to call an external diff program,
passing the file as a parameter.  In this case reusing the working
tree file will be faster as we don't need to inflate the data and
write it out to a temporary file.

The NO_FAST_WORKING_DIRECTORY feature is enabled by default on
Cygwin, as that is the platform which currently appears to benefit
the most from this option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:11:19 -08:00
Junio C Hamano 1576f5f7b2 Merge branch 'js/show'
* js/show:
  git-show: grok blobs, trees and tags, too
2006-12-15 21:38:26 -08:00
Johannes Schindelin 5d7eeee2ac git-show: grok blobs, trees and tags, too
Since git-show is pure Porcelain, it is the ideal candidate to
pretty print other things than commits, too.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:56:24 -08:00
Junio C Hamano 2ce633b928 git-reset [--mixed] <tree> [--] <paths>...
Sometimes it is asked on the list how to revert selected path in
the index from a tree, most often HEAD, without affecting the
files in the working tree.  A similar operation that also
affects the working tree files has been available in the form of
"git checkout <tree> -- <paths>...".

By definition --soft would never affect either the index nor the
working tree files, and --hard is the way to make the working
tree files as close to pristine, so this new option is available
only for the default --mixed case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:45:51 -08:00
Junio C Hamano a81c311f23 git-reset: make it work from within a subdirectory.
If you typically sit in, say "src/", it's annoying to have to
change directory to do a reset.

This may need to be reworked when we add "git reset -- paths..."
to encapsulate the "ls-tree $tree | update-index --index-info"
pattern.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:45:51 -08:00
Junio C Hamano 4da9028578 git-fetch: make it work from within a subdirectory.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:45:51 -08:00
Johannes Schindelin 02c9e93547 INSTALL: no need to have GNU diff installed
Since a long time, we have inbuilt diff generation.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:45:23 -08:00
Junio C Hamano eab90210be Merge branch 'maint'
* maint:
  Bypass expensive content comparsion during rename detection.
2006-12-14 02:45:12 -08:00
Shawn O. Pearce 7da41f48c8 Bypass expensive content comparsion during rename detection.
When comparing file contents during the second loop through a rename
detection attempt we can skip the expensive byte-by-byte comparsion
if both source and destination files have valid SHA1 values.  This
improves performance by avoiding either an expensive open/mmap to
read the working tree copy, or an expensive inflate of a blob object.

Unfortunately we still have to at least initialize the sizes of the
source and destination files even if the SHA1 values don't match.
Failing to initialize the sizes causes a number of test cases to fail
and start reporting different copy/rename behavior than was expected.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:40:33 -08:00
Junio C Hamano f5e6b89b3a Update git-diff documentation
Porcelain documentation should talk in terms of end-user workflow, not
in terms of implementation details.  Do not suggest update-index, but
git-add instead.  Explain differences among 0-, 1- and 2-tree cases
not as differences of number of trees given to the command, but say
why user would want to give these number of trees to the command in
what situation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 01:51:44 -08:00
Junio C Hamano 67bed724f2 Merge branch 'jc/diff--cached'
* jc/diff--cached:
  Revert "git-diff: Introduce --index and deprecate --cached."
2006-12-13 23:55:42 -08:00
Junio C Hamano 62e1aeabc0 git-svn: allow both diff.color and color.diff
The list concensus is to group color related configuration under
"color.*" so let's be consistent.

Inspired by Andy Parkins's patch to do the same for diff/log
family.  With fixes from Eric Wong.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 15:58:41 -08:00
Nicolas Pitre ad2c82c0e1 repacked packs should be read-only
... just like the other pack creating tools do.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 14:18:16 -08:00
Junio C Hamano 1d77043b00 config documentation: group color items together.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 12:11:03 -08:00
Eric Wong 359850041e git-svn: correctly handle "(no author)" when using an authors file
The low-level parts of the SVN library return NULL/undef for
author-less revisions, whereas "(no author)" is a (svn) client
convention.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 12:08:01 -08:00
Junio C Hamano b11121d9e3 git-blame: show lines attributed to boundary commits differently.
When blaming with revision ranges, often many lines are attributed
to different commits at the boundary, but they are not interesting
for the purpose of finding project history during that revision range.

This outputs the lines blamed on boundary commits differently. When
showing "human format" output, their SHA-1 are shown with '^' prefixed.
In "porcelain format", the commit will be shown with an extra attribute
line "boundary".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 11:15:07 -08:00
Junio C Hamano f388cec3d7 Merge branch 'jc/read-tree-ignore'
* jc/read-tree-ignore:
  read-tree: document --exclude-per-directory
  Loosen "working file will be lost" check in Porcelain-ish
  read-tree: further loosen "working file will be lost" check.
2006-12-13 11:10:24 -08:00
Junio C Hamano d0085ade95 Merge branch 'ew/rerere'
* ew/rerere:
  rerere: record (or avoid misrecording) resolved, skipped or aborted rebase/am
  git-rerere: add 'gc' command.
  rerere: add clear, diff, and status commands
2006-12-13 11:08:35 -08:00
Junio C Hamano 78ba00407c Merge branch 'np/addcommit'
* np/addcommit:
  git-commit: allow --only to lose what was staged earlier.
  Documentation/git-commit: rewrite to make it more end-user friendly.
  make 'git add' a first class user friendly interface to the index
2006-12-13 11:08:20 -08:00
Junio C Hamano abcb49cb56 Merge branch 'lh/branch-rename'
* lh/branch-rename:
  git-branch: let caller specify logmsg
  rename_ref: use lstat(2) when testing for symlink
  git-branch: add options and tests for branch renaming

Conflicts:

	builtin-branch.c
2006-12-13 11:07:51 -08:00
Junio C Hamano 490e092def Merge branch 'jc/commit-careful'
* jc/commit-careful:
  git-commit: show --summary after successful commit.
2006-12-13 11:03:46 -08:00
Junio C Hamano f88bd392e6 Merge branch 'ap/clone-origin'
* ap/clone-origin:
  Explicitly add the default "git pull" behaviour to .git/config on clone
2006-12-13 11:03:33 -08:00
Junio C Hamano f5c589f1df Merge branch 'jc/numstat'
* jc/numstat:
  diff --numstat: show binary with '-' to match "apply --numstat"
2006-12-13 11:00:32 -08:00
Junio C Hamano b8fda70de5 Merge branch 'rr/cvsexportcommit'
* rr/cvsexportcommit:
  Make cvsexportcommit work with filenames with spaces and non-ascii characters.
2006-12-13 11:00:27 -08:00
Junio C Hamano 9b2c681cae Merge branch 'ap/branch'
* ap/branch:
  branch --color: change default color selection.
  Colourise git-branch output
2006-12-13 10:57:02 -08:00
Junio C Hamano 753f96a455 branch --color: change default color selection.
Showing local and remote branches in green and red was simply
overkill, as all we wanted was to make it easy to tell them
apart (local ones can be built on top by committing, but the
remote tracking ones can't).

Use plain coloring for local branches and paint remotes in red.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 10:55:21 -08:00
Junio C Hamano e4d45dd3bb Merge branch 'js/merge'
* js/merge:
  merge-recursive: add/add really is modify/modify with an empty base
  Get rid of the dependency on RCS' merge program
  merge-file: support -p and -q; fix compile warnings
  Add builtin merge-file, a minimal replacement for RCS merge
  xdl_merge(): fix and simplify conflict handling
  xdl_merge(): fix thinko
  xdl_merge(): fix an off-by-one bug
  merge-recursive: use xdl_merge().
  xmerge: make return value from xdl_merge() more usable.
  xdiff: add xdl_merge()
2006-12-13 10:46:23 -08:00
Junio C Hamano 37adac765a send-pack: tighten checks for remote names
"git push $URL HEAD~6" created a bogus ref HEAD~6 immediately
under $GIT_DIR of the remote repository.  While we should keep
refspecs that have arbitrary extended SHA-1 expression on the
source side working (e.g. "HEAD~6:refs/tags/yesterday"), we
should not create bogus ref on the other end.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 10:30:11 -08:00
Junio C Hamano 411fb8baa6 git-push: accept tag <tag> as advertised.
The documentation talked about "git push $URL tag <tag>" as a short-hand
for refs/tags/<tag>:refs/tags/<tag> for a long time but that was never
the case (the short-hand was for "git fetch").  Instead of fixing the
documentation, just add a bit of code to match it since it is easy to do
and would make it more consistent.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 10:04:01 -08:00
Junio C Hamano 7ef0435088 spurious .sp in manpages
This is just a random hack to work around problems people seem
to be seeing in manpage backend of xmlto (it appears we are
getting ".sp" at the end of line without line break).

Could people test this out?

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 09:41:18 -08:00
Junio C Hamano 0c4e95d083 git merge: reword failure message.
99.9999% of the time, the command is used with a single
strategy; after a merge failure, saying "No strategy handled the
merge" is technically correct, but there is no point stressing
we tried and failed all the possibilities the user has given.

Just say that it failed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 09:33:08 -08:00
Shawn Pearce 8371234eca Remove uncontested renamed files during merge.
Prior to 65ac6e9c3f we deleted a file
from the working directory during a merge if the file existed before
the merge started but was renamed by the branch being merged in.
This broke in 65ac6e as git-merge-recursive did not actually update
the working directory on an uncontested rename.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 09:13:21 -08:00
Junio C Hamano f2dd1c9adf Revert "git-diff: Introduce --index and deprecate --cached."
This reverts commit 4c81c213a4.

Although --cached and --index are confusing wording, the use of
word --cached for git-diff is consistent with git-apply.  It means
"work with index without looking at the working tree".

We should probably come up with better wording for --cached, if
somebody wants to deprecate it.  But making --index and --cached
synonyms for diff while leaving them mean different things for
apply is no good.
2006-12-13 02:03:11 -08:00
Junio C Hamano 1349f87713 Merge branch 'maint'
* maint:
  git-svn: correctly display fatal() error messages
  git-svn: exit with status 1 for test failures

Conflicts:

	git-svn.perl

nothing to commit
2006-12-13 02:00:39 -08:00
Eric Wong 155bd0ce23 git-svn: correctly display fatal() error messages
If I wanted to print $@, I'd pass $@ to fatal().  This looks like
a stupid typo on my part.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 01:51:35 -08:00
Eric Wong b42a044f59 git-svn: exit with status 1 for test failures
Some versions of the SVN libraries cause die() to exit with 255,
and 40cf043389 tightened up
test_expect_failure to reject return values >128.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 01:48:44 -08:00
Andy Parkins a159ca0cb7 Allow subcommand.color and color.subcommand color configuration
While adding colour to the branch command it was pointed out that a
config option like "branch.color" conflicts with the pre-existing
"branch.something" namespace used for specifying default merge urls and
branches.  The suggested solution was to flip the order of the
components to "color.branch", which I did for colourising branch.

This patch does the same thing for
  - git-log (color.diff)
  - git-status (color.status)
  - git-diff (color.diff)
  - pager (color.pager)

I haven't removed the old config options; but they should probably be
deprecated and eventually removed to prevent future namespace
collisions.  I've done this deprecation by changing the documentation
for the config file to match the new names; and adding the "color.XXX"
options to contrib/completion/git-completion.bash.

Unfortunately git-svn reads "diff.color" and "pager.color"; which I
don't like to change unilaterally.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 01:47:36 -08:00
Junio C Hamano 25fb629058 git-push: document removal of remote ref with :<dst> pathspec
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 01:11:05 -08:00
Johannes Schindelin f953831e03 merge-recursive: add/add really is modify/modify with an empty base
Unify the handling for cases C (add/add) and D (modify/modify).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 21:55:37 -08:00
Junio C Hamano 8042ed1ceb Merge branch 'master' into js/merge
* master: (42 commits)
  git-svn: correctly handle packed-refs in refs/remotes/
  add test case for recursive merge
  git-svn: correctly display fatal() error messages
  git-svn: allow dcommit to take an alternate head
  git-svn: enable logging of information not supported by git
  Clarify fetch error for missing objects.
  Move Fink and Ports check to after config file
  shortlog: fix segfault on empty authorname
  shortlog: remove "[PATCH]" prefix from shortlog output
  Make sure the empty tree exists when needed in merge-recursive.
  Don't use memcpy when source and dest. buffers may overlap
  no need to install manpages as executable
  Documentation: simpler shared repository creation
  shortlog: fix segfault on empty authorname
  Add branch.*.merge warning and documentation update
  Fix perl/ build.
  git-svn: use do_switch for --follow-parent if the SVN library supports it
  Fix documentation copy&paste typo
  git-svn: extra error check to ensure we open a file correctly
  Documentation: update git-clone man page with new behavior
  ...
2006-12-12 21:52:19 -08:00
Johannes Schindelin e2b7008752 Get rid of the dependency on RCS' merge program
Now that we have git-merge-file, an RCS merge lookalike, we no longer
need it. So long, merge, and thanks for all the fish!

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 21:47:29 -08:00
Eric Wong c53d696bcc git-svn: correctly handle packed-refs in refs/remotes/
We now use git-rev-parse universally to read refs, instead
of our own file_to_s function (which I plan on removing).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:26:23 -08:00
Junio C Hamano fa2376f3c8 Merge branch 'maint'
* maint:
  Clarify fetch error for missing objects.
  Move Fink and Ports check to after config file

Conflicts:

	Makefile
2006-12-12 17:07:33 -08:00
Junio C Hamano c93be3b539 add test case for recursive merge
This test case is based on the bug report by Shawn Pearce.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:05 -08:00
Eric Wong 6fda05aebe git-svn: correctly display fatal() error messages
If I wanted to print $@, I'd pass $@ to fatal().  This looks like
a stupid typo on my part.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:05 -08:00
Eric Wong dd31da2fdc git-svn: allow dcommit to take an alternate head
Previously dcommit would unconditionally commit all patches
up-to and including the current HEAD.  Now if an optional
command-line argument is specified, it will only commit
up to the specified revision.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:05 -08:00
Eric Wong d2a9a87b8a git-svn: enable logging of information not supported by git
The changes are now tracked in
  $GIT_DIR/svn/$GIT_SVN_ID/untracked.log

Information in the untracked.log include:
  * the addition and removal of empty directories
    (changes of these will also warn the user)
  * file and directory property changes, including (but not
    limited to) svk:merge and svn:externals
  * revision properties (revprops) are also tracked
  * users will be warned of 'absent' file and directories
    (if users are forbidden access)

Fields in entries are separated by spaces; "unsafe" characters
are URI-encoded so that each entry takes exactly one line.

There is currently no automated parser for dealing with the data
in untracked.log, but it should be possible to write one to
create empty directories on checkout and manage
externals/subprojects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:04 -08:00
Alex Riesen 0d7a6e4ef9 Clarify fetch error for missing objects.
Otherwise there're such things like:

    Cannot obtain needed none 9a6e87b60dbd2305c95cecce7d9d60f849a0658d
    while processing commit 0000000000000000000000000000000000000000.

which while looks weird. What is the none needed for?

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:04:40 -08:00
Brian Gernhardt 59f8674006 Move Fink and Ports check to after config file
Putting NO_FINK or NO_DARWIN_PORTS in config.mak is ignored because the
checks are done before the config is included.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 14:48:25 -08:00
Andy Parkins a1158caead Colourise git-branch output
I wanted to have a visual indication of which branches are local and
which are remote in git-branch -a output; however Junio was concerned
that someone might be using the output in a script.  This patch
addresses the problem by colouring the git-branch output - which in
"auto" mode won't be activated.

I've based it off the colouring code for builtin-diff.c; which means
there is a branch color configuration variable that needs setting to
something before the color will appear.

The colour parameter is "color.branch" rather than "branch.color" to
avoid clashing with the default namespace for default branch merge
definitions.

This patch chooses green for local, red for remote and bold green for
current.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:56:25 -08:00