git.git
16 years agorun-command: add pre-exec callback
Jeff King [Tue, 22 Jul 2008 07:12:46 +0000 (03:12 -0400)]
run-command: add pre-exec callback

This is a function provided by the caller which is called
_after_ the process is forked, but before the spawned
program is executed. On platforms (like mingw) where
subprocesses are forked and executed in a single call, the
preexec callback is simply ignored.

This will be used in the following patch to do some setup
for 'less' that must happen in the forked child.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-reset: Let -q hush "locally modified" messages
Stephan Beyer [Fri, 25 Jul 2008 20:49:08 +0000 (22:49 +0200)]
git-reset: Let -q hush "locally modified" messages

"git reset -q" is advertised to "only report errors", but "locally
modified" messages are still shown.  They are not errors but diagnostics.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: teach dcommit about svn auto-props
Brad King [Fri, 25 Jul 2008 15:32:37 +0000 (11:32 -0400)]
git-svn: teach dcommit about svn auto-props

Subversion repositories often require files to have properties such as
svn:mime-type and svn:eol-style set when they are added.  Users
typically set these properties automatically using the SVN auto-props
feature with 'svn add'.  This commit teaches dcommit to look at the user
SVN configuration and apply matching auto-props entries for files added
by a diff as it is applied to the SVN remote.

Signed-off-by: Brad King <brad.king@kitware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoWindows: Do not compile git-shell
Johannes Sixt [Mon, 21 Jul 2008 19:19:58 +0000 (21:19 +0200)]
Windows: Do not compile git-shell

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoWindows: Make sure argv[0] has a path
Johannes Sixt [Mon, 21 Jul 2008 19:19:57 +0000 (21:19 +0200)]
Windows: Make sure argv[0] has a path

Since the exec-path on Windows is derived from the program invocation path,
we must ensure that argv[0] always has a path. Unfortunately, if a program
is invoked from CMD, argv[0] has no path. But on the other hand, the
C runtime offers a global variable, _pgmptr, that always has the full path
to the program. We hook into main() with a preprocessor macro, where we
replace argv[0].

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoWindows: Make $(gitexecdir) relative
Johannes Sixt [Mon, 21 Jul 2008 19:19:56 +0000 (21:19 +0200)]
Windows: Make $(gitexecdir) relative

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow add_path() to add non-existent directories to the path
Johannes Sixt [Mon, 21 Jul 2008 19:19:55 +0000 (21:19 +0200)]
Allow add_path() to add non-existent directories to the path

This function had used make_absolute_path(); but this function dies if
the directory that contains the entry whose relative path was supplied in
the argument does not exist. This is a problem if the argument is, for
example, "../libexec/git-core", and that "../libexec" does not exist.

Since the resolution of symbolic links is not required for elements in
PATH, we can fall back to using make_nonrelative_path(), which simply
prepends $PWD to the path.

We have to move make_nonrelative_path() alongside make_absolute_path() in
abspath.c so that git-shell can be linked. See 5b8e6f85f.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow the built-in exec path to be relative to the command invocation path
Johannes Sixt [Wed, 23 Jul 2008 19:12:18 +0000 (21:12 +0200)]
Allow the built-in exec path to be relative to the command invocation path

If GIT_EXEC_PATH (the macro that is defined in the Makefile) is relative,
it is interpreted relative to the command's invocation path, which usually
is $(bindir).

The Makefile rules were written with the assumption that $(gitexecdir) is
an absolute path. We introduce a separate variable that names the
(absolute) installation directory.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix relative built-in paths to be relative to the command invocation
Johannes Sixt [Mon, 21 Jul 2008 19:19:53 +0000 (21:19 +0200)]
Fix relative built-in paths to be relative to the command invocation

$(gitexecdir) (as defined in the Makefile) has gained another path
component, but the relative paths in the MINGW section of the Makefile,
which are interpreted relative to it, do not account for it.

Instead of adding another ../ in front of the path, we change the code that
constructs the absolute paths to do it relative to the command's directory,
which is essentially $(bindir). We do it this way because we will also
allow a relative $(gitexecdir) later.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRecord the command invocation path early
Johannes Sixt [Mon, 21 Jul 2008 19:19:52 +0000 (21:19 +0200)]
Record the command invocation path early

We will need the command invocation path in system_path(). This path was
passed to setup_path(), but  system_path() can be called earlier, for
example via:

    main
      commit_pager_choice
        setup_pager
          git_config
            git_etc_gitconfig
              system_path

Therefore, we introduce git_set_argv0_path() and call it as soon as
possible.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: Normalize $(bindir) and $(gitexecdir) before comparing
Johannes Sixt [Mon, 21 Jul 2008 19:19:51 +0000 (21:19 +0200)]
Makefile: Normalize $(bindir) and $(gitexecdir) before comparing

The install target needs to check whether the user has opted to make
$(gitexecdir) equal to $(bindir). It did so by a straight string
comparison. Since we are going to allow a relative $(gitexecdir), we have
to normalize paths before comparison, which we do with $(cd there && pwd).

The normalized paths are stored in shell variables. These we can now
reuse in the subsequent install statements, which conveniently shortens
the lines a bit.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: Do not install a copy of 'git' in $(gitexecdir)
Johannes Sixt [Mon, 21 Jul 2008 19:19:50 +0000 (21:19 +0200)]
Makefile: Do not install a copy of 'git' in $(gitexecdir)

