Code

git.git
15 years agomergetool: Add a test for running mergetool in a sub-directory
Charles Bailey [Fri, 30 Jan 2009 23:20:10 +0000 (23:20 +0000)]
mergetool: Add a test for running mergetool in a sub-directory

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot3412: clean up GIT_EDITOR usage
Thomas Rast [Fri, 30 Jan 2009 22:47:00 +0000 (23:47 +0100)]
t3412: clean up GIT_EDITOR usage

a6c7a27 (rebase -i: correctly remember --root flag across --continue,
2009-01-26) introduced a more portable GIT_EDITOR usage, but left the
old tests unchanged.

Since we never use the editor (all tests run the rebase script as
proposed by rebase -i), just disable it outright, which simplifies the
tests.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-shortlog.txt: fix example about .mailmap
Michele Ballabio [Fri, 30 Jan 2009 16:55:24 +0000 (17:55 +0100)]
git-shortlog.txt: fix example about .mailmap

In the example, Joe Developer has <joe@example.com> as his email,
but in the .mailmap is <joe@random.com>. Use example.com instead.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-cvsserver: run post-update hook *after* update.
Stefan Karpinski [Thu, 29 Jan 2009 21:58:02 +0000 (13:58 -0800)]
git-cvsserver: run post-update hook *after* update.

CVS server was running the hook before the update action was
actually done. This performs the update before the hook is called.

The original commit that introduced the current incorrect behavior
was 394d66d "git-cvsserver runs hooks/post-update". The error in
ordering of the hook call appears to have gone unnoticed, but since
git-cvsserver is supposed to emulate receive-pack, it stands to
reason that the hook should be run *after* the update. Since this
behavior is inconsistent with recieve-pack, users are either:

  1) not using post-update hooks with git-cvsserver;
  2) using post-update hooks that don't care whether they are
     called before or after the actual update occurs;
  3) using post-update hooks *only* with git-cvsserver, and
     relying on the hook being called just before the update.

This patch would affect only users in case 3. These users are
depending on fairly obviously wrong behavior, and moreover they can
simply change their current post-update into post-recieve hooks,
and their systems will work correctly again.

Signed-off-by: Stefan Karpinski <stefan.karpinski@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix 'git diff --no-index' with a non-existing symlink target
Johannes Schindelin [Thu, 29 Jan 2009 16:30:51 +0000 (17:30 +0100)]
Fix 'git diff --no-index' with a non-existing symlink target

When trying to find out mode changes, we should not access the symlink
targets using stat(); instead we use lstat() so that the diff does
not fail trying to find a non-existing symlink target.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: align comments to code
Giuseppe Bilotta [Sat, 31 Jan 2009 01:31:52 +0000 (02:31 +0100)]
gitweb: align comments to code

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: webserver config for PATH_INFO
Giuseppe Bilotta [Sat, 31 Jan 2009 01:31:51 +0000 (02:31 +0100)]
gitweb: webserver config for PATH_INFO

Document some possible Apache configurations when the path_info feature
is enabled in gitweb.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: make static files accessible with PATH_INFO
Giuseppe Bilotta [Sat, 31 Jan 2009 01:31:50 +0000 (02:31 +0100)]
gitweb: make static files accessible with PATH_INFO

