Code

git.git
17 years agoupdate hook: redirect _both_ diagnostic lines to stderr upon tag failure
Jim Meyering [Thu, 28 Dec 2006 15:05:02 +0000 (16:05 +0100)]
update hook: redirect _both_ diagnostic lines to stderr upon tag failure

Otherwise, sending the diagnostic to stdout would provoke a
protocol failure.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoxdl_merge(): fix a segmentation fault when refining conflicts
Johannes Schindelin [Thu, 28 Dec 2006 16:13:33 +0000 (17:13 +0100)]
xdl_merge(): fix a segmentation fault when refining conflicts

The function xdl_refine_conflicts() tries to break down huge
conflicts by doing a diff on the conflicting regions. However,
this does not make sense when one side is empty.

Worse, when one side is not only empty, but after EOF, the code
accessed unmapped memory.

Noticed by Luben Tuikov, Shawn Pearce and Alexandre Julliard, the
latter providing a test case.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: sort multi-init output
Eric Wong [Thu, 28 Dec 2006 09:16:22 +0000 (01:16 -0800)]
git-svn: sort multi-init output

This looks a bit more pleasant for users.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: verify_ref() should actually --verify
Eric Wong [Thu, 28 Dec 2006 09:16:21 +0000 (01:16 -0800)]
git-svn: verify_ref() should actually --verify

Not sure how I missed this the first time around...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: print out the SVN library version in --version, too
Eric Wong [Thu, 28 Dec 2006 09:16:20 +0000 (01:16 -0800)]
git-svn: print out the SVN library version in --version, too

This could be useful in finding new problems and helping users
debug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: remove non-delta fetch code paths
Eric Wong [Thu, 28 Dec 2006 09:16:19 +0000 (01:16 -0800)]
git-svn: remove non-delta fetch code paths

We have less code to worry about now.  As a bonus, --revision
can be used to reliably skip parts of history whenever fetch is
run, not just the first time.  I'm not sure why anybody would
want to skip history in the middle, however...

For people (nearly everyone at the moment) without the
do_switch() function in their Perl SVN library, the entire tree
must be refetched if --follow-parent is used and a parent is
found.  Future versions of SVN will have a working do_switch()
function accessible via Perl.

Accessing repositories on the local machine (especially file://
ones) is also slightly slower as a result; but I suspect most
git-svn users will be using it to access remote repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot9200-git-cvsexportcommit.sh: quiet down commit
Eric Wong [Thu, 28 Dec 2006 09:10:52 +0000 (01:10 -0800)]
t9200-git-cvsexportcommit.sh: quiet down commit

Also, fixed an unportable use of 'export'.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agotest-lib: quiet down init-db output for tests
Eric Wong [Thu, 28 Dec 2006 09:10:51 +0000 (01:10 -0800)]
test-lib: quiet down init-db output for tests

I don't think anybody running tests needs to know they're
running init-db and creating a repository for testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot6024-recursive-merge: quiet down this test
Eric Wong [Thu, 28 Dec 2006 09:10:50 +0000 (01:10 -0800)]
t6024-recursive-merge: quiet down this test

We get an extra measure of error checking here as well.
While we're at it, also removed a less portable use of export.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'js/shallow'
Junio C Hamano [Thu, 28 Dec 2006 09:25:43 +0000 (01:25 -0800)]
Merge branch 'js/shallow'

* js/shallow:
  fetch-pack: Do not fetch tags for shallow clones.
  get_shallow_commits: Avoid memory leak if a commit has been reached already.
  git-fetch: Reset shallow_depth before auto-following tags.
  upload-pack: Check for NOT_SHALLOW flag before sending a shallow to the client.
  fetch-pack: Properly remove the shallow file when it becomes empty.
  shallow clone: unparse and reparse an unshallowed commit
  Why didn't we mark want_obj as ~UNINTERESTING in the old code?
  Why does it mean we do not have to register shallow if we have one?
  We should make sure that the protocol is still extensible.
  add tests for shallow stuff
  Shallow clone: do not ignore shallowness when following tags
  allow deepening of a shallow repository
  allow cloning a repository "shallowly"
  support fetching into a shallow repository
  upload-pack: no longer call rev-list

17 years agoAllow git-merge to select the default strategy.
Shawn O. Pearce [Thu, 28 Dec 2006 07:35:11 +0000 (02:35 -0500)]
Allow git-merge to select the default strategy.

Now that git-merge knows how to use the pull.{twohead,octopus}
configuration options to select the default merge strategy there
is no reason for git-pull to do the same immediately prior to
invoking git-merge.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoHonor pull.{twohead,octopus} in git-merge.
Shawn O. Pearce [Thu, 28 Dec 2006 07:35:05 +0000 (02:35 -0500)]
Honor pull.{twohead,octopus} in git-merge.