There is already a copy in $(bindir). A subsequent patch will enable git
to derive the exec-path from its invocation path. If git is invoked
recursively, the first invocation puts the exec-path into PATH, so that
the recursive invocation would find the instance in the exec-path. This
second instance would again try to derive an exec-path from its invocation
path, but would base its result on the wrong "bindir".

We do install the copy of git first, but remove it later, so that we can
use it as the source of the hardlinks for the builtins.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: allow --exec and --remote without equal sign
Rene Scharfe [Fri, 25 Jul 2008 10:41:25 +0000 (12:41 +0200)]
archive: allow --exec and --remote without equal sign

Allow "--remote repo" and "--exec cmd" in addition to "--remote=repo" and
"--exec=cmd" to make their usage consistent with parameters handled by
parse_options().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: declare struct archiver where it's needed
Rene Scharfe [Fri, 25 Jul 2008 10:41:24 +0000 (12:41 +0200)]
archive: declare struct archiver where it's needed

Move the declaration of struct archiver to archive.c, as this is the only
file left where it is used.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: define MAX_ARGS where it's needed
Rene Scharfe [Fri, 25 Jul 2008 10:41:23 +0000 (12:41 +0200)]
archive: define MAX_ARGS where it's needed

MAX_EXTRA_ARGS is not used anymore, so remove it.  MAX_ARGS is used only
in builtin-upload-archive.c, so define it there.  Also report the actual
value we're comparing against when the number of args is too big.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: move parameter parsing code to archive.c
Rene Scharfe [Fri, 25 Jul 2008 10:41:22 +0000 (12:41 +0200)]
archive: move parameter parsing code to archive.c

write_archive() in archive.c is the only callsite for the command line
parsing functions located in builtin-archive.c.  Move them to the place
where they are used, un-export them and make them static, as hinted at
by Stephan.

Cc: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: add write_archive()
Rene Scharfe [Fri, 25 Jul 2008 10:41:21 +0000 (12:41 +0200)]
archive: add write_archive()

Both archive and upload-archive have to parse command line arguments and
then call the archiver specific write function.  Move the duplicate code
to a new function, write_archive().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove references to git-fetch-pack from "git clone" documentation.
Steve Haslam [Fri, 25 Jul 2008 18:37:48 +0000 (19:37 +0100)]
Remove references to git-fetch-pack from "git clone" documentation.

"git clone" no longer calls "git-fetch-pack", so the documentation is a bit
stale. Instead, state that the -u option is to be used when accessing a
repository over ssh.

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: Mention --abort in usage string part of OPTIONS_SPEC
Stephan Beyer [Fri, 25 Jul 2008 18:22:23 +0000 (20:22 +0200)]
git-am: Mention --abort in usage string part of OPTIONS_SPEC

The three separate lines for --skip, --resolved and --abort
are merged into one so that it is easy to see that they're
alternative and related options.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoPropagate -u/--upload-pack option of "git clone" to transport.
Steve Haslam [Fri, 25 Jul 2008 17:51:51 +0000 (18:51 +0100)]
Propagate -u/--upload-pack option of "git clone" to transport.

The -u option to override the remote system's path to git-upload-pack was
being ignored by "git clone"; caused by a missing call to
transport_set_option to set TRANS_OPT_UPLOADPACK. Presumably this crept in
when git-clone was converted from shell to C.

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoeditor.c: Libify launch_editor()
Stephan Beyer [Fri, 25 Jul 2008 16:28:42 +0000 (18:28 +0200)]
editor.c: Libify launch_editor()

This patch removes exit()/die() calls and builtin-specific messages
from launch_editor(), so that it can be used as a general libgit.a
function to launch an editor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMove launch_editor() from builtin-tag.c to editor.c
Stephan Beyer [Fri, 25 Jul 2008 16:28:41 +0000 (18:28 +0200)]
Move launch_editor() from builtin-tag.c to editor.c

launch_editor() is declared in strbuf.h but defined in builtin-tag.c.
This patch moves launch_editor() into a new source file editor.c,
but keeps the declaration in strbuf.h.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Fri, 25 Jul 2008 20:56:36 +0000 (13:56 -0700)]
Merge branch 'maint'

* maint:
  Makefile: fix shell quoting
  tests: propagate $(TAR) down from the toplevel Makefile
  index-pack.c: correctly initialize appended objects
  send-email: find body-encoding correctly

16 years agoDocumentation: clarify how to disable elements in core.whitespace
Junio C Hamano [Fri, 25 Jul 2008 07:34:47 +0000 (00:34 -0700)]
Documentation: clarify how to disable elements in core.whitespace

Noticed by Peter Valdemar Mørch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: fix shell quoting
Junio C Hamano [Fri, 25 Jul 2008 19:35:10 +0000 (12:35 -0700)]
Makefile: fix shell quoting

Makefile records paths to a few programs in GIT-BUILD-OPTIONS file.  These
paths need to be quoted twice: once to protect specials from the shell
that runs the generated GIT-BUILD-OPTIONS file, and again to protect them
(and the first level of quoting itself) from the shell that runs the
"echo" inside the Makefile.