Gitweb links to a number of static files such as CSS stylesheets,
favicon or the git logo. When, such as with the default Makefile, the
paths to these files are relative (i.e. doesn't start with a "/"), the
files become inaccessible in any view other tha project list and summary
page if gitweb is invoked with a non-empty PATH_INFO.

Fix this by adding a <base> element pointing to the script's own URL,
which ensure that all relative paths will be resolved correctly.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-cvsserver: handle CVS 'noop' command.
Stefan Karpinski [Fri, 30 Jan 2009 01:12:27 +0000 (17:12 -0800)]
git-cvsserver: handle CVS 'noop' command.

The CVS protocol documentation, found at

  http://www.wandisco.com/techpubs/cvs-protocol.pdf

states the following about the 'noop' command:

  Response expected: yes. This request is a null command
  in the sense that it doesn't do anything, but merely
  (as with any other requests expecting a response) sends
  back any responses pertaining to pending errors, pending
  Notified responses, etc.

In accordance with this, the correct way to handle the 'noop'
command, when issued by a client, is to call req_EMPTY.

The 'noop' command is called by some CVS clients, notably
TortoiseCVS, thus making it desirable for git-cvsserver to
respond to the command rather than choking on it as unknown.

Signed-off-by: Stefan Karpinski <stefan.karpinski@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofsck: check loose objects from alternate object stores by default
Junio C Hamano [Fri, 30 Jan 2009 08:50:54 +0000 (00:50 -0800)]
fsck: check loose objects from alternate object stores by default

"git fsck" used to validate only loose objects that are local and nothing
else by default.  This is not just too little when a repository is
borrowing objects from other object stores, but also caused the
connectivity check to mistakenly declare loose objects borrowed from them
to be missing.

The rationale behind the default mode that validates only loose objects is
because these objects are still young and more unlikely to have been
pushed to other repositories yet.  That holds for loose objects borrowed
from alternate object stores as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofsck: HEAD is part of refs
Junio C Hamano [Fri, 30 Jan 2009 08:33:00 +0000 (00:33 -0800)]
fsck: HEAD is part of refs

By default we looked at all refs but not HEAD.  The only thing that made
fsck not lose sight of commits that are only reachable from a detached
HEAD was the reflog for the HEAD.

This fixes it, with a new test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot0005: use SIGTERM for sigchain test
Jeff King [Fri, 30 Jan 2009 08:21:01 +0000 (03:21 -0500)]
t0005: use SIGTERM for sigchain test

The signal tests consists of checking that each of our
handlers is executed, and that the test program was killed
by the final signal. We arbitrarily used SIGINT as the kill
signal.

However, some platforms (notably Solaris) will default
SIGINT to SIG_IGN if there is no controlling terminal. In
that case, we don't end up killing the program with the
final signal and the test fails.

This is a problem since the test script should not depend
on outside factors; let's use SIGTERM instead, which should
behave consistently.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosymbolic ref: refuse non-ref targets in HEAD
Jeff King [Thu, 29 Jan 2009 08:33:02 +0000 (03:33 -0500)]
symbolic ref: refuse non-ref targets in HEAD

When calling "git symbolic-ref" it is easy to forget that
the target must be a fully qualified ref. E.g., you might
accidentally do:

  $ git symbolic-ref HEAD master

Unfortunately, this is very difficult to recover from,
because the bogus contents of HEAD make git believe we are
no longer in a git repository (as is_git_dir explicitly
checks for "^refs/heads/" in the HEAD target). So
immediately trying to fix the situation doesn't work:

  $ git symbolic-ref HEAD refs/heads/master
  fatal: Not a git repository

and one is left editing the .git/HEAD file manually.

Furthermore, one might be tempted to use symbolic-ref to set
up a detached HEAD:

  $ git symbolic-ref HEAD `git rev-parse HEAD`

which sets up an even more bogus HEAD:

  $ cat .git/HEAD
  ref: 1a9ace4f2ad4176148e61b5a85cd63d5604aac6d

This patch introduces a small safety valve to prevent the
specific case of anything not starting with refs/heads/ to
go into HEAD. The scope of the safety valve is intentionally
very limited, to make sure that we are not preventing any
behavior that would otherwise be valid (like pointing a
different symref than HEAD outside of refs/heads/).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agovalidate_headref: tighten ref-matching to just branches
Jeff King [Thu, 29 Jan 2009 08:30:16 +0000 (03:30 -0500)]
validate_headref: tighten ref-matching to just branches

When we are trying to determine whether a directory contains
a git repository, one of the tests we do is to check whether
HEAD is either a symlink or a symref into the "refs/"
hierarchy, or a detached HEAD.

We can tighten this a little more, though: a non-detached
HEAD should always point to a branch (since checking out
anything else should result in detachment), so it is safe to
check for "refs/heads/".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes to 1.6.2
Junio C Hamano [Thu, 29 Jan 2009 08:57:42 +0000 (00:57 -0800)]
Update draft release notes to 1.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSync with 1.6.1.2
Junio C Hamano [Thu, 29 Jan 2009 08:32:52 +0000 (00:32 -0800)]
Sync with 1.6.1.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1.2 v1.6.1.2
Junio C Hamano [Thu, 29 Jan 2009 08:12:52 +0000 (00:12 -0800)]
GIT 1.6.1.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-format-patch-o-relative' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:56:13 +0000 (23:56 -0800)]
Merge branch 'jc/maint-format-patch-o-relative' into maint

* jc/maint-format-patch-o-relative:
  Teach format-patch to handle output directory relative to cwd

Conflicts:
t/t4014-format-patch.sh

15 years agoMerge branch 'bs/maint-rename-populate-filespec' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:57 +0000 (23:42 -0800)]
Merge branch 'bs/maint-rename-populate-filespec' into maint

* bs/maint-rename-populate-filespec:
  Rename detection: Avoid repeated filespec population

15 years agoMerge branch 'mh/maint-commit-color-status' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:53 +0000 (23:42 -0800)]
Merge branch 'mh/maint-commit-color-status' into maint

* mh/maint-commit-color-status:
  git-status -v: color diff output when color.ui is set
  git-commit: color status output when color.ui is set

15 years agoMerge branch 'nd/grep-assume-unchanged' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:41 +0000 (23:42 -0800)]
Merge branch 'nd/grep-assume-unchanged' into maint

* nd/grep-assume-unchanged:
  grep: grep cache entries if they are "assume unchanged"
  grep: support --no-ext-grep to test builtin grep

15 years agoMerge branch 'jc/maint-ls-tree' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:15 +0000 (23:42 -0800)]
Merge branch 'jc/maint-ls-tree' into maint

* jc/maint-ls-tree:
  Document git-ls-tree --full-tree
  ls-tree: add --full-tree option

15 years agoMerge branch 'np/no-loosen-prune-expire-now' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:10 +0000 (23:42 -0800)]
Merge branch 'np/no-loosen-prune-expire-now' into maint

* np/no-loosen-prune-expire-now:
  objects to be pruned immediately don't have to be loosened

15 years agoMerge branch 'mc/cd-p-pwd' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:41:56 +0000 (23:41 -0800)]
Merge branch 'mc/cd-p-pwd' into maint