If git-merge is invoked without a strategy argument it is probably
being run as a porcelain-ish command directly and is not being run
from within git-pull.  However we still should honor whatever merge
strategy the user may have selected in their configuration, just as
`git-pull .` would have.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoEnsure `git-pull` fails if `git-merge` fails.
Shawn O. Pearce [Thu, 28 Dec 2006 07:35:01 +0000 (02:35 -0500)]
Ensure `git-pull` fails if `git-merge` fails.

If git-merge exits with a non-zero exit status so should git-pull.
This way the caller of git-pull knows the task did not complete
successfully simply by checking the process exit status.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoUse branch names in 'git-rebase -m' conflict hunks.
Shawn O. Pearce [Thu, 28 Dec 2006 07:34:56 +0000 (02:34 -0500)]
Use branch names in 'git-rebase -m' conflict hunks.

If a three-way merge in git-rebase generates a conflict then we
should take advantage of git-merge-recursive's ability to include
the branch name of each side of the conflict hunk by setting the
GITHEAD_* environment variables.

In the case of rebase there aren't really two clear branches; we
have the branch we are rebasing onto, and we have the branch we are
currently rebasing.  Since most conflicts will be arising between
the user's current branch and the branch they are rebasing onto
we assume the stuff that isn't in the current commit is the "onto"
branch and the stuff in the current commit is the "current" branch.

This assumption may however come up wrong if the user resolves one
conflict in such a way that it conflicts again on a future commit
also being rebased.  In this case the user's prior resolution will
appear to be in the "onto" part of the hunk.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoHonor GIT_REFLOG_ACTION in git-rebase.
Shawn O. Pearce [Thu, 28 Dec 2006 07:34:52 +0000 (02:34 -0500)]
Honor GIT_REFLOG_ACTION in git-rebase.

To help correctly log actions caused by porcelain which invoke
git-reset directly we should honor the setting of GIT_REFLOG_ACTION
which we inherited from our caller.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoUse GIT_REFLOG_ACTION environment variable instead.
Shawn O. Pearce [Thu, 28 Dec 2006 07:34:48 +0000 (02:34 -0500)]
Use GIT_REFLOG_ACTION environment variable instead.

Junio rightly pointed out that the --reflog-action parameter
was starting to get out of control, as most porcelain code
needed to hand it to other porcelain and plumbing alike to
ensure the reflog contained the top-level user action and
not the lower-level actions it invoked.

At Junio's suggestion we are introducing the new set_reflog_action
function to all shell scripts, allowing them to declare early on
what their default reflog name should be, but this setting only
takes effect if the caller has not already set the GIT_REFLOG_ACTION
environment variable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Precompile CGI routines for mod_perl
Jakub Narebski [Wed, 27 Dec 2006 23:00:52 +0000 (00:00 +0100)]
gitweb: Precompile CGI routines for mod_perl

Following advice from CGI(3pm) man page, precompile all CGI routines
for mod_perl, in the BEGIN block.

  If you want to compile without importing use the compile() method
  instead:

    use CGI();
    CGI->compile();

  This is particularly useful in a mod_perl environment, in which you
  might want to precompile all CGI routines in a startup script, and then
  import the functions individually in each mod_perl script.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Add mod_perl version string to "generator" meta header
Jakub Narebski [Wed, 27 Dec 2006 22:59:51 +0000 (23:59 +0100)]
gitweb: Add mod_perl version string to "generator" meta header

Add mod_perl version string (the value of $ENV{'MOD_PERL'} if it is
set) to "generator" meta header.

The purpose of this is to identify version of gitweb, now that
codepath may differ for gitweb run as CGI script, run under
mod_perl 1.0 and run under mod_perl 2.0.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'sp/gc'
Junio C Hamano [Thu, 28 Dec 2006 00:43:15 +0000 (16:43 -0800)]
Merge branch 'sp/gc'

* sp/gc:
  Use 'repack -a -d -l' instead of 'repack -a -d' in git-gc
  everyday: replace a few 'prune' and 'repack' with 'gc'
  Create 'git gc' to perform common maintenance operations.

17 years agoSet NO_MMAP for Cygwin by default
Junio C Hamano [Wed, 27 Dec 2006 23:12:31 +0000 (15:12 -0800)]
Set NO_MMAP for Cygwin by default

This should not be necessary for people who only use NTFS, but for
people with FAT32 it seems to be an issue.  Let's ship with a safer
default.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoUse 'repack -a -d -l' instead of 'repack -a -d' in git-gc
Junio C Hamano [Wed, 27 Dec 2006 22:23:21 +0000 (14:23 -0800)]
Use 'repack -a -d -l' instead of 'repack -a -d' in git-gc

Otherwise we would end up slurping objects we borrow from
alternates.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Re-enable rev-list --parents for parse_commit.
Robert Fitzsimons [Wed, 27 Dec 2006 14:22:21 +0000 (14:22 +0000)]
gitweb: Re-enable rev-list --parents for parse_commit.