You can test this by trying:

    $ ln -s /bin/tar "$HOME/Tes' program/tar"
    $ make TAR="$HOME/Tes' program/tar" test

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotests: propagate $(TAR) down from the toplevel Makefile
Junio C Hamano [Fri, 25 Jul 2008 18:09:48 +0000 (11:09 -0700)]
tests: propagate $(TAR) down from the toplevel Makefile

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack.c: correctly initialize appended objects
Björn Steinbrink [Thu, 24 Jul 2008 17:32:00 +0000 (18:32 +0100)]
index-pack.c: correctly initialize appended objects

When index-pack completes a thin pack it appends objects to the pack.
Since the commit 92392b4(index-pack: Honor core.deltaBaseCacheLimit when
resolving deltas) such an object can be pruned in case of memory
pressure, and will be read back again by get_data_from_pack().  For this
to work, the fields in object_entry structure need to be initialized
properly.

Noticed by Pierre Habouzit.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: find body-encoding correctly
Peter Valdemar Mørch [Fri, 25 Jul 2008 13:06:48 +0000 (15:06 +0200)]
send-email: find body-encoding correctly

In 8291db6 (git-send-email: add charset header if we add encoded 'From',
2007-11-16), "$1" is used from a regexp without using () to capture
anything in $1. Later, when that value was used, it causes a warning about
a variable being undefined, instead of using the correct value for
comparison (not that it makes difference in the current code that does not
do actual re-encoding).

Signed-off-by: Peter Valdemar Mørch <peter@morch.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodocument that git-tag can tag more than heads
Jonathan Nieder [Thu, 24 Jul 2008 16:55:25 +0000 (11:55 -0500)]
document that git-tag can tag more than heads

After looking the git-tag manpage, someone on #git wondered how
to tag a commit that is not a branch head.  This patch changes
the synopsis to say "<commit> | <object>" instead of "<head>" to
address his question.

Samuel Bronson had the idea of putting "<commit> | <object>"
for "<object>" because most tags point to commits (and for the
rest of the manpage, all tags point to commits).

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoperl/Makefile: update NO_PERL_MAKEMAKER section
Brandon Casey [Tue, 22 Jul 2008 21:15:41 +0000 (16:15 -0500)]
perl/Makefile: update NO_PERL_MAKEMAKER section

The perl modules must be copied to blib/lib so they are available for
testing.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash: offer only paths after '--' for 'git checkout'
SZEDER Gábor [Wed, 23 Jul 2008 11:49:22 +0000 (13:49 +0200)]
bash: offer only paths after '--' for 'git checkout'

Commit d773c631 (bash: offer only paths after '--', 2008-07-08) did the
same for several other git commands, but 'git checkout' went unnoticed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocheckout: mention '--' in the docs
SZEDER Gábor [Wed, 23 Jul 2008 11:49:21 +0000 (13:49 +0200)]
checkout: mention '--' in the docs

'git checkout' uses '--' to separate options from paths, but it was not
mentioned in the documentation

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ph/checkout'
Junio C Hamano [Fri, 25 Jul 2008 06:24:17 +0000 (23:24 -0700)]
Merge branch 'ph/checkout'

* ph/checkout:
  git-checkout: improve error messages, detect ambiguities.
  git-checkout: fix command line parsing.

16 years agogit-checkout: improve error messages, detect ambiguities.
Pierre Habouzit [Wed, 23 Jul 2008 10:15:33 +0000 (12:15 +0200)]
git-checkout: improve error messages, detect ambiguities.

The patch is twofold: it moves the option consistency checks just under
the parse_options call so that it doesn't get in the way of the tree
reference vs. pathspecs desambiguation.

The other part rewrites the way to understand arguments so that when
git-checkout fails it does with an understandable message. Compared to the
previous behavior we now have:

  - a better error message when doing:

        git checkout <blob reference> --

    now complains about the reference not pointing to a tree, instead of
    things like:

        error: pathspec <blob reference> did not match any file(s) known to git.
        error: pathspec '--' did not match any file(s) known to git.

  - a better error message when doing:

        git checkout <path> --

    It now complains about <path> not being a reference instead of the
    completely obscure:

        error: pathspec '--' did not match any file(s) known to git.

  - an error when -- wasn't used, and the first argument is ambiguous
    (i.e. can be interpreted as both ref and as path).

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoupdate test case to protect am --skip behaviour
Olivier Marin [Thu, 24 Jul 2008 12:44:40 +0000 (14:44 +0200)]
update test case to protect am --skip behaviour

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach fsck and prune about the new location of temporary objects
Brandon Casey [Thu, 24 Jul 2008 22:41:12 +0000 (17:41 -0500)]
Teach fsck and prune about the new location of temporary objects

Since 5723fe7e, temporary objects are now created in their final destination
directories, rather than in .git/objects/. Teach fsck to recognize and
ignore the temporary objects it encounters, and teach prune to remove them.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' into ph/checkout
Junio C Hamano [Thu, 24 Jul 2008 01:42:24 +0000 (18:42 -0700)]
Merge branch 'maint' into ph/checkout

* maint:
  git-checkout: fix command line parsing.