* mc/cd-p-pwd:
  git-sh-setup: Fix scripts whose PWD is a symlink to a work-dir on OS X

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:41:28 +0000 (23:41 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  avoid 31-bit truncation in write_loose_object

15 years agoavoid 31-bit truncation in write_loose_object
Jeff King [Thu, 29 Jan 2009 05:56:34 +0000 (00:56 -0500)]
avoid 31-bit truncation in write_loose_object

The size of the content we are adding may be larger than
2.1G (i.e., "git add gigantic-file"). Most of the code-path
to do so uses size_t or unsigned long to record the size,
but write_loose_object uses a signed int.

On platforms where "int" is 32-bits (which includes x86_64
Linux platforms), we end up passing malloc a negative size.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSimplify t3412
Johannes Schindelin [Tue, 27 Jan 2009 22:35:09 +0000 (23:35 +0100)]
Simplify t3412

Use the newly introduced test_commit() and test_merge() helpers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSimplify t3411
Johannes Schindelin [Tue, 27 Jan 2009 22:35:05 +0000 (23:35 +0100)]
Simplify t3411

Use test_commit() and test_merge().  This way, it is harder to forget to
tag, or to call test_tick before committing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSimplify t3410
Johannes Schindelin [Tue, 27 Jan 2009 22:34:54 +0000 (23:34 +0100)]
Simplify t3410

Use test_commit() and test_merge(), reducing the code while making the
intent clearer.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-lib.sh: introduce test_commit() and test_merge() helpers
Johannes Schindelin [Tue, 27 Jan 2009 22:34:48 +0000 (23:34 +0100)]
test-lib.sh: introduce test_commit() and test_merge() helpers

Often we just need to add a commit with a given (short) name, that will
be tagged with the same name.  Now, relatively complicated graphs can be
constructed easily and in a clear fashion:

test_commit A &&
test_commit B &&
git checkout A &&
test_commit C &&
test_merge D B

will construct this graph:

A - B
  \   \
    C - D

For simplicity, files whose name is the lower case version of the commit
message (to avoid a warning about ambiguous names) will be committed, with
the corresponding commit messages as contents.

If you need to provide a different file/different contents, you can use
the more explicit form

test_commit $MESSAGE $FILENAME $CONTENTS

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolib-rebase.sh: Document what set_fake_editor() does
Johannes Schindelin [Tue, 27 Jan 2009 22:34:35 +0000 (23:34 +0100)]
lib-rebase.sh: Document what set_fake_editor() does

Make it easy for other authors to use rebase tests' fake-editor.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot3404 & t3411: undo copy&paste
Johannes Schindelin [Tue, 27 Jan 2009 22:34:29 +0000 (23:34 +0100)]
t3404 & t3411: undo copy&paste

Rather than copying and pasting, which is prone to lead to fixes
missing in one version, move the fake-editor generator to t/t3404/.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -u: do not fail to resolve a path as deleted
Junio C Hamano [Wed, 28 Jan 2009 22:24:53 +0000 (14:24 -0800)]
add -u: do not fail to resolve a path as deleted

After you resolve a conflicted merge to remove the path, "git add -u"
failed to record the removal.  Instead it errored out by saying that the
removed path is not found in the work tree, but that is what the user
already knows, and the wanted to record the removal as the resolution,
so the error does not make sense.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-apply.c: do not set bogus mode in check_preimage() for deleted path
Junio C Hamano [Mon, 26 Jan 2009 07:41:26 +0000 (23:41 -0800)]
builtin-apply.c: do not set bogus mode in check_preimage() for deleted path

If it is deleted, it is deleted.  Do not set the current mode to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomailinfo: tests for RFC2047 examples
Kirill Smelkov [Mon, 12 Jan 2009 22:21:04 +0000 (01:21 +0300)]
mailinfo: tests for RFC2047 examples

Also as suggested by Junio, in order to try to catch other MIME
problems, test cases from the "8. Examples" section of RFC2047 are added
to t5100 testsuite as well.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
15 years agomailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
Kirill Smelkov [Tue, 13 Jan 2009 09:33:48 +0000 (12:33 +0300)]
mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
15 years agoMerge branch 'tr/previous-branch'
Junio C Hamano [Wed, 28 Jan 2009 23:00:27 +0000 (15:00 -0800)]
Merge branch 'tr/previous-branch'

* tr/previous-branch:
  t1505: remove debugging cruft
  Simplify parsing branch switching events in reflog
  Introduce for_each_recent_reflog_ent().
  interpret_nth_last_branch(): plug small memleak
  Fix reflog parsing for a malformed branch switching entry
  Fix parsing of @{-1}@{1}
  interpret_nth_last_branch(): avoid traversing the reflog twice
  checkout: implement "-" abbreviation, add docs and tests
  sha1_name: support @{-N} syntax in get_sha1()
  sha1_name: tweak @{-N} lookup
  checkout: implement "@{-N}" shortcut name for N-th last branch

Conflicts:
sha1_name.c

15 years agoFix submodule squashing into unrelated commit
Johannes Schindelin [Tue, 27 Jan 2009 11:42:31 +0000 (12:42 +0100)]
Fix submodule squashing into unrelated commit

Actually, I think the issue is pretty independent of submodules; when
"git commit" gets an empty parameter, it misinterprets it as a file.

So avoid passing an empty parameter to "git commit".

Actually, this is a nice cleanup, as MSG_FILE and EDIT_COMMIT were mutually
exclusive; use one variable instead

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorebase -i squashes submodule changes into unrelated commit
Junio C Hamano [Tue, 27 Jan 2009 09:07:31 +0000 (01:07 -0800)]
rebase -i squashes submodule changes into unrelated commit

Attempting to rebase three-commit series (two regular changes, followed by
one commit that changes what commit is bound for a submodule path) to
squash the first two results in a failure; not just the first two commits
squashed, but the change to the submodule is also included in the result.

This failure causes the subsequent step to "pick" the change that actually
changes the submodule to be applied, because there is no change left to be
applied.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: check if-modified-since for feeds
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:16 +0000 (12:50 +0100)]
gitweb: check if-modified-since for feeds

Offering Last-modified header for feeds is only half the work, even if
we bail out early on HEAD requests. We should also check that same date
against If-modified-since, and bail out early with 304 Not Modified if
that's the case.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: last-modified time should be commiter, not author
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:15 +0000 (12:50 +0100)]
gitweb: last-modified time should be commiter, not author

The last-modified time header added by RSS to increase cache hits from
readers should be set to the date the repository was last modified. The
author time in this respect is not a good guess because the last commit
might come from a oldish patch.

Use the committer time for the last-modified header to ensure a more
correct guess of the last time the repository was modified.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: rss channel date
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:14 +0000 (12:50 +0100)]
gitweb: rss channel date

The RSS 2.0 specifications defines not one but _two_ dates for its
channel element! Woohoo! Luckily, it seems that consensus seems to be
that if both are present they should be equal, except for some very
obscure and discouraged cases. Since lastBuildDate would make more sense
for us and pubDate seems to be the most commonly used, we defined both
and make them equal.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: rss feed managingEditor
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:13 +0000 (12:50 +0100)]
gitweb: rss feed managingEditor

The RSS 2.0 specification allows an optional managingEditor tag for the
channel, containing the "email address for person responsible for editorial
content", which is basically the project owner.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: feed generator metadata
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:12 +0000 (12:50 +0100)]
gitweb: feed generator metadata