Re-enable rev-list --parents for parse_commit which was removed in
(208b2dff95bb48682c351099023a1cbb0e1edf26).  rev-list --parents is not
just used to return the parent headers in the commit object, it
includes any grafts which are vaild for the commit.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-send-email: default value for "From:" field.
Quy Tonthat [Wed, 27 Dec 2006 14:16:21 +0000 (01:16 +1100)]
git-send-email: default value for "From:" field.

If user hits enter at the prompt for
"Who should the emails appear to be from?",
the value for "From:" field was emptied instead of GIT_COMMITER_IDENT.

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'master' into js/shallow
Junio C Hamano [Wed, 27 Dec 2006 10:43:46 +0000 (02:43 -0800)]
Merge branch 'master' into js/shallow

This is to adjust to:

  count-objects -v: show number of packs as well.

which will break a test in this series.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoeveryday: replace a few 'prune' and 'repack' with 'gc'
Junio C Hamano [Wed, 27 Dec 2006 10:00:30 +0000 (02:00 -0800)]
everyday: replace a few 'prune' and 'repack' with 'gc'

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoCreate 'git gc' to perform common maintenance operations.
Shawn O. Pearce [Wed, 27 Dec 2006 07:17:59 +0000 (02:17 -0500)]
Create 'git gc' to perform common maintenance operations.

Junio asked for a 'git gc' utility which users can execute on a
regular basis to perform basic repository actions such as:

 * pack-refs --prune
 * reflog expire
 * repack -a -d
 * prune
 * rerere gc

So here is a command which does exactly that.  The parameters fed
to reflog's expire subcommand can be chosen by the user by setting
configuration options in .git/config (or ~/.gitconfig), as users may
want different expiration windows for each repository but shouldn't
be bothered to remember what they are all of the time.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-reflog: gc.* configuration and documentation.
Junio C Hamano [Wed, 27 Dec 2006 09:47:57 +0000 (01:47 -0800)]
git-reflog: gc.* configuration and documentation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agorerere gc: honor configuration and document it
Junio C Hamano [Wed, 27 Dec 2006 09:24:05 +0000 (01:24 -0800)]
rerere gc: honor configuration and document it

Two configuration to control the expiration of rerere records
are introduced and documented.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agocount-objects -v: show number of packs as well.
Junio C Hamano [Wed, 27 Dec 2006 09:04:03 +0000 (01:04 -0800)]
count-objects -v: show number of packs as well.

Recent "git push" keeps transferred objects packed much more aggressively
than before.  Monitoring output from git-count-objects -v for number of
loose objects is not enough to decide when to repack -- having too many
small packs is also a good cue for repacking.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'jc/fsck-reflog'
Junio C Hamano [Wed, 27 Dec 2006 07:47:40 +0000 (23:47 -0800)]
Merge branch 'jc/fsck-reflog'

* jc/fsck-reflog:
  Add git-reflog to .gitignore
  reflog expire: do not punt on tags that point at non commits.
  reflog expire: prune commits that are not incomplete
  Don't crash during repack of a reflog with pruned commits.
  git reflog expire
  Move in_merge_bases() to commit.c
  reflog: fix warning message.
  Teach git-repack to preserve objects referred to by reflog entries.
  Protect commits recorded in reflog from pruning.
  add for_each_reflog_ent() iterator

17 years agoeveryday: update for v1.5.0
Junio C Hamano [Wed, 27 Dec 2006 06:42:33 +0000 (22:42 -0800)]
everyday: update for v1.5.0

Fix minor mark-up mistakes and adjust to v1.5.0 BCP, namely:

 - use "git add" instead of "git update-index";
 - use "git merge" instead of "git pull .";
 - use separate remote layout;
 - use config instead of remotes/origin file;

Also updates "My typical git day" example since now I have
'next' branch these days.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: dcommit should diff against the current HEAD after committing
Eric Wong [Wed, 27 Dec 2006 00:27:38 +0000 (16:27 -0800)]
git-svn: dcommit should diff against the current HEAD after committing

This is a followup to dd31da2fdc199132c9fd42023aea5b33672d73cc.
Regardless of whether we commit an alternate head, we always
diff-tree based on the current HEAD, and rebase against our
remote reference as necessary.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: quiet down tests and fix some unportable shell constructs
Eric Wong [Wed, 27 Dec 2006 00:27:37 +0000 (16:27 -0800)]
git-svn: quiet down tests and fix some unportable shell constructs

The latest changes to git-commit have made it more verbose; and
I was running the setup of the tests outside of the test_expect_*,
so errors in those were not caught.  Now we move them to where
they can be eval'ed and have their output trapped.

export var=value has been removed

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agohooks/commit-msg: add example to add Signed-off-by line to message
Andy Parkins [Thu, 21 Dec 2006 09:24:17 +0000 (09:24 +0000)]
hooks/commit-msg: add example to add Signed-off-by line to message