16 years agoMake non-static functions, that may be static, static
Stephan Beyer [Wed, 23 Jul 2008 23:09:35 +0000 (01:09 +0200)]
Make non-static functions, that may be static, static

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoignore non-existent refs in dwim_log()
Junio C Hamano [Thu, 24 Jul 2008 00:22:58 +0000 (17:22 -0700)]
ignore non-existent refs in dwim_log()

f2eba66 (Enable HEAD@{...} and make it independent from the current
branch, 2007-02-03) introduced dwim_log() to handle <refname>@{...}
syntax, and as part of its processing, it checks if the ref exists by
calling refsolve_ref().  It should call it as a reader to make sure the
call returns NULL for a nonexistent ref (not as a potential writer in
which case it does not return NULL).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-completion.bash: provide completion for 'show-branch'
Thomas Rast [Wed, 23 Jul 2008 21:36:15 +0000 (23:36 +0200)]
git-completion.bash: provide completion for 'show-branch'

It previously used the same as 'log', but the options are quite
different and the arguments must be single refs (or globs).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Add long options for 'git rm'
Lee Marlow [Wed, 23 Jul 2008 21:21:08 +0000 (15:21 -0600)]
bash completion: Add long options for 'git rm'

Options added: --cached --dry-run --ignore-unmatch --quiet

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosvnimport: newer libsvn wants us to ask for the root with "", not "/"
P. Christeas [Wed, 23 Jul 2008 20:08:27 +0000 (23:08 +0300)]
svnimport: newer libsvn wants us to ask for the root with "", not "/"

In r27729, libsvn introduced an assert which explicitly
forbids searching the tree at "/". Luckily enough, it
still accepts an empty string "" as the starting point.

http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_ra/ra_loader.c?r1=27653&r2=27729

Tested against libsvn0-1.5.0-4mdv2009.0 (needs the fix),
libsvn0-1.4.6-5mdv2008.1 (works anyway)

Signed-off-by: P. Christeas <p_christ@hol.gr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-filter-branch: teach "rm" instead of "update-index --remove"
Petr Baudis [Tue, 22 Jul 2008 22:24:35 +0000 (00:24 +0200)]
Documentation/git-filter-branch: teach "rm" instead of "update-index --remove"

The example to remove paths using index-filter was done with
"git update-index --remove"; "git rm --cached" would be more familiar to
new people and is sufficient for this particular case.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit daemon: avoid waking up too often
Johannes Schindelin [Tue, 22 Jul 2008 22:03:01 +0000 (23:03 +0100)]
git daemon: avoid waking up too often

To avoid waking up unnecessarily, a pipe is set up that is only ever
written to by child_handler(), when a child disconnects, as suggested
per Junio.

This avoids waking up the main process every second to see if a child
was disconnected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-commit: Two trivial style-cleanups
Johannes Schindelin [Tue, 22 Jul 2008 20:40:41 +0000 (21:40 +0100)]
builtin-commit: Two trivial style-cleanups

Pierre Habouzit noticed that two variables were not static which should
have been, and that adding "\n\n" is better than adding '\n' twice.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: clarify diff --cc
Junio C Hamano [Wed, 23 Jul 2008 23:16:05 +0000 (16:16 -0700)]
Documentation: clarify diff --cc

The definition of an "uninteresting" hunk was not in line with reality.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoam --abort: Add to bash-completion and mention in git-rerere documentation
Stephan Beyer [Wed, 23 Jul 2008 00:10:25 +0000 (02:10 +0200)]
am --abort: Add to bash-completion and mention in git-rerere documentation

The git-rerere documentation talks about commands that invoke
"git rerere clear" automatically. git am --abort is added and
a typo is fixed additionally.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-filter-branch.sh: Allow running in bare repositories
Petr Baudis [Wed, 23 Jul 2008 22:15:36 +0000 (00:15 +0200)]
git-filter-branch.sh: Allow running in bare repositories

Commit 46eb449c restricted git-filter-branch to non-bare repositories
unnecessarily; git-filter-branch can work on bare repositories just
fine.

Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-branch.c: optimize --merged and --no-merged
Junio C Hamano [Wed, 23 Jul 2008 22:13:41 +0000 (15:13 -0700)]
builtin-branch.c: optimize --merged and --no-merged

"git branch --no-merged $commit" used to compute the merge base between
the tip of each and every branch with the named $commit, but this was
wasteful when you have many branches.  Inside append_ref() we literally
ran has_commit() between the tip of the branch and the merge_filter_ref.

Instead, we can let the revision machinery traverse the history as if we
are running:

    $ git rev-list --branches --not $commit

by queueing the tips of branches we encounter as positive refs (this
mimicks the "--branches" option in the above command line) and then
appending the merge_filter_ref commit as a negative one, and finally
calling prepare_revision_walk() to limit the list..

After the traversal is done, branch tips that are reachable from $commit
are painted UNINTERESTING; they are already fully contained in $commit
(i.e. --merged).  Tips that are not painted UNINTERESTING still have
commits that are not reachable from $commit, thus "--no-merged" will show
them.