Add <generator> tag to RSS and Atom feed. Versioning info (gitweb/git
core versions, separated by a literal slash) is stored in the
appropriate attribute for the Atom feed, and in the tag content for the
RSS feed.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: channel image in rss feed
Giuseppe Bilotta [Mon, 26 Jan 2009 11:50:11 +0000 (12:50 +0100)]
gitweb: channel image in rss feed

Define the channel image for the rss feed when the logo or favicon are
defined, preferring the former to the latter. As suggested in the RSS
2.0 specifications, the image's title and link as set to the same as the
channel's.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit: use run_command() to execute dashed externals
Jeff King [Wed, 28 Jan 2009 07:38:14 +0000 (02:38 -0500)]
git: use run_command() to execute dashed externals

We used to simply try calling execvp(); if it succeeded, then we were done
and the new program was running. If it didn't, then we knew that it wasn't
a valid command.

Unfortunately, this interacted badly with the new pager handling. Now that
git remains the parent process and the pager is spawned, git has to hang
around until the pager is finished. We install an atexit handler to do
this, but that handler never gets called if we successfully run execvp.

You could see this behavior by running any dashed external using a pager
(e.g., "git -p stash list"). The command finishes running, but the pager
is still going. In the case of less, it then gets an error reading from
the terminal and exits, potentially leaving the terminal in a broken state
(and not showing the output).

This patch just uses run_command() to try running the dashed external. The
parent git process then waits for the external process to complete and
then handles the pager cleanup as it would for an internal command.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorun_command(): help callers distinguish errors
Jeff King [Wed, 28 Jan 2009 07:36:39 +0000 (02:36 -0500)]
run_command(): help callers distinguish errors

run_command() returns a single integer specifying either an
error code or the exit status of the spawned program. The
only way to tell the difference is that the error codes are
outside of the allowed range of exit status values.

Rather than make each caller implement the test against a
magic limit, let's provide a macro.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorun_command(): handle missing command errors more gracefully
Jeff King [Wed, 28 Jan 2009 07:35:33 +0000 (02:35 -0500)]
run_command(): handle missing command errors more gracefully

When run_command() was asked to run a non-existant command, its behavior
varied depending on the platform:

  - on POSIX systems, we would fork, and then after the execvp call
    failed, we could call die(), which prints a message to stderr and
    exits with code 128.

  - on Windows, we do a PATH lookup, realize the program isn't there, and
    then return ERR_RUN_COMMAND_FORK

The goal of this patch is to make it clear to callers that the specific
error was a missing command. To do this, we will return the error code
ERR_RUN_COMMAND_EXEC, which is already defined in run-command.h, checked
for in several places, but never actually gets set.

The new behavior is:

  - on POSIX systems, we exit the forked process with code 127 (the same
    as the shell uses to report missing commands). The parent process
    recognizes this code and returns an EXEC error. The stderr message is
    silenced, since the caller may be speculatively trying to run a
    command. Instead, we use trace_printf so that somebody interested in
    debugging can see the error that occured.

  - on Windows, we check errno, which is already set correctly by
    mingw_spawnvpe, and report an EXEC error instead of a FORK error

Thus it is safe to speculatively run a command:

  int r = run_command_v_opt(argv, 0);
  if (r == -ERR_RUN_COMMAND_EXEC)
  /* oops, it wasn't found; try something else */
  else
  /* we failed for some other reason, error is in r */

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: Make 'configure --with-expat=path' actually work
Serge van den Boom [Wed, 28 Jan 2009 20:43:57 +0000 (21:43 +0100)]
Makefile: Make 'configure --with-expat=path' actually work

While the configure script sets the EXPATDIR environment variable to
whatever value was passed to its option --with-expat as the prefix of
the location of the expat library and headers, the Makefile ignored it.
This patch fixes this bug.

Signed-off-by: Serge van den Boom <svdb@stack.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit: s/run_command/run_builtin/
Jeff King [Wed, 28 Jan 2009 07:33:53 +0000 (02:33 -0500)]
git: s/run_command/run_builtin/

There is a static function called run_command which
conflicts with the library function in run-command.c; this
isn't a problem currently, but prevents including
run-command.h in git.c.

This patch just renames the static function to something
more specific and non-conflicting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-tag: Add --contains option
Jake Goulding [Mon, 26 Jan 2009 14:13:25 +0000 (09:13 -0500)]
git-tag: Add --contains option

This functions similarly to "git branch --contains"; it will show all
tags that contain the specified commit, by sharing the same logic.

The patch also adds documentation and tests for the new option.

Signed-off-by: Jake Goulding <goulding@vivisimo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake has_commit() non-static
Jake Goulding [Mon, 26 Jan 2009 14:13:24 +0000 (09:13 -0500)]
Make has_commit() non-static

Move has_commit() from branch to a common location, in preparation for
using it in "git-tag". Rename it to is_descendant_of() to make it more
unique and descriptive.

Signed-off-by: Jake Goulding <goulding@vivisimo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake opt_parse_with_commit() non-static
Jake Goulding [Mon, 26 Jan 2009 14:13:23 +0000 (09:13 -0500)]
Make opt_parse_with_commit() non-static

Moving opt_parse_with_commit() from branch to a common location, in
preparation for using it in tag. Rename it to match naming convention
of other option parsing functions.

Signed-off-by: Jake Goulding <goulding@vivisimo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorevision traversal: allow UNINTERESTING objects to be missing
Junio C Hamano [Wed, 28 Jan 2009 07:19:30 +0000 (23:19 -0800)]
revision traversal: allow UNINTERESTING objects to be missing