After checking to see if the commit message already has the target
signed-off-by (for example in --amend commits), this patch generates a
signed off by line from the repository owner and adds it to the commit
message.

Based on Johannes Schindelin's earlier patch to perform the same
function.

Originally, this was done in the pre-commit hook but Junio pointed out
that the commit-msg hook allows the message to be edited.  This has the
aditional advantage that the commit-msg hook gets passed the name of the
message file as a parameter, so it doesn't have to figure out GIT_DIR for
itself.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agomove git-blame to its place in .gitignore
Nicolas Pitre [Tue, 26 Dec 2006 20:14:18 +0000 (12:14 -0800)]
move git-blame to its place in .gitignore

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAdd git-reflog to .gitignore
Nicolas Pitre [Tue, 26 Dec 2006 19:08:08 +0000 (14:08 -0500)]
Add git-reflog to .gitignore

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDocument git-reset <commit> -- <paths>...
Junio C Hamano [Tue, 26 Dec 2006 08:21:01 +0000 (00:21 -0800)]
Document git-reset <commit> -- <paths>...

17 years agoDocument --numstat in git-apply and git-diff
Junio C Hamano [Tue, 26 Dec 2006 08:15:26 +0000 (00:15 -0800)]
Document --numstat in git-apply and git-diff

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoshow-branch --reflog: add documentation.
Junio C Hamano [Tue, 26 Dec 2006 08:11:50 +0000 (00:11 -0800)]
show-branch --reflog: add documentation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoadd .mailmap for git-shortlog output with the git repository
Nicolas Pitre [Tue, 26 Dec 2006 04:25:44 +0000 (23:25 -0500)]
add .mailmap for git-shortlog output with the git repository

The git repository itself was messed up in a couple cases.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoGIT v1.5.0 preview v1.5.0-rc0
Junio C Hamano [Tue, 26 Dec 2006 02:14:12 +0000 (18:14 -0800)]
GIT v1.5.0 preview

This is not yet -rc1 where all new topics closes, but I think it
is getting pretty closer.  I'd still want to merge updates to
fsck/prune to honor reflog entries before -rc1.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'jc/bm'
Junio C Hamano [Tue, 26 Dec 2006 02:08:01 +0000 (18:08 -0800)]
Merge branch 'jc/bm'

* jc/bm:
  Allow branch.*.merge to talk about remote tracking branches.

17 years agoMerge branch 'rf/web'
Junio C Hamano [Tue, 26 Dec 2006 02:02:39 +0000 (18:02 -0800)]
Merge branch 'rf/web'

* rf/web:
  gitweb: Use rev-list --skip option.
  gitweb: Change history action to use parse_commits.
  gitweb: Change atom, rss actions to use parse_commits.
  gitweb: Change header search action to use parse_commits.
  gitweb: Change log action to use parse_commits.
  gitweb: Change summary, shortlog actions to use parse_commits.
  gitweb: We do longer need the --parents flag in rev-list.
  gitweb: Add parse_commits, used to bulk load commit objects.

17 years agogit-add -f: allow adding otherwise ignored files.
Junio C Hamano [Tue, 26 Dec 2006 01:46:38 +0000 (17:46 -0800)]
git-add -f: allow adding otherwise ignored files.

Instead of just warning, refuse to add otherwise ignored files
by default, and allow it with an -f option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Use rev-list --skip option.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:49 +0000 (14:31 +0000)]
gitweb: Use rev-list --skip option.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Change history action to use parse_commits.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:48 +0000 (14:31 +0000)]
gitweb: Change history action to use parse_commits.

Also added missing accesskey.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Change atom, rss actions to use parse_commits.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:47 +0000 (14:31 +0000)]
gitweb: Change atom, rss actions to use parse_commits.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Change header search action to use parse_commits.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:46 +0000 (14:31 +0000)]
gitweb: Change header search action to use parse_commits.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Change log action to use parse_commits.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:45 +0000 (14:31 +0000)]
gitweb: Change log action to use parse_commits.

Also add missing next link to bottom of page.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Change summary, shortlog actions to use parse_commits.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:44 +0000 (14:31 +0000)]
gitweb: Change summary, shortlog actions to use parse_commits.

Also added missing accesskey.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: We do longer need the --parents flag in rev-list.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:43 +0000 (14:31 +0000)]
gitweb: We do longer need the --parents flag in rev-list.

We only want to know the direct parents of a given commit object,
these parents are available in the --header output of rev-list.  If
--parents is supplied with --full-history the output includes merge
commits that aren't relevant.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Add parse_commits, used to bulk load commit objects.
Robert Fitzsimons [Sun, 24 Dec 2006 14:31:42 +0000 (14:31 +0000)]
gitweb: Add parse_commits, used to bulk load commit objects.