With an artificial repository that has "master" and 1000 test-$i branches
where they were created by "git branch test-$i master~$i":

    (with patch)
    $ /usr/bin/time git-branch --no-merged master >/dev/null
    0.12user 0.02system 0:00.15elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+1588minor)pagefaults 0swaps

    $ /usr/bin/time git-branch --no-merged test-200 >/dev/null
    0.15user 0.03system 0:00.18elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+1711minor)pagefaults 0swaps

    (without patch)
    $ /usr/bin/time git-branch --no-merged master >/dev/null
    0.69user 0.03system 0:00.72elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+2229minor)pagefaults 0swaps

    $ /usr/bin/time git-branch --no-merged test-200 >/dev/null
    0.58user 0.03system 0:00.61elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+2248minor)pagefaults 0swaps

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-branch.c: remove unused code in append_ref() callback function
Junio C Hamano [Wed, 23 Jul 2008 21:52:47 +0000 (14:52 -0700)]
builtin-branch.c: remove unused code in append_ref() callback function

We let for_each_ref() to feed all refs to append_ref() but we are only
ever interested in local or remote tracking branches.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agostash save: fix parameter handling
Junio C Hamano [Wed, 23 Jul 2008 20:33:44 +0000 (13:33 -0700)]
stash save: fix parameter handling

A command line "git stash save --keep-index I was doing this" was
misparsed and keep-index codepath did not trigger.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: Add colon before the subject that is printed out as being applied
Stephan Beyer [Wed, 23 Jul 2008 16:46:36 +0000 (18:46 +0200)]
git-am: Add colon before the subject that is printed out as being applied

git-am output can be confusing, because the subject of the applied
patch can look like the rest of a sentence starting with "Applying".
The added colon should make this clearer.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-checkout: fix command line parsing.
Pierre Habouzit [Wed, 23 Jul 2008 10:15:32 +0000 (12:15 +0200)]
git-checkout: fix command line parsing.

This fixes an issue when you use:

    $ git checkout -- <path1> [<paths>...]

and that <path1> can also be understood as a reference. git-checkout
mistakenly understands this as the same as:

    $ git checkout <path1> -- [<paths>...]

because parse-options was eating the '--' and the argument parser thought
he was parsing:

    $ git checkout <path1> [<paths>...]

Where there indeed is an ambiguity

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorebase -i: When an 'edit' stops, mention the commit
Johannes Sixt [Wed, 23 Jul 2008 07:46:35 +0000 (09:46 +0200)]
rebase -i: When an 'edit' stops, mention the commit

In a rebase session where more than one commit is to be 'edit'ed, and the
user spends considerable time to 'edit' a commit, it is easy to forget what
one wanted to 'edit' at the individual commits. It would be helpful to see
at which commit the rebase stopped.

Incidentally, if the rebase stopped due to merge conflicts or other errors,
the commit was already reported ("Could not apply $sha1..."), but when
rebase stopped after successfully applying an "edit" commit, it would not
mention it. With this change the commit is reported.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosort_in_topological_order(): avoid setting a commit flag
Johannes Schindelin [Wed, 23 Jul 2008 00:51:36 +0000 (01:51 +0100)]
sort_in_topological_order(): avoid setting a commit flag

We used to set the TOPOSORT flag of commits during the topological
sorting, but we can just as well use the member "indegree" for it:
indegree is now incremented by 1 in the cases where the commit used
to have the TOPOSORT flag.

This is the same behavior as before, since indegree could not be
non-zero when TOPOSORT was unset.

Incidentally, this fixes the bug in show-branch where the 8th column
was not shown: show-branch sorts the commits in topological order,
assuming that all the commit flags are available for show-branch's
private matters.

But this was not true: TOPOSORT was identical to the flag corresponding
to the 8th ref.  So the flags for the 8th column were unset by the
topological sorting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd test to show that show-branch misses out the 8th column
Johannes Schindelin [Wed, 23 Jul 2008 00:50:35 +0000 (01:50 +0100)]
Add test to show that show-branch misses out the 8th column

Noticed by Pasky.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoIgnore dirty submodule states in "git pull --rebase"
Johannes Schindelin [Tue, 22 Jul 2008 21:41:41 +0000 (22:41 +0100)]
Ignore dirty submodule states in "git pull --rebase"

This is a companion patch to 6848d58c(Ignore dirty submodule states
during rebase and stash).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/t4202-log.sh: add newline at end of file
Brandon Casey [Tue, 22 Jul 2008 21:23:31 +0000 (16:23 -0500)]
t/t4202-log.sh: add newline at end of file

Some shells hang when parsing the script if the last statement is not
followed by a newline. So add one.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7502-commit.sh: rearrange test to make more portable
Brandon Casey [Tue, 22 Jul 2008 21:21:10 +0000 (16:21 -0500)]
t7502-commit.sh: rearrange test to make more portable

Some shells have problems with one-shot environment variable export
and function calls. The sequence is rearranged to avoid the one-shot
and to allow the test script to be linked together with '&&'.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot3200,t7201: replace '!' with test_must_fail
Brandon Casey [Tue, 22 Jul 2008 21:16:54 +0000 (16:16 -0500)]
t3200,t7201: replace '!' with test_must_fail

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot4116-apply-reverse.sh: use $TAR rather than tar
Brandon Casey [Tue, 22 Jul 2008 21:16:25 +0000 (16:16 -0500)]
t4116-apply-reverse.sh: use $TAR rather than tar

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/: Replace diff [-u|-U0] with test_cmp to allow compilation with old diff
Brandon Casey [Tue, 22 Jul 2008 21:17:43 +0000 (16:17 -0500)]
t/: Replace diff [-u|-U0] with test_cmp to allow compilation with old diff

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7601: extend the 'merge picks up the best result' test
Miklos Vajna [Tue, 22 Jul 2008 17:05:59 +0000 (19:05 +0200)]
t7601: extend the 'merge picks up the best result' test