Most of the existing codepaths were meant to treat missing uninteresting
objects to be a silently ignored non-error, but there were a few places
in handle_commit() and add_parents_to_list(), which are two key functions
in the revision traversal machinery, that cared:

 - When a tag refers to an object that we do not have, we barfed.  We
   ignore such a tag if it is painted as UNINTERESTING with this change.

 - When digging deeper into the ancestry chain of a commit that is already
   painted as UNINTERESTING, in order to paint its parents UNINTERESTING,
   we barfed if parse_parent() for a parent commit object failed.  We can
   ignore such a parent commit object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: minor cleanups
Jay Soffian [Wed, 28 Jan 2009 15:03:10 +0000 (10:03 -0500)]
git-am: minor cleanups

Update usage statement to remove a no-longer supported option, and to hide two
options (one a no-op, one internal) unless --help-all is used.

Use "test -t 0" instead of "tty -s" to detect when stdin is a terminal. (test
-t 0 is used elsewhere in git-am and in other git shell scripts, tty -s is
not, and appears to be deprecated by POSIX)

Use "test ..." instead of "[ ... ]" and "die <msg>" instead of "echo <msg>
>&2; exit 1" to be consistent with rest of script.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWindows: Fix intermittent failures of t7701
Johannes Sixt [Wed, 28 Jan 2009 09:52:26 +0000 (10:52 +0100)]
Windows: Fix intermittent failures of t7701

The last test case checks whether unpacked objects receive the time stamp
of the pack file. Due to different implementations of stat(2) by MSYS and
our version in compat/mingw.c, the test fails in about half of the test
runs.

Note the following facts:

- The test uses perl's -M operator to compare the time stamps. Since we
  depend on MSYS perl, the result of this operator is based on MSYS's
  implementation of the stat(2) call.

- NTFS on Windows records fractional seconds.

- The MSYS implementation of stat(2) *rounds* fractional seconds to full
  seconds instead of truncating them. This becomes obvious by comparing the
  modification times reported by 'ls --full-time $f' and 'stat $f' for
  various files $f.

- Our implementation of stat(2) in compat/mingw.c *truncates* to full
  seconds.

The consequence of this is that

- add_packed_git() picks up a truncated whole second modification time
  from the pack file time stamp, which is then used for the loose objects,
  while the pack file retains its time stamp in fractional seconds;

- but the test case compared the pack file's rounded modification times
  to the loose objects' truncated modification times.

And half of the time the rounded modification time is not the same as its
truncated modification time.

The fix is that we replace perl by 'test-chmtime -v +0', which prints the
truncated whole-second mtime without modifying it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 28 Jan 2009 08:36:52 +0000 (00:36 -0800)]
Merge branch 'maint'

* maint:
  send-pack: do not send unknown object name from ".have" to pack-objects
  test-path-utils: Fix off by one, found by valgrind
  get_sha1_basic(): fix invalid memory access, found by valgrind

15 years agosend-pack: do not send unknown object name from ".have" to pack-objects
Junio C Hamano [Wed, 28 Jan 2009 04:21:31 +0000 (20:21 -0800)]
send-pack: do not send unknown object name from ".have" to pack-objects

v1.6.1 introduced ".have" extension to the protocol to allow the receiving
side to advertise objects that are reachable from refs in the repositories
it borrows from.  This was meant to be used by the sending side to avoid
sending such objects; they are already available through the alternates
mechanism.

The client side implementation in v1.6.1, which was introduced with
40c155f (push: prepare sender to receive extended ref information from the
receiver, 2008-09-09) aka v1.6.1-rc1~203^2~1, were faulty in that it did
not consider the possiblity that the repository receiver borrows from
might have objects it does not know about.