Add a new method parse_commits which is able to parse multiple commit
objects at once.  Reworked parse_commit to share the commit object
parsing logic.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-add: warn when adding an ignored file with an explicit request.
Junio C Hamano [Mon, 25 Dec 2006 18:38:35 +0000 (10:38 -0800)]
git-add: warn when adding an ignored file with an explicit request.

We allow otherwise ignored paths to be added to the index by
spelling its path out on the command line, but we would warn the
user about them when we do so.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-add: add ignored files when asked explicitly.
Junio C Hamano [Mon, 25 Dec 2006 11:13:45 +0000 (03:13 -0800)]
git-add: add ignored files when asked explicitly.

One thing many people found confusing about git-add was that a
file whose name matches an ignored pattern could not be added to
the index.  With this, such a file can be added by explicitly
spelling its name to git-add.

Fileglobs and recursive behaviour do not add ignored files to
the index.  That is, if a pattern '*.o' is in .gitignore, and
two files foo.o, bar/baz.o are in the working tree:

    $ git add foo.o
    $ git add '*.o'
    $ git add bar

Only the first form adds foo.o to the index.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoread_directory: show_both option.
Junio C Hamano [Mon, 25 Dec 2006 11:11:34 +0000 (03:11 -0800)]
read_directory: show_both option.

This teaches the internal read_directory() routine to return
both interesting and ignored pathnames.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-rm: Documentation
Junio C Hamano [Mon, 25 Dec 2006 11:23:45 +0000 (03:23 -0800)]
git-rm: Documentation

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot3600: update the test for updated git rm
Junio C Hamano [Mon, 25 Dec 2006 11:11:17 +0000 (03:11 -0800)]
t3600: update the test for updated git rm

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-rm: update to saner semantics
Junio C Hamano [Mon, 25 Dec 2006 11:11:00 +0000 (03:11 -0800)]
git-rm: update to saner semantics

This updates the "git rm" command with saner semantics suggested
on the list earlier with:

Message-ID: <Pine.LNX.4.64.0612020919400.3476@woody.osdl.org>
Message-ID: <Pine.LNX.4.64.0612040737120.3476@woody.osdl.org>

The command still validates that the given paths all talk about
sensible paths to avoid mistakes (e.g. "git rm fiel" when file
"fiel" does not exist would error out -- user meant to remove
"file"), and it has further safety checks described next.  The
biggest difference is that the paths are removed from both index
and from the working tree (if you have an exotic need to remove
paths only from the index, you can use the --cached option).

The command refuses to remove if the copy on the working tree
does not match the index, or if the index and the HEAD does not
match.  You can defeat this check with -f option.

This safety check has two exceptions: if the working tree file
does not exist to begin with, that technically does not match
the index but it is allowed.  This is to allow this CVS style
command sequence:

rm <path> && git rm <path>

Also if the index is unmerged at the <path>, you can use "git rm
<path>" to declare that the result of the merge loses that path,
and the above safety check does not trigger; requiring the file
to match the index in this case forces the user to do "git
update-index file && git rm file", which is just crazy.

To recursively remove all contents from a directory, you need to
pass -r option, not just the directory name as the <path>.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agomatch_pathspec() -- return how well the spec matched
Junio C Hamano [Mon, 25 Dec 2006 11:09:52 +0000 (03:09 -0800)]
match_pathspec() -- return how well the spec matched

This updates the return value from match_pathspec() so that the
caller can tell cases between exact match, leading pathname
match (i.e. file "foo/bar" matches a pathspec "foo"), or
filename glob match.  This can be used to prevent "rm dir" from
removing "dir/file" without explicitly asking for recursive
behaviour with -r flag, for example.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'jc/skip-count'
Junio C Hamano [Mon, 25 Dec 2006 11:27:41 +0000 (03:27 -0800)]
Merge branch 'jc/skip-count'

* jc/skip-count:
  revision: --skip=<n>

17 years agoMerge branch 'jc/git-add--interactive'
Junio C Hamano [Mon, 25 Dec 2006 09:31:17 +0000 (01:31 -0800)]
Merge branch 'jc/git-add--interactive'

* jc/git-add--interactive:
  git-add --interactive: add documentation
  git-add --interactive: hunk splitting
  git-add --interactive

17 years agogit-add --interactive: add documentation
Junio C Hamano [Mon, 25 Dec 2006 09:30:55 +0000 (01:30 -0800)]
git-add --interactive: add documentation

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAllow branch.*.merge to talk about remote tracking branches.
Junio C Hamano [Sun, 24 Dec 2006 09:59:53 +0000 (01:59 -0800)]
Allow branch.*.merge to talk about remote tracking branches.

People often get confused if the value of branch.*.merge should
be the remote branch name they are fetching from, or the
tracking branch they locally have.  So this allows either.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'sb/merge-friendly'
Junio C Hamano [Sun, 24 Dec 2006 10:18:35 +0000 (02:18 -0800)]
Merge branch 'sb/merge-friendly'