The test only checked if the best result picking code works if there are
multiple strategies set in the config. Add a similar one that tests if
the same true if the -s option of git merge was used multiple times.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoIn perforce, RCS keywords are case-sensitive
Daniel Barkalow [Tue, 22 Jul 2008 16:48:57 +0000 (12:48 -0400)]
In perforce, RCS keywords are case-sensitive

At least, this is true in 2007.2, according to the documentation.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow pager of diff command be enabled/disabled
Alex Riesen [Mon, 21 Jul 2008 21:28:49 +0000 (23:28 +0200)]
Allow pager of diff command be enabled/disabled

See for example, status and show commands. Besides,
Documentation/RelNotes-1.6.0.txt mentions that pager.<cmd>
can be used to enable/disable paging behavior per command.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix two leftovers from path_list->string_list
Johannes Schindelin [Tue, 22 Jul 2008 11:09:47 +0000 (13:09 +0200)]
Fix two leftovers from path_list->string_list

In the documentation, where you cannot get compile errors for using the
wrong member name, there were two mentions of 'path' left.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit am --skip: clean the index while preserving local changes
Olivier Marin [Mon, 21 Jul 2008 13:39:06 +0000 (15:39 +0200)]
git am --skip: clean the index while preserving local changes

In 3-way merge, "am" will let the index with unmerged path waiting
for us to resolve conflicts and continue. But if we want to --skip
instead, "am" refuses to continue because of the dirty index.

With this patch, "am" will clean the index without touching files
locally modified, before continuing.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule: move ill placed shift.
Pierre Habouzit [Mon, 21 Jul 2008 18:15:59 +0000 (20:15 +0200)]
git-submodule: move ill placed shift.

When running git submodule update -i, the "-i" is shifted before recursing
into cmd_init and then again outside of the loop. This causes some /bin/sh
to complain about shifting when there are no arguments left (and would
discard anything written after -i too).

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-merge: add missing structure initialization
Pierre Habouzit [Tue, 22 Jul 2008 05:32:53 +0000 (22:32 -0700)]
builtin-merge: add missing structure initialization

The parameter that is eventually passed to read_directory() to scan the
working tree should be properly initialized.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-merge: give a proper error message for invalid strategies in config
Miklos Vajna [Mon, 21 Jul 2008 16:10:47 +0000 (18:10 +0200)]
builtin-merge: give a proper error message for invalid strategies in config

'git merge -s foobar' diagnosed invalid "foobar" strategy and errored out
with a message, but foobar in pull.twohead or pull.octopus was just
silently ignored.  This makes invalid strategy both on the command line
and in the configuration file to trigger the same error.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotests: do not rely on external "patch"
Junio C Hamano [Sun, 20 Jul 2008 08:33:46 +0000 (01:33 -0700)]
tests: do not rely on external "patch"

Some of our tests assumed a working "patch" command to produce expected
results when checking "git-apply", but some systems have broken "patch".

We can compare our output with expected output that is precomputed
instead to sidestep this issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't cut off last character of commit descriptions.
Nikolaj Schumacher [Mon, 30 Jun 2008 10:08:16 +0000 (12:08 +0200)]
Don't cut off last character of commit descriptions.

This should have been part of 24a2293 (git-blame.el: show the when, who
and what in the minibuffer., 2008-02-12), that changed from using
--pretty=oneline to --pretty=format:... without terminating newline.

Acked-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoparse-options: fix segmentation fault when a required value is missing
Olivier Marin [Mon, 21 Jul 2008 18:30:36 +0000 (20:30 +0200)]
parse-options: fix segmentation fault when a required value is missing

p->argc represent the number of arguments that have not been parsed yet,
_including_ the one we are currently parsing. If it is not greater than
one then there is no more argument.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Acked-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomailinfo: better parse email adresses containg parentheses
Philippe Bruhat (BooK) [Mon, 21 Jul 2008 13:34:29 +0000 (15:34 +0200)]
mailinfo: better parse email adresses containg parentheses

When using git-rebase, author fields containing a ')' at the last position
had the close-parens character removed; the removal should be done only
when it is of this form:

        user@host (User Name)

i.e. the remainder after stripping the e-mail address part is enclosed in
a parentheses pair as a whole, not for addresses like this:

        User Name (me) <user@host>

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Acked-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: remove dash from help message
Olivier Marin [Mon, 21 Jul 2008 14:12:20 +0000 (16:12 +0200)]
git-am: remove dash from help message

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRevert "make git-status use a pager"
Junio C Hamano [Tue, 22 Jul 2008 02:41:17 +0000 (19:41 -0700)]
Revert "make git-status use a pager"

This reverts commit c8af1de9cfa0a5678ae766777e0f905e60b69fda.

The change was immensely unpopular, and poeple who would really want to
page can use pager.status configuration.