This fixes it by refraining from passing missing commits to underlying
pack-objects.  Revision machinery may need to be tightened further to
treat missing uninteresting objects as non-error events, but this is an
obvious and safe fix for a maintenance release that is almost good enough.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 27 Jan 2009 23:23:46 +0000 (15:23 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  test-path-utils: Fix off by one, found by valgrind
  get_sha1_basic(): fix invalid memory access, found by valgrind

15 years agotest-path-utils: Fix off by one, found by valgrind
Johannes Schindelin [Tue, 27 Jan 2009 23:07:36 +0000 (00:07 +0100)]
test-path-utils: Fix off by one, found by valgrind

When normalizing an absolute path, we might have to add a slash _and_ a
NUL to the buffer, so the buffer was one too small.

Let's just future proof the code and alloc PATH_MAX + 1 bytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoget_sha1_basic(): fix invalid memory access, found by valgrind
Johannes Schindelin [Tue, 27 Jan 2009 23:07:46 +0000 (00:07 +0100)]
get_sha1_basic(): fix invalid memory access, found by valgrind

When get_sha1_basic() is passed a buffer of len 0, it should not
check if buf[len-1] is a curly bracket.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomergetool: respect autocrlf by using checkout-index
Charles Bailey [Wed, 21 Jan 2009 22:57:48 +0000 (22:57 +0000)]
mergetool: respect autocrlf by using checkout-index

Previously, git mergetool used cat-file which does not perform git to
worktree conversion. This changes mergetool to use git checkout-index
instead which means that the temporary files used for mergetool use the
correct line endings for the platform.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomergetool: Don't repeat merge tool candidates
Johannes Gilger [Fri, 23 Jan 2009 23:12:45 +0000 (00:12 +0100)]
mergetool: Don't repeat merge tool candidates

git mergetool listed some candidates for mergetools twice, depending on
the environment.

This slightly changes the behavior when both KDE_FULL_SESSION and
GNOME_DESKTOP_SESSION_ID are set at the same time; in such a case
meld is used in favor of kdiff3 (the old code favored kdiff3 in such a
case), but it should not matter in practice.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-1.6.0-split-diff-metainfo' into jc/maint-split-diff-metainfo
Junio C Hamano [Tue, 27 Jan 2009 09:08:02 +0000 (01:08 -0800)]
Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into jc/maint-split-diff-metainfo

This is an evil merge, as a test added since 1.6.0 expects an incorrect
behaviour the merged commit fixes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: output correct index lines for a split diff
Junio C Hamano [Mon, 26 Jan 2009 08:08:24 +0000 (00:08 -0800)]
diff.c: output correct index lines for a split diff

A patch that changes the filetype (e.g. regular file to symlink) of a path
must be split into a deletion event followed by a creation event, which
means that we need to have two independent metainfo lines for each.
However, the code reused the single set of metainfo lines.

As the blob object names recorded on the index lines are usually not used
nor validated on the receiving end, this is not an issue with normal use
of the resulting patch.  However, when accepting a binary patch to delete
a blob, git-apply verified that the postimage blob object name on the
index line is 0{40}, hence a patch that deletes a regular file blob that
records binary contents to create a blob with different filetype (e.g. a
symbolic link) failed to apply.  "git am -3" also uses the blob object
names recorded on the index line, so it would also misbehave when
synthesizing a preimage tree.

This moves the code to generate metainfo lines around, so that two
independent sets of metainfo lines are used for the split halves.

Additional tests by Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: Avoid single-shot environment export for shell function invocation
Junio C Hamano [Tue, 27 Jan 2009 05:13:00 +0000 (21:13 -0800)]
tests: Avoid single-shot environment export for shell function invocation

Some shells have issues with a single-shot environment variable export
when invoking a shell function.  This fixes the ones I found that invoke
test_must_fail that way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorebase -i: correctly remember --root flag across --continue
Junio C Hamano [Mon, 26 Jan 2009 09:05:22 +0000 (10:05 +0100)]
rebase -i: correctly remember --root flag across --continue

d911d14 (rebase -i: learn to rebase root commit, 2009-01-02) tried to
remember the --root flag across a merge conflict in a broken way.
Introduce a flag file $DOTEST/rebase-root to fix and clarify.

While at it, also make sure $UPSTREAM is always initialized to guard
against existing values in the environment.

[tr: added tests]

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake: Remove -pthread on Darwin (it is included by cstdlib).
Ted Pavlic [Mon, 26 Jan 2009 19:03:59 +0000 (14:03 -0500)]
make: Remove -pthread on Darwin (it is included by cstdlib).

As discussed in

http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html

the Mac OS X C standard library is always thread safe and always
includes the pthread library. So explicitly using -pthread causes an
'unrecognized option' compiler warning.

This patch clears PTHREAD_LIBS if Darwin is detected.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMention "local convention" rule in the CodingGuidelines
Nanako Shiraishi [Mon, 26 Jan 2009 08:32:22 +0000 (17:32 +0900)]
Mention "local convention" rule in the CodingGuidelines

The document suggests to imitate the existing code, but didn't
say which existing code it should imitate. This clarifies.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWindows: Revert to default paths and convert them by RUNTIME_PREFIX
Steffen Prohaska [Sun, 18 Jan 2009 12:00:15 +0000 (13:00 +0100)]
Windows: Revert to default paths and convert them by RUNTIME_PREFIX

The RUNTIME_PREFIX mechanism allows us to use the default paths on
Windows too.  Defining RUNTIME_PREFIX explicitly requests for
translation of paths relative to the executable at runtime.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCompute prefix at runtime if RUNTIME_PREFIX is set
Steffen Prohaska [Sun, 18 Jan 2009 12:00:14 +0000 (13:00 +0100)]
Compute prefix at runtime if RUNTIME_PREFIX is set

This commit adds support for relocatable binaries (called
RUNTIME_PREFIX).  Such binaries can be moved together with the
system configuration files to a different directory, as long as the
relative paths from the binary to the configuration files is
preserved.  This functionality is essential on Windows where we
deliver git binaries with an installer that allows to freely choose
the installation location.

If RUNTIME_PREFIX is unset we use the static prefix.  This will be
the default on Unix.  Thus, the behavior on Unix will remain
identical to the old implementation, which used to add the prefix
in the Makefile.

If RUNTIME_PREFIX is set the prefix is computed from the location
of the executable.  In this case, system_path() tries to strip
known directories that executables can be located in from the path
of the executable.  If the path is successfully stripped it is used
as the prefix.  For example, if the executable is
"/msysgit/bin/git" and BINDIR is "bin", then the prefix computed is
"/msysgit".

If the runtime prefix computation fails, we fall back to the static
prefix specified in the makefile.  This can be the case if the
executable is not installed at a known location.  Note that our
test system sets GIT_CONFIG_NOSYSTEM to tell git to ignore global
configuration files during testing.  Hence testing does not trigger
the fall back.

Note that RUNTIME_PREFIX only works on Windows, though adding
support on Unix should not be too hard.  The implementation
requires argv0_path to be set to an absolute path.  argv0_path must
point to the directory of the executable.  We use assert() to
verify this in debug builds.  On Windows, the wrapper for main()
(see compat/mingw.h) guarantees that argv0_path is correctly
initialized.  On Unix, further work is required before
RUNTIME_PREFIX can be enabled.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoModify setup_path() to only add git_exec_path() to PATH
Steffen Prohaska [Sun, 18 Jan 2009 12:00:13 +0000 (13:00 +0100)]
Modify setup_path() to only add git_exec_path() to PATH

Searching git programs only in the highest priority location is
sufficient.  It does not make sense that some of the required
programs are located at the highest priority location but other
programs are picked up from a lower priority exec-path.  If
exec-path is overridden a complete set of commands should be
provided, otherwise several different versions could get mixed,
which is likely to cause confusion.

If a user explicitly overrides the default location (by --exec-path
or GIT_EXEC_PATH), we now expect that all the required programs are
found there.  Instead of adding the directories "argv_exec_path",
"getenv(EXEC_PATH_ENVIRONMENT)", and "system_path(GIT_EXEC_PATH)"
to PATH, we now rely on git_exec_path(), which implements the same
order, but only returns the highest priority location to search for
executables.

Accessing only the location with highest priority is also required
for testing executables built with RUNTIME_PREFIX.  The call to
system_path() should be avoided if RUNTIME_PREFIX is set and the
executable is not installed at its final destination.  Because we
test before installing, we want to avoid calling system_path()
during tests.  The modifications in this commit avoid calling
system_path(GIT_EXEC_PATH) if a higher-priority location is
provided, which is the case when running the tests.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd calls to git_extract_argv0_path() in programs that call git_config_*
Steffen Prohaska [Sun, 18 Jan 2009 12:00:12 +0000 (13:00 +0100)]
Add calls to git_extract_argv0_path() in programs that call git_config_*

Programs that use git_config need to find the global configuration.
When runtime prefix computation is enabled, this requires that
git_extract_argv0_path() is called early in the program's main().

This commit adds the necessary calls.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit_extract_argv0_path(): Move check for valid argv0 from caller to callee
Steffen Prohaska [Sun, 18 Jan 2009 12:00:11 +0000 (13:00 +0100)]
git_extract_argv0_path(): Move check for valid argv0 from caller to callee

This simplifies the calling code.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRefactor git_set_argv0_path() to git_extract_argv0_path()
Steve Haslam [Sun, 18 Jan 2009 12:00:10 +0000 (13:00 +0100)]
Refactor git_set_argv0_path() to git_extract_argv0_path()

This commit moves the code that computes the dirname of argv[0]
from git.c's main() to git_set_argv0_path() and renames the function
to git_extract_argv0_path().  This makes the code in git.c's main
less cluttered, and we can use the dirname computation from other
main() functions too.

[ spr:
 - split Steve's original commit and wrote new commit message.
 - Integrated Johannes Schindelin's
   cca1704897e7fdb182f68d4c48a437c5d7bc5203 while rebasing onto master.
]

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove computation of absolute paths from Makefile to runtime (in preparation for RUNTI...
Steffen Prohaska [Sun, 18 Jan 2009 12:00:09 +0000 (13:00 +0100)]
Move computation of absolute paths from Makefile to runtime (in preparation for RUNTIME_PREFIX)

This commit prepares the Makefile for relocatable binaries (called
RUNTIME_PREFIX).  Such binaries will be able to be moved together
with the system configuration files to a different directory,
requiring to compute the prefix at runtime.

In a first step, we make all paths relative in the Makefile and
teach system_path() to add the prefix instead.  We used to compute
absolute paths in the Makefile and passed them to C as defines.  We
now pass relative paths to C and call system_path() to add the
prefix at runtime.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Mon, 26 Jan 2009 06:27:52 +0000 (22:27 -0800)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: Add test for --ignore-paths parameter
  git-svn: documented --ignore-paths
  git-svn: add --ignore-paths option for fetching
  git-svn: fix memory leak when checking for empty symlinks

15 years agoDocumentation: rework src/dst description in git push
Anders Melchiorsen [Sun, 25 Jan 2009 23:45:33 +0000 (00:45 +0100)]
Documentation: rework src/dst description in git push

This tries to make the description of ref matching in git push easier
to read. Beauty is in the eye of the beholder, though.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: more git push examples
Anders Melchiorsen [Sun, 25 Jan 2009 23:45:32 +0000 (00:45 +0100)]
Documentation: more git push examples

Include examples of using HEAD. The order of examples
introduces new concepts one by one. This pushes the
example of deleting a ref to the end of the list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: simplify refspec format description
Junio C Hamano [Mon, 26 Jan 2009 06:25:20 +0000 (22:25 -0800)]
Documentation: simplify refspec format description

The refspec format description was a mix of regexp and BNF, making it
very difficult to read. The format was also wrong: it did not show
that each part of a refspec is optional in different situations.

Rather than having a confusing grammar, just present the format in
informal prose.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorebase -i --root: fix check for number of arguments
Johannes Schindelin [Sun, 25 Jan 2009 23:32:13 +0000 (00:32 +0100)]
rebase -i --root: fix check for number of arguments

If we are not rebasing with --root, then $# can only be either 1 (base)
or 2 (base and the name of the branch to be rebased).

If we are rebasing with --root, then it is Ok if $# is 0 (rebase the
current branch down to everything) or 1 (rebase the named branch down to
everything).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogittutorial: remove misleading note
Miklos Vajna [Fri, 23 Jan 2009 18:02:29 +0000 (19:02 +0100)]
gittutorial: remove misleading note

In the tutorial Alice initializes the repository, and Bob clones it. So
Bob can just do a 'git pull', but Alice will need 'git pull <url>
<branch>'.

The note suggested that the branch parameter is not necessary, which is
no longer true these days.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: Add --ignore-date option
Nanako Shiraishi [Sat, 24 Jan 2009 01:18:02 +0000 (10:18 +0900)]
git-am: Add --ignore-date option

This new option tells 'git-am' to ignore the date header field
recorded in the format-patch output. The commits will have the
timestamp when they are created instead.

You can work a lot in one day to accumulate many changes, but
apply and push to the public repository only some of them at
the end of the first day. Then next day you can spend all your
working hours reading comics or chatting with your coworkers,
and apply your remaining patches from the previous day using
this option to pretend that you have been working at the end
of the day.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoam: Add --committer-date-is-author-date option
Junio C Hamano [Fri, 23 Jan 2009 00:14:58 +0000 (16:14 -0800)]
am: Add --committer-date-is-author-date option

This new option tells 'git-am' to use the timestamp recorded
in the Email message as both author and committer date.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'kb/lstat-cache'
Junio C Hamano [Mon, 26 Jan 2009 01:13:34 +0000 (17:13 -0800)]
Merge branch 'kb/lstat-cache'

* kb/lstat-cache:
  lstat_cache(): introduce clear_lstat_cache() function
  lstat_cache(): introduce invalidate_lstat_cache() function
  lstat_cache(): introduce has_dirs_only_path() function
  lstat_cache(): introduce has_symlink_or_noent_leading_path() function
  lstat_cache(): more cache effective symlink/directory detection

15 years agoMerge branch 'js/diff-color-words'
Junio C Hamano [Mon, 26 Jan 2009 01:13:29 +0000 (17:13 -0800)]
Merge branch 'js/diff-color-words'

* js/diff-color-words:
  Change the spelling of "wordregex".
  color-words: Support diff.wordregex config option
  color-words: make regex configurable via attributes
  color-words: expand docs with precise semantics
  color-words: enable REG_NEWLINE to help user
  color-words: take an optional regular expression describing words
  color-words: change algorithm to allow for 0-character word boundaries
  color-words: refactor word splitting and use ALLOC_GROW()
  Add color_fwrite_lines(), a function coloring each line individually

15 years agoMerge branch 'cb/add-pathspec'
Junio C Hamano [Mon, 26 Jan 2009 01:13:11 +0000 (17:13 -0800)]
Merge branch 'cb/add-pathspec'

* cb/add-pathspec:
  remove pathspec_match, use match_pathspec instead
  clean up pathspec matching

15 years agoMerge branch 'js/maint-all-implies-HEAD'
Junio C Hamano [Mon, 26 Jan 2009 01:13:02 +0000 (17:13 -0800)]
Merge branch 'js/maint-all-implies-HEAD'

* js/maint-all-implies-HEAD:
  bundle: allow the same ref to be given more than once
  revision walker: include a detached HEAD in --all

15 years agoMerge branch 'sr/clone-empty'
Junio C Hamano [Mon, 26 Jan 2009 01:11:30 +0000 (17:11 -0800)]
Merge branch 'sr/clone-empty'

* sr/clone-empty:
  Allow cloning an empty repository

15 years agodiff-options.txt: Fix asciidoc markup issue
Teemu Likonen [Sun, 25 Jan 2009 12:20:22 +0000 (14:20 +0200)]
diff-options.txt: Fix asciidoc markup issue

Must be "--patience::", not "--patience:".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: Add test for --ignore-paths parameter
Vitaly \"_Vi\" Shukela [Sun, 25 Jan 2009 22:21:42 +0000 (00:21 +0200)]
git-svn: Add test for --ignore-paths parameter

Added a test for this option, similar to (and based on) t9133 about
ignorance of .git directories

Signed-off-by: Vitaly "_Vi" Shukela <public_vi@tut.by>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: replaced 'echo -e' with printf so it works on POSIX shells]
[ew: added Vitaly to copyright even though it's based on my test]

15 years agoSync with 1.6.1.1
Junio C Hamano [Mon, 26 Jan 2009 00:30:13 +0000 (16:30 -0800)]
Sync with 1.6.1.1

15 years agogit-svn: documented --ignore-paths
Vitaly \"_Vi\" Shukela [Sun, 25 Jan 2009 22:21:41 +0000 (00:21 +0200)]
git-svn: documented --ignore-paths

Documented --ignore-paths option of git-svn to inform users about
the feature and provide some examples.

Signed-off-by: Vitaly "_Vi" Shukela <public_vi@tut.by>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: trailing whitespace removed]