* sb/merge-friendly:
  Display 'theirs' branch name when possible in merge.
  Use extended SHA1 syntax in merge-recursive conflicts.

17 years agoMerge branch 'js/rerere'
Junio C Hamano [Sun, 24 Dec 2006 10:10:55 +0000 (02:10 -0800)]
Merge branch 'js/rerere'

* js/rerere:
  Make git-rerere a builtin
  Add a test for git-rerere
  move read_mmfile() into xdiff-interface

17 years agocommit-tree: encourage UTF-8 commit messages.
Johannes Schindelin [Fri, 22 Dec 2006 21:06:08 +0000 (22:06 +0100)]
commit-tree: encourage UTF-8 commit messages.

Introduce is_utf() to check if a text looks like it is encoded
in UTF-8, utf8_width() to count display width, and implements
print_wrapped_text() using them.

git-commit-tree warns if the commit message does not minimally
conform to the UTF-8 encoding when i18n.commitencoding is either
unset, or set to "utf-8".

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoSwitch git_mmap to use pread.
Shawn O. Pearce [Sun, 24 Dec 2006 05:45:47 +0000 (00:45 -0500)]
Switch git_mmap to use pread.

Now that Git depends on pread in index-pack its safe to say we can
also depend on it within the git_mmap emulation we activate when
NO_MMAP is set.  On most systems pread should be slightly faster
than an lseek/read/lseek sequence as its one system call vs. three
system calls.

We also now honor EAGAIN and EINTR error codes from pread and
restart the prior read.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoRename gitfakemmap to git_mmap.
Shawn O. Pearce [Sun, 24 Dec 2006 05:45:37 +0000 (00:45 -0500)]
Rename gitfakemmap to git_mmap.

This minor cleanup was suggested by Johannes Schindelin.

The mmap is still fake in the sense that we don't support PROT_WRITE
or MAP_SHARED with external modification at all, but that hasn't
stopped us from using mmap() thoughout the Git code.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Paginate commit/author/committer search output
Robert Fitzsimons [Sat, 23 Dec 2006 14:57:12 +0000 (14:57 +0000)]
gitweb: Paginate commit/author/committer search output

Paginate commit/author/committer search output to only show 100 commits
at a time, added appropriate nav links.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMakefile: add quick-install-doc for installing pre-built manpages
Eric Wong [Sat, 23 Dec 2006 16:26:09 +0000 (08:26 -0800)]
Makefile: add quick-install-doc for installing pre-built manpages

This adds and uses the install-doc-quick.sh file to
Documentation/, which is usable for people who track either the
'html' or 'man' heads in Junio's repository (prefixed with
'origin/' if cloned locally).  You may override this by
specifying DOC_REF in the make environment or in config.mak.

GZ may also be set in the environment (or config.mak) if you
wish to gzip the documentation after installing it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDisplay 'theirs' branch name when possible in merge.
Shawn O. Pearce [Sat, 23 Dec 2006 08:44:47 +0000 (03:44 -0500)]
Display 'theirs' branch name when possible in merge.

Displaying the SHA1 of 'their' branch (the branch being merged into
the current branch) is not nearly as friendly as just displaying
the name of that branch, especially if that branch is already local
to this repository.

git-merge now sets the environment variable 'GITHEAD_%(sha1)=%(name)'
for each argument it gets passed, making the actual input name that
resolved to the commit '%(sha1)' easily available to the invoked
merge strategy.

git-merge-recursive makes use of these environment variables when
they are available by using '%(name)' whenever it outputs the commit
identification rather than '%(sha1)'.  This is most obvious in the
conflict hunks created by xdl_merge:

  $ git mege sideb~1
  <<<<<<< HEAD:INSTALL
     Good!
  =======
     Oops.
  >>>>>>> sideb~1:INSTALL