16 years agogit-diff(1): "--c" -> "--cc" typo fix
Jonathan Nieder [Mon, 21 Jul 2008 18:34:06 +0000 (13:34 -0500)]
git-diff(1): "--c" -> "--cc" typo fix

git diff does not take a --c option.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRename path_list to string_list
Johannes Schindelin [Mon, 21 Jul 2008 18:03:49 +0000 (19:03 +0100)]
Rename path_list to string_list

The name path_list was correct for the first usage of that data structure,
but it really is a general-purpose string list.

$ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
$ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
$ git mv path-list.h string-list.h
$ git mv path-list.c string-list.c
$ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
$ perl -i -pe 's/path/string/g' string-list.[ch]
$ git mv Documentation/technical/api-path-list.txt \
Documentation/technical/api-string-list.txt
$ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)

... and then fix all users of string-list to access the member "string"
instead of "path".

Documentation/technical/api-string-list.txt needed some rewrapping, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRename .git/rebase to .git/rebase-apply
Johannes Schindelin [Mon, 21 Jul 2008 10:51:02 +0000 (12:51 +0200)]
Rename .git/rebase to .git/rebase-apply

With git-am, it sounds awkward to have the patches in ".git/rebase/",
but for technical reasons, we have to keep the same directory name
for git-am and git-rebase. ".git/rebase-apply" seems to be a good
compromise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate my e-mail address
Junio C Hamano [Mon, 21 Jul 2008 19:14:42 +0000 (12:14 -0700)]
Update my e-mail address

The old cox.net address is still getting mails from gitters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ap/trackinfo' v1.6.0-rc0
Junio C Hamano [Mon, 21 Jul 2008 01:00:27 +0000 (18:00 -0700)]
Merge branch 'ap/trackinfo'

* ap/trackinfo:
  Reword "your branch has diverged..." lines to reduce line length

16 years agoMerge branch 'jc/rerere-auto-more'
Junio C Hamano [Mon, 21 Jul 2008 01:00:17 +0000 (18:00 -0700)]
Merge branch 'jc/rerere-auto-more'

* jc/rerere-auto-more:
  rerere.autoupdate: change the message when autoupdate is in effect

16 years agoMerge branch 'ns/am-abort'
Junio C Hamano [Mon, 21 Jul 2008 01:00:13 +0000 (18:00 -0700)]
Merge branch 'ns/am-abort'

* ns/am-abort:
  git am --abort

16 years agoMerge branch 'jc/add-addremove'
Junio C Hamano [Mon, 21 Jul 2008 00:53:17 +0000 (17:53 -0700)]
Merge branch 'jc/add-addremove'

* jc/add-addremove:
  git-add --all: documentation
  git-add --all: tests
  git-add --all: add all files
  builtin-add.c: restructure the code for maintainability

Conflicts:
builtin-add.c

16 years ago"needs update" considered harmful
Junio C Hamano [Sun, 20 Jul 2008 07:21:38 +0000 (00:21 -0700)]
"needs update" considered harmful

"git update-index --refresh", "git reset" and "git add --refresh" have
reported paths that have local modifications as "needs update" since the
beginning of git.

Although this is logically correct in that you need to update the index at
that path before you can commit that change, it is now becoming more and
more clear, especially with the continuous push for user friendliness
since 1.5.0 series, that the message is suboptimal.  After all, the change
may be something the user might want to get rid of, and "updating" would
be absolutely a wrong thing to do if that is the case.

I prepared two alternatives to solve this.  Both aim to reword the message
to more neutral "locally modified".

This patch is a more intrusive variant that changes the message for only
Porcelain commands ("add" and "reset") while keeping the plumbing
"update-index" intact.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMove read_in_full() and write_in_full() to wrapper.c
Junio C Hamano [Sun, 20 Jul 2008 23:13:05 +0000 (16:13 -0700)]
Move read_in_full() and write_in_full() to wrapper.c