15 years agogit-svn: add --ignore-paths option for fetching
Vitaly \"_Vi\" Shukela [Sun, 25 Jan 2009 22:21:40 +0000 (00:21 +0200)]
git-svn: add --ignore-paths option for fetching

This will be useful when somebody want to checkout something partially from
repository with some non-standart layout or exclude some files from it.
Example: repository has structure /module-{a,b,c}/{trunk,branches,tags}/...
Modules are interdependent, and you want it to be single repostory (to commit
to all modules simultaneously and view complete history), but do not want
branches and tags be checked out into working copy.
Other use case is excluding some large blobs.

The quirk for now is that user must specify this option every fetch/rebase;
in other case he may get extra files or "file not found" errors. It may be
will be resolved by adding regular expression to .git/config into
[svn-remote ...] to make it persistent.

Signed-off-by: Vitaly "_Vi" Shukela <public_vi@tut.by>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: replaced 4-space indent with tabs]
[ew: prefixed $ignore_regex with an underscore to be consistent
     with other globals in git-svn]
[ew: rearranged functions to minimize diff and removed prototype
     usage to be consistent with the rest of git-svn (and other
     Perl code in git (and they're ugly to me)]

15 years agogit-svn: fix memory leak when checking for empty symlinks
Eric Wong [Sun, 25 Jan 2009 23:35:52 +0000 (15:35 -0800)]
git-svn: fix memory leak when checking for empty symlinks

By enforcing SVN::Pool usage when calling get_file once again.

This regression was introduced with the reintroduction of
SVN::Ra::get_file() usage in
dbc6c74d0858d77e61e092a48d467e725211f8e9

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agoGIT 1.6.1.1 v1.6.1.1
Junio C Hamano [Sun, 25 Jan 2009 20:41:09 +0000 (12:41 -0800)]
GIT 1.6.1.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoIgnore test-ctype
Benjamin Kramer [Sat, 24 Jan 2009 16:17:55 +0000 (17:17 +0100)]
Ignore test-ctype

Signed-off-by: Benjamin Kramer <benny.kra@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push.c: style fixes
Junio C Hamano [Sun, 25 Jan 2009 08:04:15 +0000 (00:04 -0800)]
http-push.c: style fixes

b1c7d4a (http-push: refactor lock-related headers creation for curl
requests, 2009-01-24) had many style violations that slipped through.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot1505: remove debugging cruft
Thomas Rast [Sat, 24 Jan 2009 22:23:14 +0000 (23:23 +0100)]
t1505: remove debugging cruft

Remove a call to git-log that I introduced for debugging and that
accidentally made it into d18ba22 (sha1_name: support @{-N} syntax in
get_sha1(), 2009-01-17).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/patience-diff'
Junio C Hamano [Sat, 24 Jan 2009 05:51:38 +0000 (21:51 -0800)]
Merge branch 'js/patience-diff'

* js/patience-diff:
  bash completions: Add the --patience option
  Introduce the diff option '--patience'
  Implement the patience diff algorithm

Conflicts:
contrib/completion/git-completion.bash