[jc: adjusted a test script and a minor constness glitch.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoUse extended SHA1 syntax in merge-recursive conflicts.
Shawn O. Pearce [Sat, 23 Dec 2006 08:44:00 +0000 (03:44 -0500)]
Use extended SHA1 syntax in merge-recursive conflicts.

When we get a line-level conflict in merge-recursive and print out
the two sides in the conflict hunk header and footer we should use
the standard extended SHA1 syntax to specify the specific blob,
as this allows the user to copy and paste the line right into
'git show' to view the complete version.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoreflog expire: do not punt on tags that point at non commits.
Junio C Hamano [Sat, 23 Dec 2006 07:42:30 +0000 (23:42 -0800)]
reflog expire: do not punt on tags that point at non commits.

It is unusual for a tag to point at a non-commit, and it is also
unusual for a tag to have reflog, but that is not an error and
we should still prune its reflog entries just as other refs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Allow search to be disabled from the config file.
Robert Fitzsimons [Sat, 23 Dec 2006 03:35:16 +0000 (03:35 +0000)]
gitweb: Allow search to be disabled from the config file.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Require a minimum of two character for the search text.
Robert Fitzsimons [Sat, 23 Dec 2006 03:35:15 +0000 (03:35 +0000)]
gitweb: Require a minimum of two character for the search text.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Use rev-list pattern search options.
Robert Fitzsimons [Sat, 23 Dec 2006 03:35:14 +0000 (03:35 +0000)]
gitweb: Use rev-list pattern search options.

Use rev-list pattern search options instead of hand coded perl.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agocheckout: make the message about the need for a new branch a bit clearer
Nicolas Pitre [Fri, 22 Dec 2006 20:06:54 +0000 (15:06 -0500)]
checkout: make the message about the need for a new branch a bit clearer

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: optimize git_summary.
Robert Fitzsimons [Fri, 22 Dec 2006 19:38:15 +0000 (19:38 +0000)]
gitweb: optimize git_summary.

We don't need to call git_get_head_hash at all just pass in "HEAD" and
use the return id field.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: optimize git_shortlog_body.
Robert Fitzsimons [Fri, 22 Dec 2006 19:38:14 +0000 (19:38 +0000)]
gitweb: optimize git_shortlog_body.

Don't call gitweb_have_snapshot from within the loop.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: optimize git_get_last_activity.
Robert Fitzsimons [Fri, 22 Dec 2006 19:38:13 +0000 (19:38 +0000)]
gitweb: optimize git_get_last_activity.

Only return one line of output and we don't need the refname value.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogitweb: Add missing show '...' links change.
Robert Fitzsimons [Fri, 22 Dec 2006 19:38:12 +0000 (19:38 +0000)]
gitweb: Add missing show '...' links change.

Part of the patch for "gitweb: Show '...' links in "summary" view only
if there are more items" (313ce8cee665447e4476d7e8985b270346a8e5a1) is
missing.  Add it back in.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMake git-show-branch options similar to git-branch.
Brian Gernhardt [Fri, 22 Dec 2006 13:58:39 +0000 (08:58 -0500)]
Make git-show-branch options similar to git-branch.

Branch has "-r" for remote branches and "-a" for local and remote.
It seems logical to mirror that in show-branch.  Also removes the
dubiously useful "--tags" option (as part of changing the meaning
for "--all").

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoKeep "git --git-dir" from causing a bus error.
Brian Gernhardt [Fri, 22 Dec 2006 13:56:25 +0000 (08:56 -0500)]
Keep "git --git-dir" from causing a bus error.

The option checking code for --git-dir had an off by 1 error that
would cause it to access uninitialized memory if it was the last
argument.  This causes it to display an error and display the usage
string instead.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-svn: enable common fetch/commit options for dcommit
Eric Wong [Sat, 23 Dec 2006 05:59:24 +0000 (21:59 -0800)]
git-svn: enable common fetch/commit options for dcommit

dcommit does commits and fetches, so all options used for those
should work, too, including --authors-file.

Reported missing by Nicolas Vilz.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agovc-git: Ignore errors caused by a non-existent directory in vc-git-registered.
Alexandre Julliard [Fri, 22 Dec 2006 13:56:15 +0000 (14:56 +0100)]
vc-git: Ignore errors caused by a non-existent directory in vc-git-registered.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoRemove NO_ACCURATE_DIFF options from build systems
Eric Wong [Sat, 23 Dec 2006 06:18:03 +0000 (22:18 -0800)]
Remove NO_ACCURATE_DIFF options from build systems

The code no longer uses it, as we have --inaccurate-eof in
git-apply.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-tag: lose exit after die
Junio C Hamano [Sat, 23 Dec 2006 06:48:46 +0000 (22:48 -0800)]
git-tag: lose exit after die

We are not running under /bin/resurrection shell ;-)

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoReally fix headers for __FreeBSD__
Junio C Hamano [Sat, 23 Dec 2006 06:46:11 +0000 (22:46 -0800)]
Really fix headers for __FreeBSD__

The symbol to detect FreeBSD is __FreeBSD__, not __FreeBSD.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDo not support "partial URL shorthand" anymore.
Junio C Hamano [Fri, 22 Dec 2006 23:37:48 +0000 (15:37 -0800)]
Do not support "partial URL shorthand" anymore.

We used to support specifying the top part of remote URL in
remotes and use that as a short-hand for the URL.

$ cat .git/remotes/jgarzik
URL: git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/
$ git pull jgarzik/misc-2.6

This is confusing when somebody attempts to do this:

$ git pull origin/foo

which is not syntactically correct (unless you have origin/foo.git
repository) and should fail, but it resulted in a mysterious
access to the 'foo' subdirectory of the origin repository.

Which was what it was designed to do, but because this is an
oddball "feature" I suspect nobody uses, let's remove it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agodefault pull: forget about "newbie protection" for now.
Junio C Hamano [Fri, 22 Dec 2006 23:25:21 +0000 (15:25 -0800)]
default pull: forget about "newbie protection" for now.