A few compat/* layer functions call these functions, but we would really
want to keep them thin, without depending too much on the libgit proper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoLink shell with compat layer functions
Junio C Hamano [Sun, 20 Jul 2008 22:58:13 +0000 (15:58 -0700)]
Link shell with compat layer functions

This in the short term will break on platforms that use compat implemenations
that call outside compat layer, but that is exactly what we want.  To give
incentive to fix things for people who are affected and more importantly have
environment to test their fixes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 21 Jul 2008 00:16:29 +0000 (17:16 -0700)]
Merge branch 'maint'

* maint:
  fix usage string for git grep
  refresh-index: fix bitmask assignment

Conflicts:
builtin-grep.c

16 years agogit-svn: fix git svn info to work without arguments
Dmitry Potapov [Sun, 20 Jul 2008 20:14:07 +0000 (00:14 +0400)]
git-svn: fix git svn info to work without arguments

commit 2fe403e7452bd6e1e8232445cf5434ce8f1af973 broke "git-svn info ."
due to replacing '.' with '' in canonicalize_path for the top directory,
while find_file_type_and_diff_status was not corrected.

Bug reports:

http://thread.gmane.org/gmane.comp.version-control.git/87822/
http://bugs.debian.org/490400

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-push.c: Cleanup - use OPT_BIT() and remove some variables
Michele Ballabio [Sun, 20 Jul 2008 12:02:20 +0000 (14:02 +0200)]
builtin-push.c: Cleanup - use OPT_BIT() and remove some variables

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-merge.c: Fix option parsing
Michele Ballabio [Sun, 20 Jul 2008 12:34:47 +0000 (14:34 +0200)]
builtin-merge.c: Fix option parsing

Now "git merge -m" needs a message, and errors out with the usage
text if none is given.
This way, t7600-merge.sh is fixed.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofix usage string for git grep
Jonathan Nieder [Sun, 20 Jul 2008 19:13:08 +0000 (14:13 -0500)]
fix usage string for git grep

Without this patch, git-grep gives confusing usage information:

$ git grep --confused
usage: git grep <option>* <rev>* [-e] <pattern> [<path>...]
$ git grep HEAD pattern
fatal: ambiguous argument 'pattern': unknown revision or path no
t in the working tree.
Use '--' to separate paths from revisions

So put <pattern> before the <rev>s, in accordance with actual correct
usage.  While we're changing the usage string, we might as well include
the "--" separating revisions and paths, too.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach 'git merge' that some merge strategies no longer exist
Miklos Vajna [Sun, 20 Jul 2008 12:12:48 +0000 (14:12 +0200)]
Teach 'git merge' that some merge strategies no longer exist

'recur' co-existed with 'recursive' when rewriting it in C, but it no
longer available.  'stupid' was also recently removed.

"git merge -s confused origin" still includes them in the list of
available merge strategies.

[jc: this is a squash of two micropatches]

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocvsserver: Add testsuite for packed refs
Lars Noschinski [Thu, 17 Jul 2008 17:00:28 +0000 (19:00 +0200)]
cvsserver: Add testsuite for packed refs

Check that req_update shows refs, even if all refs are packed.

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorefresh-index: fix bitmask assignment
Junio C Hamano [Sun, 20 Jul 2008 06:25:00 +0000 (23:25 -0700)]
refresh-index: fix bitmask assignment

5fdeacb (Teach update-index about --ignore-submodules, 2008-05-14) added a
new refresh option flag but did not assign a unique bit for it correctly,
and broke "update-index --ignore-missing".

This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add --all: documentation
Junio C Hamano [Sun, 20 Jul 2008 05:34:16 +0000 (22:34 -0700)]
git-add --all: documentation

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add --all: tests
Junio C Hamano [Sun, 20 Jul 2008 03:32:38 +0000 (20:32 -0700)]
git-add --all: tests

And here is a small test script that makes sure that:

 - both modified and new files are included,
 - removed file is noticed, and
 - no ignored file is included.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add --all: add all files
Junio C Hamano [Sun, 20 Jul 2008 02:51:11 +0000 (19:51 -0700)]
git-add --all: add all files

People sometimes find that "git add -u && git add ." are 13 keystrokes too
many.  This reduces it by nine.

The support of this has been very low priority for me personally, because
I almost never do "git add ." in a directory with already tracked files,
and in a new directory, there is no point saying "git add -u".

However, for two types of people (that are very different from me), this
mode of operation may make sense and there is no reason to leave it
unsupported.  That is:

 (1) If you are extremely well disciplined and keep perfect .gitignore, it
     always is safe to say "git add ."; or

 (2) If you are extremely undisciplined and do not even know what files
     you created, and you do not very much care what goes in your history,
     it does not matter if "git add ." included everything.

So there it is, although I suspect I will not use it myself, ever.

It will be too much of a change that is against the expectation of the
existing users to allow "git commit -a" to include untracked files, and
it would be inconsistent if we named this new option "-a", so the short
option is "-A".  We _might_ want to later add "git commit -A" but that is
a separate topic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-add.c: restructure the code for maintainability
Junio C Hamano [Sun, 20 Jul 2008 02:22:25 +0000 (19:22 -0700)]
builtin-add.c: restructure the code for maintainability

The implementation of "git add" has four major codepaths that are mutually
exclusive:

 - if "--interactive" or "--patch" is given, spawn "git add--interactive"
   and exit without doing anything else.  Otherwise things are handled
   internally in this C code;

 - if "--update" is given, update the modified files and exit without
   doing anything else;

 - if "--refresh" is given, do refresh and exit without doing anything
   else;

 - otherwise, find the paths that match pathspecs and stage their
   contents.

It led to an unholy mess in the code structure; each of the latter three
codepaths has a separate call to read_cache(), even though they are all
about "read the current index, update it and write it back", and logically
they should read the index once _anyway_.

This cleans up the latter three cases by introducing a pair of helper
variables:

 - "add_new_files" is set if we need to scan the working tree for paths
   that match the pathspec.  This variable is false for "--update" and
   "--refresh", because they only work on already tracked files.

 - "require_pathspec" is set if the user must give at least one pathspec.
   "--update" does not need it but all the other cases do.

This is in preparation for introducing a new option "--all", that does the
equivalent of "git add -u && git add ." (aka "addremove").

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGetting closer to 1.6.0-rc0
Junio C Hamano [Sat, 19 Jul 2008 22:52:12 +0000 (15:52 -0700)]
Getting closer to 1.6.0-rc0

Update the links to "stale" versions of documentation to link to 1.5.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>