This will not be backward compatible no matter how you cut it.
Shelve it for now until somebody comes up with a better way to
determine when we can safely refuse to use the first set of
branchse for merging without upsetting valid workflows.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agomerge and reset: adjust for "reset --hard" messages
Junio C Hamano [Fri, 22 Dec 2006 23:21:55 +0000 (15:21 -0800)]
merge and reset: adjust for "reset --hard" messages

An earlier commit made "reset --hard" chattier but leaking its
message from "git rebase" (which calls it when first rewinding
the current branch to prepare replaying our own changes) without
explanation was confusing, so add an extra message to mention
it.  Inside restorestate in merge (which is rarely exercised
codepath, where more than one strategies are attempted),
resetting to the original state uses "reset --hard" -- this can
be squelched entirely.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoreflog expire: prune commits that are not incomplete
Junio C Hamano [Fri, 22 Dec 2006 08:46:33 +0000 (00:46 -0800)]
reflog expire: prune commits that are not incomplete

Older fsck-objects and prune did not protect commits in reflog
entries, and it is quite possible that a commit still exists in
the repository (because it was in a pack, or something) while
some of its trees and blobs are long gone.  Make sure the commit
and its associated tree is complete and expire incomplete ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agocommit-tree: do not overflow MAXPARENT
Junio C Hamano [Fri, 22 Dec 2006 07:49:13 +0000 (23:49 -0800)]
commit-tree: do not overflow MAXPARENT

We have a static allocation of MAXPARENT, but that limit was not
enforced, other than by a lucky invocation of the program segfaulting.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMake git-rerere a builtin
Johannes Schindelin [Wed, 20 Dec 2006 16:39:41 +0000 (17:39 +0100)]
Make git-rerere a builtin

The perl version used modules which are non-standard in some setups.
This patch brings the full power of rerere to a wider audience.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAdd a test for git-rerere
Johannes Schindelin [Thu, 21 Dec 2006 09:21:28 +0000 (10:21 +0100)]
Add a test for git-rerere

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agomove read_mmfile() into xdiff-interface
Johannes Schindelin [Wed, 20 Dec 2006 16:37:07 +0000 (17:37 +0100)]
move read_mmfile() into xdiff-interface

read_file() was a useful function if you want to work with the xdiff stuff,
so it was renamed and put into a more central place.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDon't crash during repack of a reflog with pruned commits.
Shawn O. Pearce [Fri, 22 Dec 2006 00:49:06 +0000 (19:49 -0500)]
Don't crash during repack of a reflog with pruned commits.

If the user has been using reflog for a long time (e.g. since its
introduction) then it is very likely that an existing branch's
reflog may still mention commits which have long since been pruned
out of the repository.

Rather than aborting with a very useless error message during
git-repack, pack as many valid commits as we can get from the
reflog and let the user know that the branch's reflog contains
already pruned commits.  A future 'git reflog expire' (or whatever
it finally winds up being called) can then be performed to expunge
those reflog entries.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'master' into jc/fsck-reflog
Junio C Hamano [Fri, 22 Dec 2006 07:01:45 +0000 (23:01 -0800)]
Merge branch 'master' into jc/fsck-reflog

* master:
  Introduce a global level warn() function.
  Rename imap-send's internal info/warn functions.
  _XOPEN_SOURCE problem also exists on FreeBSD
  parse-remote: mark all refs not for merge only when fetching more than one
  git-reset --hard: tell the user what the HEAD was reset to
  git-tag: support -F <file> option
  Revert "git-pull: refuse default merge without branch.*.merge"
  Suggest 'add' in am/revert/cherry-pick.
  Use git-merge-file in git-merge-one-file, too
  diff --check: fix off by one error
  Documentation/git-branch: new -r to delete remote-tracking branches.
  Fix system header problems on Mac OS X
  spurious .sp in manpages

17 years agoIntroduce a global level warn() function.
Shawn O. Pearce [Fri, 22 Dec 2006 00:48:32 +0000 (19:48 -0500)]
Introduce a global level warn() function.

Like the existing error() function the new warn() function can be
used to describe a situation that probably should not be occuring,
but which the user (and Git) can continue to work around without
running into too many problems.

An example situation is a bad commit SHA1 found in a reflog.
Attempting to read this record out of the reflog isn't really an
error as we have skipped over it in the past.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoRename imap-send's internal info/warn functions.
Shawn O. Pearce [Fri, 22 Dec 2006 00:48:12 +0000 (19:48 -0500)]
Rename imap-send's internal info/warn functions.

Because I am about to introduce a global warn() function (much
like the global error function) this global declaration would
conflict with the one supplied by imap-send.  Further since
imap-send's warn function output depends on its Quiet setting
we cannot simply remove its internal definition and use the
forthcoming global one.

So refactor warn() -> imap_warn() and info() -> imap_info()
(the latter was done just to be consistent in naming).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>