Code

git.git
14 years agoAdd an optional argument for --color options
Mark Lodato [Wed, 17 Feb 2010 04:55:58 +0000 (23:55 -0500)]
Add an optional argument for --color options

Make git-branch, git-show-branch, git-grep, and all the diff-based
programs accept an optional argument <when> for --color.  The argument
is a colorbool: "always", "never", or "auto".  If no argument is given,
"always" is used;  --no-color is an alias for --color=never.  This makes
the command-line interface consistent with other GNU tools, such as `ls'
and `grep', and with the git-config color options.  Note that, without
an argument, --color and --no-color work exactly as before.

To implement this, two internal changes were made:

1. Allow the first argument of git_config_colorbool() to be NULL,
   in which case it returns -1 if the argument isn't "always", "never",
   or "auto".

2. Add OPT_COLOR_FLAG(), OPT__COLOR(), and parse_opt_color_flag_cb()
   to the option parsing library.  The callback uses
   git_config_colorbool(), so color.h is now a dependency
   of parse-options.c.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: describe --thin more accurately
Stephen Boyd [Thu, 18 Feb 2010 09:10:28 +0000 (01:10 -0800)]
Documentation: describe --thin more accurately

The description for --thin was misleading and downright wrong. Correct
it with some inspiration from the description of index-pack's --fix-thin
and some background information from Nicolas Pitre <nico@fluxnic.net>.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Thu, 18 Feb 2010 07:03:46 +0000 (23:03 -0800)]
Merge branch 'maint'

* maint:
  docs: don't talk about $GIT_DIR/refs/ everywhere

14 years agodocs: don't talk about $GIT_DIR/refs/ everywhere
Jeff King [Thu, 18 Feb 2010 01:16:20 +0000 (20:16 -0500)]
docs: don't talk about $GIT_DIR/refs/ everywhere

It is misleading to say that we pull refs from $GIT_DIR/refs/*, because we
may also consult the packed refs mechanism. These days we tend to treat
the "refs hierarchy" as more of an abstract namespace that happens to be
represented as $GIT_DIR/refs. At best, this is a minor inaccuracy, but at
worst it can confuse users who then look in $GIT_DIR/refs and find that it
is missing some of the refs they expected to see.

This patch drops most uses of "$GIT_DIR/refs/*", changing them into just
"refs/*", under the assumption that users can handle the concept of an
abstract refs namespace. There are a few things to note:

  - most cases just dropped the $GIT_DIR/ portion. But for cases where
    that left _just_ the word "refs", I changed it to "refs/" to help
    indicate that it was a hierarchy.  I didn't do the same for longer
    paths (e.g., "refs/heads" remained, instead of becoming
    "refs/heads/").

  - in some cases, no change was made, as the text was explicitly about
    unpacked refs (e.g., the discussion in git-pack-refs).

  - In some cases it made sense instead to note the existence of packed
    refs (e.g., in check-ref-format and rev-parse).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorefactor duplicated encode_header in pack-objects and fast-import
Michael Lukashov [Tue, 16 Feb 2010 23:42:54 +0000 (23:42 +0000)]
refactor duplicated encode_header in pack-objects and fast-import

The following function is duplicated:

  encode_header

Move this function to sha1_file.c and rename it 'encode_in_pack_object_header',
as suggested by Junio C Hamano

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'np/fast-import-idx-v2'
Junio C Hamano [Wed, 17 Feb 2010 23:28:25 +0000 (15:28 -0800)]
Merge branch 'np/fast-import-idx-v2'

* np/fast-import-idx-v2:
  fast-import: use the diff_delta() max_delta_size argument
  fast-import: honor pack.indexversion and pack.packsizelimit config vars
  fast-import: make default pack size unlimited
  fast-import: use write_idx_file() instead of custom code
  fast-import: use sha1write() for pack data
  fast-import: start using struct pack_idx_entry

Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorefactor duplicated fill_mm() in checkout and merge-recursive
Michael Lukashov [Tue, 16 Feb 2010 23:42:55 +0000 (23:42 +0000)]
refactor duplicated fill_mm() in checkout and merge-recursive

The following function is duplicated:

  fill_mm

Move it to xdiff-interface.c and rename it 'read_mmblob', as suggested
by Junio C Hamano.

Also, change parameters order for consistency with read_mmfile().

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorefactor duplicated code in builtin-send-pack.c and transport.c
Michael Lukashov [Tue, 16 Feb 2010 23:42:52 +0000 (23:42 +0000)]
refactor duplicated code in builtin-send-pack.c and transport.c

The following functions are (almost) identical:

  verify_remote_names
  update_tracking_ref
  refs_pushed
  print_push_status

Move common versions of these functions to transport.c and rename
them, as suggested by Jeff King and Junio C Hamano.

These functions have been removed entirely from builtin-send-pack.c,
since they are only used internally by print_push_status():

  print_ref_status
  status_abbrev
  print_ok_ref_status
  print_one_push_status

Also, move #define SUMMARY_WIDTH to transport.h and rename it
TRANSPORT_SUMMARY_WIDTH as it is used in builtin-fetch.c and
transport.c

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoconnect.c: move duplicated code to a new function 'get_host_and_port'
Michael Lukashov [Wed, 17 Feb 2010 20:56:02 +0000 (20:56 +0000)]
connect.c: move duplicated code to a new function 'get_host_and_port'

The following functions:

  git_tcp_connect_sock (IPV6 version)
  git_tcp_connect_sock (no IPV6 version),
  git_proxy_connect

have common block of code. Move it to a new function 'get_host_and_port'

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUpdate draft release notes to 1.7.1
Junio C Hamano [Wed, 17 Feb 2010 23:01:11 +0000 (15:01 -0800)]
Update draft release notes to 1.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Wed, 17 Feb 2010 23:00:10 +0000 (15:00 -0800)]
Merge branch 'maint'

* maint:
  Update 1.7.0.1 release notes

14 years agoUpdate 1.7.0.1 release notes
Junio C Hamano [Wed, 17 Feb 2010 23:00:00 +0000 (15:00 -0800)]
Update 1.7.0.1 release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jk/cherry-pick-reword' into maint
Junio C Hamano [Wed, 17 Feb 2010 22:55:24 +0000 (14:55 -0800)]
Merge branch 'jk/cherry-pick-reword' into maint

* jk/cherry-pick-reword:
  cherry-pick: prettify the advice message
  cherry-pick: show commit name instead of sha1
  cherry-pick: format help message as strbuf
  cherry-pick: refactor commit parsing code
  cherry-pick: rewrap advice message

14 years agoMerge branch 'jk/grep-double-dash' into maint
Junio C Hamano [Wed, 17 Feb 2010 22:55:15 +0000 (14:55 -0800)]
Merge branch 'jk/grep-double-dash' into maint

* jk/grep-double-dash:
  accept "git grep -- pattern"

14 years agoMerge branch 'jc/typo' into maint
Junio C Hamano [Wed, 17 Feb 2010 22:55:09 +0000 (14:55 -0800)]
Merge branch 'jc/typo' into maint

* jc/typo:
  Typofixes outside documentation area

14 years agostatus: preload index to optimize lstat(2) calls
Junio C Hamano [Wed, 17 Feb 2010 20:30:41 +0000 (12:30 -0800)]
status: preload index to optimize lstat(2) calls

Noticed by James Pickens

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Protect escaping functions against calling on undef
Jakub Narebski [Sun, 7 Feb 2010 20:52:25 +0000 (21:52 +0100)]
gitweb: Protect escaping functions against calling on undef

This is a bit of future-proofing esc_html and friends: when called
with undefined value they would now would return undef... which would
probably mean that error would still occur, but closer to the source
of problem.

This means that we can safely use
  esc_html(shift) || "Internal Server Error"
in die_error() instead of
  esc_html(shift || "Internal Server Error")

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: esc_html (short) error message in die_error
Jakub Narebski [Sun, 7 Feb 2010 20:51:18 +0000 (21:51 +0100)]
gitweb: esc_html (short) error message in die_error

The error message (second argument to die_error) is meant to be short,
one-line text description of given error.  A few callers call
die_error with error message containing unescaped user supplied data
($hash, $file_name).  Instead of forcing callers to escape data,
simply call esc_html on the parameter.

Note that optional third parameter, which contains detailed error
description, is meant to be HTML formatted, and therefore should be
not escaped.

While at it update esc_html synopsis/usage, and bring default error
description to read 'Internal Server Error' (titlecased).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agosubmodule summary: Don't barf when invoked in an empty repo
Johan Herland [Tue, 16 Feb 2010 10:21:14 +0000 (11:21 +0100)]
submodule summary: Don't barf when invoked in an empty repo

When invoking "git submodule summary" in an empty repo (which can be
indirectly done by setting status.submodulesummary = true), it currently
emits an error message (via "git diff-index") since HEAD points to an
unborn branch.

This patch adds handling of the HEAD-points-to-unborn-branch special case,
so that "git submodule summary" no longer emits this error message.

The patch also adds a test case that verifies the fix.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: use the diff_delta() max_delta_size argument
Nicolas Pitre [Wed, 17 Feb 2010 19:05:56 +0000 (14:05 -0500)]
fast-import: use the diff_delta() max_delta_size argument

This let diff_delta() abort early if it is going to bust the given
size limit.  Also, only objects larger than 20 bytes are considered
as objects smaller than that are most certainly going to produce
larger deltas than the original object due to the additional headers.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: honor pack.indexversion and pack.packsizelimit config vars
Nicolas Pitre [Wed, 17 Feb 2010 19:05:55 +0000 (14:05 -0500)]
fast-import: honor pack.indexversion and pack.packsizelimit config vars

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: make default pack size unlimited
Nicolas Pitre [Wed, 17 Feb 2010 19:05:54 +0000 (14:05 -0500)]
fast-import: make default pack size unlimited

Now that fast-import is creating packs with index version 2, there is
no point limiting the pack size by default.  A pack split will still
happen if off_t is not sufficiently large to hold large offsets.

While updating the doc, let's remove the "packfiles fit on CDs"
suggestion.  Pack files created by fast-import are still suboptimal and
a 'git repack -a -f -d' or even 'git gc --aggressive' would be a pretty
good idea before considering storage on CDs.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: use write_idx_file() instead of custom code
Nicolas Pitre [Wed, 17 Feb 2010 19:05:53 +0000 (14:05 -0500)]
fast-import: use write_idx_file() instead of custom code

This allows for the creation of pack index version 2 with its object
CRC and the possibility for a pack to be larger than 4 GB.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: use sha1write() for pack data
Nicolas Pitre [Wed, 17 Feb 2010 19:05:52 +0000 (14:05 -0500)]
fast-import: use sha1write() for pack data

This is in preparation for using write_idx_file().  Also, by using
sha1write() we get some buffering to reduces the number of write
syscalls, and the written data is SHA1 summed which allows for the extra
data integrity validation check performed in fixup_pack_header_footer()
(details on this in commit abeb40e5aa).

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: start using struct pack_idx_entry
Nicolas Pitre [Wed, 17 Feb 2010 19:05:51 +0000 (14:05 -0500)]
fast-import: start using struct pack_idx_entry

This is in preparation for using write_idx_file().

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorequire_work_tree broken with NONGIT_OK
Gabriel Filion [Wed, 17 Feb 2010 04:18:50 +0000 (23:18 -0500)]
require_work_tree broken with NONGIT_OK

With NONGIT_OK set, require_work_tree function outside a git repository
gives a syntax error.  This is caused by an incorrect use of "test" that
didn't anticipate $(git rev-parse --is-inside-work-tree) may return an
empty string.

Properly quote the argument to "test", and send the standard error stream
to /dev/null to avoid giving duplicate error messages.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoimap-send: support CRAM-MD5 authentication
Hitoshi Mitake [Tue, 16 Feb 2010 06:34:07 +0000 (22:34 -0800)]
imap-send: support CRAM-MD5 authentication

CRAM-MD5 authentication ought to be independent from SSL, but NO_OPENSSL
build will not support this because the base64 and md5 code are used from
the OpenSSL library in this implementation.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogrep documentation: clarify what files match
Mark Lodato [Tue, 16 Feb 2010 00:25:40 +0000 (19:25 -0500)]
grep documentation: clarify what files match

Clarify that git-grep(1) searches only tracked files, and that each
<pathspec> is a pathspec, as in any other ordinary git commands.

Add an example to show a simple use case for searching all .c and .h
files in the current directory and below.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/typo'
Junio C Hamano [Wed, 17 Feb 2010 06:45:14 +0000 (22:45 -0800)]
Merge branch 'jc/typo'

* jc/typo:
  Typofixes outside documentation area

14 years agoMerge branch 'maint'
Junio C Hamano [Wed, 17 Feb 2010 06:40:45 +0000 (22:40 -0800)]
Merge branch 'maint'

* maint:
  Prepare 1.7.0.1 release notes
  Fix use of mutex in threaded grep
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
  Remove hyphen from "git-command" in two error messages

14 years agoPrepare 1.7.0.1 release notes
Junio C Hamano [Wed, 17 Feb 2010 06:25:03 +0000 (22:25 -0800)]
Prepare 1.7.0.1 release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/maint-grep-one-thread-mutex-fix' into maint
Junio C Hamano [Wed, 17 Feb 2010 06:23:25 +0000 (22:23 -0800)]
Merge branch 'jc/maint-grep-one-thread-mutex-fix' into maint

* jc/maint-grep-one-thread-mutex-fix:
  Fix use of mutex in threaded grep

14 years agoFix use of mutex in threaded grep
Junio C Hamano [Tue, 16 Feb 2010 02:34:28 +0000 (18:34 -0800)]
Fix use of mutex in threaded grep

The program can decide at runtime not to use threading even if the support
is compiled in.  In such a case, mutexes are not necessary and left
uninitialized.  But the code incorrectly tried to take and release the
read_sha1_mutex unconditionally.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Fredrik Kuivinen <frekui@gmail.com>
14 years agoMerge branch 'maint-1.6.6' into maint
Junio C Hamano [Tue, 16 Feb 2010 23:05:02 +0000 (15:05 -0800)]
Merge branch 'maint-1.6.6' into maint

* maint-1.6.6:
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
  Remove hyphen from "git-command" in two error messages

14 years agoMerge branch 'maint-1.6.5' into maint-1.6.6
Junio C Hamano [Tue, 16 Feb 2010 23:04:55 +0000 (15:04 -0800)]
Merge branch 'maint-1.6.5' into maint-1.6.6

* maint-1.6.5:
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught

14 years agotransport: add got_remote_refs flag
Tay Ray Chuan [Tue, 16 Feb 2010 07:18:21 +0000 (15:18 +0800)]
transport: add got_remote_refs flag

transport_get_remote_refs() in tranport.c checks transport->remote_refs
to determine whether transport->get_refs_list() should be invoked.  The
logic is "if it is NULL, we haven't run ls-remote to find out yet".

However, transport->remote_refs could still be NULL while cloning from
an empty repository.  This causes get_refs_list() to be run unnecessarily.

Introduce a flag, transport->got_remote_refs, to more explicitly record
if we have run transport->get_refs_list() already.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodwim_ref: fix dangling symref warning
Jeff King [Tue, 16 Feb 2010 07:03:16 +0000 (02:03 -0500)]
dwim_ref: fix dangling symref warning

If we encounter a symref that is dangling, in most cases we will warn
about it. The one exception is a dangling HEAD, as that indicates a
branch yet to be born.

However, the check in dwim_ref was not quite right. If we were fed
something like "HEAD^0" we would try to resolve "HEAD", see that it is
dangling, and then check whether the _original_ string we got was
"HEAD" (which it wasn't in this case). And that makes no sense; the
dangling thing we found was not "HEAD^0" but rather "HEAD".

Fixing this squelches a scary warning from "submodule summary HEAD" (and
consequently "git status" with status.submodulesummary set) in an empty
repo, as the submodule script calls "git rev-parse -q --verify HEAD^0".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit diff --quiet -w: check and report the status
Larry D'Anna [Tue, 16 Feb 2010 06:55:21 +0000 (01:55 -0500)]
git diff --quiet -w: check and report the status

The option -w tells the diff machinery to inspect the contents to set the
exit status, instead of checking the blob object level difference alone.
However, --quiet tells the diff machinery not to look at the contents, which
means DIFF_FROM_CONTENTS has no chance to inspect the change.

Work it around by calling diff_flush_patch() with output sent to /dev/null.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agostash pop: remove 'apply' options during 'drop' invocation
Thomas Rast [Mon, 15 Feb 2010 16:05:46 +0000 (17:05 +0100)]
stash pop: remove 'apply' options during 'drop' invocation

The 'git stash pop' option parsing used to remove the first argument
in --index mode.  At the time this was implemented, this first
argument was always --index.  However, since the invention of the -q
option in fcdd0e9 (stash: teach quiet option, 2009-06-17) you can
cause an internal invocation of

  git stash drop --index

by running

  git stash pop -q --index

which then of course fails because drop doesn't know --index.

To handle this, instead let 'git stash apply' decide what the future
argument to 'drop' should be.

Warning: this means that 'git stash apply' must parse all options that
'drop' can take, and deal with them in the same way.  This is
currently true for its only option -q.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodiff: make sure --output=/bad/path is caught
Larry D'Anna [Tue, 16 Feb 2010 04:10:45 +0000 (23:10 -0500)]
diff: make sure --output=/bad/path is caught

The return value from fopen wasn't being checked.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove hyphen from "git-command" in two error messages
Pete Harlan [Mon, 15 Feb 2010 23:33:18 +0000 (15:33 -0800)]
Remove hyphen from "git-command" in two error messages

Signed-off-by: Pete Harlan <pgit@pcharlan.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoam: Fix launching of pager
Jonathan Nieder [Mon, 15 Feb 2010 05:04:13 +0000 (23:04 -0600)]
am: Fix launching of pager

The pagination functionality in git am has some problems:

 - It does not check if stdout is a tty, so it always paginates.

 - If $GIT_PAGER uses any environment variables, they are being
   ignored, since it does not run $GIT_PAGER through eval.

 - If $GIT_PAGER is set to the empty string, instead of passing
   output through to stdout, it tries to run $dotest/patch.

Fix them.  While at it, move the definition of git_pager() to
git-sh-setup so authors of other commands are not tempted to
reimplement it with the same mistakes.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Mon, 15 Feb 2010 02:59:20 +0000 (18:59 -0800)]
Merge branch 'maint'

* maint:
  fix minor memory leak in get_tree_entry()

14 years agoMerge branch 'maint-1.6.6' into maint
Junio C Hamano [Mon, 15 Feb 2010 02:59:14 +0000 (18:59 -0800)]
Merge branch 'maint-1.6.6' into maint

* maint-1.6.6:
  fix minor memory leak in get_tree_entry()

14 years agogitweb: Die if there are parsing errors in config file
Jakub Narebski [Sun, 14 Feb 2010 21:46:28 +0000 (22:46 +0100)]
gitweb: Die if there are parsing errors in config file

Otherwise the errors can propagate, and show in damnest places, and
you would spend your time chasing ghosts instead of debugging real
problem (yes, it is from personal experience).

This follows (parts of) advice in `perldoc -f do` documentation.

This required restructoring code a bit, so we die only if we are reading
(executing) config file.  As a side effect $GITWEB_CONFIG_SYSTEM is always
available, even when we use $GITWEB_CONFIG.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit svn: Fix launching of pager
Jonathan Nieder [Sun, 14 Feb 2010 12:06:10 +0000 (06:06 -0600)]
git svn: Fix launching of pager

In commit dec543e (am -i, git-svn: use "git var GIT_PAGER"), I tried
to teach git svn to defer to git var on what pager to use. In the
process, I introduced two bugs:

 - The value set for $pager in config_pager has local scope, so
   run_pager never sees it;

 - git var cannot tell whether git svn’s output is going to a
   terminal, so the value chosen for $pager does not reflect that
   information.

Fix them.

Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit.1: Clarify the behavior of the --paginate option
Jonathan Nieder [Sun, 14 Feb 2010 12:02:35 +0000 (06:02 -0600)]
git.1: Clarify the behavior of the --paginate option

The --paginate option is meant to negate the effect of an explicit or
implicit pager.<cmd> = false setting.  Thus it turns the pager on if
output is going to a terminal rather than unconditionally.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake 'git var GIT_PAGER' always print the configured pager
Jonathan Nieder [Sun, 14 Feb 2010 11:59:59 +0000 (05:59 -0600)]
Make 'git var GIT_PAGER' always print the configured pager

Scripted commands that want to use git’s configured pager know better
than ‘git var’ does whether stdout is going to be a tty at the
appropriate time.  Checking isatty(1) as git_pager() does now won’t
cut it, since the output of git var itself is almost never a terminal.
The symptom is that when used by humans, ‘git var GIT_PAGER’ behaves
as it should, but when used by scripts, it always returns ‘cat’!

So avoid tricks with isatty() and just always print the configured
pager.

This does not fix the callers to check isatty(1) themselves yet.
Nevertheless, this patch alone is enough to fix 'am --interactive'.

Thanks to Sebastian Celis for the report and Jeff King for the
analysis.

Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix 'git var' usage synopsis
Jonathan Nieder [Sun, 14 Feb 2010 11:55:53 +0000 (05:55 -0600)]
Fix 'git var' usage synopsis

The parameter to 'git var' is not optional.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofix minor memory leak in get_tree_entry()
René Scharfe [Sun, 14 Feb 2010 09:56:46 +0000 (10:56 +0100)]
fix minor memory leak in get_tree_entry()

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Sat, 13 Feb 2010 23:14:04 +0000 (15:14 -0800)]
Merge branch 'maint'

* maint:
  Start 1.7.0 maintenance track

Conflicts:
RelNotes

14 years agoMerge branch 'rs/git-dir-cleanup'
Junio C Hamano [Sat, 13 Feb 2010 23:09:33 +0000 (15:09 -0800)]
Merge branch 'rs/git-dir-cleanup'

* rs/git-dir-cleanup:
  Resurrect "git grep --no-index"
  setenv(GIT_DIR) clean-up

Conflicts:
builtin-grep.c
t/t7002-grep.sh

14 years agoMerge branch 'jk/cherry-pick-reword'
Junio C Hamano [Sat, 13 Feb 2010 23:09:33 +0000 (15:09 -0800)]
Merge branch 'jk/cherry-pick-reword'

* jk/cherry-pick-reword:
  cherry-pick: prettify the advice message
  cherry-pick: show commit name instead of sha1
  cherry-pick: format help message as strbuf
  cherry-pick: refactor commit parsing code
  cherry-pick: rewrap advice message

14 years agoMerge branch 'jk/grep-double-dash'
Junio C Hamano [Sat, 13 Feb 2010 23:09:33 +0000 (15:09 -0800)]
Merge branch 'jk/grep-double-dash'

* jk/grep-double-dash:
  accept "git grep -- pattern"

14 years agoResurrect "git grep --no-index"
Junio C Hamano [Sat, 6 Feb 2010 18:40:08 +0000 (10:40 -0800)]
Resurrect "git grep --no-index"

This reverts commit 3c8f6c8 (Revert 30816237 and 7e62265, 2010-02-05) as
the issue has been sorted out.

14 years agoStart 1.7.0 maintenance track
Junio C Hamano [Sat, 13 Feb 2010 23:04:00 +0000 (15:04 -0800)]
Start 1.7.0 maintenance track

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoStart 1.7.1 cycle
Junio C Hamano [Sat, 13 Feb 2010 23:01:37 +0000 (15:01 -0800)]
Start 1.7.1 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofor-each-ref --format='%(flag)'
Junio C Hamano [Sat, 13 Feb 2010 20:05:44 +0000 (12:05 -0800)]
for-each-ref --format='%(flag)'

This expands to "symref" or "packed" or an empty string, exposing the
internal "flag" the for_each_ref() callback functions are called with.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofor-each-ref --format='%(symref) %(symref:short)'
Junio C Hamano [Sat, 13 Feb 2010 19:57:08 +0000 (11:57 -0800)]
for-each-ref --format='%(symref) %(symref:short)'

New %(symref) output atom expands to the name of the ref a symbolic ref
points at, or an empty string if the ref being shown is not a symref.

This may help scripted Porcelain writers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin-for-each-ref.c: check if we need to peel onion while parsing the format
Junio C Hamano [Sat, 13 Feb 2010 19:38:42 +0000 (11:38 -0800)]
builtin-for-each-ref.c: check if we need to peel onion while parsing the format

Instead of iterating over the parsed atoms that are used in the output
format after all the parsing is done, check it while parsing the
format string.

14 years agobuiltin-for-each-ref.c: comment fixes
Junio C Hamano [Sat, 13 Feb 2010 19:29:27 +0000 (11:29 -0800)]
builtin-for-each-ref.c: comment fixes

The primary purpose of this is to get rid of stale comments that lamented
the lack of callback parameter from for_each_ref() which we have already
fixed.  While at it we adjust the multi-line comment style to match the
style convention.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.7.0 v1.7.0
Junio C Hamano [Fri, 12 Feb 2010 23:45:05 +0000 (15:45 -0800)]
Git 1.7.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 12 Feb 2010 23:40:59 +0000 (15:40 -0800)]
Merge branch 'maint'

* maint:
  Fix typo in 1.6.6.2 release notes
  Re-fix check-ref-format documentation mark-up

14 years agoFix typo in 1.6.6.2 release notes
Junio C Hamano [Fri, 12 Feb 2010 23:40:01 +0000 (15:40 -0800)]
Fix typo in 1.6.6.2 release notes

Of course, these are changes since 1.6.6.1; changes since 1.6.6.2
would have been nil.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRe-fix check-ref-format documentation mark-up
Junio C Hamano [Fri, 12 Feb 2010 23:39:03 +0000 (15:39 -0800)]
Re-fix check-ref-format documentation mark-up

It is not double-backslash we forbid; backslashes are forbidden since
a4c2e699 (Disallow '\' in ref names, 2009-05-08)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-imap-send: Convert LF to CRLF before storing patch to draft box
Hitoshi Mitake [Fri, 12 Feb 2010 11:36:12 +0000 (20:36 +0900)]
git-imap-send: Convert LF to CRLF before storing patch to draft box

When storing a message over IMAP (RFC 3501 6.3.11), the message should be
in the format of an RFC 2822 message; most notably, CRLF must be used as
a line terminator.

Convert "\n" line endings in the payload to CRLF before feeding it to
IMAP APPEND command.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoarchive documentation: attributes are taken from the tree by default
Junio C Hamano [Wed, 10 Feb 2010 20:33:58 +0000 (12:33 -0800)]
archive documentation: attributes are taken from the tree by default

By default, git-archive takes attributes from the tree being archived.
People however often wonder why their attempts to affect the way how the
command archives their tree by changing .gitattributes in their work tree
fail.

Add a bit of explanatory note to tell them how to achieve what they want
to do.

Noticed-by: Francois Marier
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: minor fixes to RelNotes-1.7.0
Michael J Gruber [Fri, 12 Feb 2010 09:47:53 +0000 (10:47 +0100)]
Documentation: minor fixes to RelNotes-1.7.0

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobash: support 'git am's new '--continue' option
SZEDER Gábor [Fri, 12 Feb 2010 14:11:47 +0000 (15:11 +0100)]
bash: support 'git am's new '--continue' option

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 12 Feb 2010 07:06:32 +0000 (23:06 -0800)]
Merge branch 'maint'

* maint:
  filter-branch: Fix error message for --prune-empty --commit-filter

14 years agofilter-branch: Fix error message for --prune-empty --commit-filter
Jacob Helwig [Fri, 12 Feb 2010 02:46:22 +0000 (18:46 -0800)]
filter-branch: Fix error message for --prune-empty --commit-filter

Running filter-branch with --prune-empty and --commit-filter reports:

  "Cannot set --prune-empty and --filter-commit at the same time".

Change it to use the correct option name: --commit-filter

Signed-off-by: Jacob Helwig <jacob.helwig@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocherry-pick: prettify the advice message
Jeff King [Thu, 11 Feb 2010 21:19:37 +0000 (16:19 -0500)]
cherry-pick: prettify the advice message

It's hard to see the "how to commit" part of this message,
which users may want to cut and paste. On top of that,
having it in paragraph form means that a really long commit
name may cause ugly wrapping. Let's make it prettier, like:

  Automatic cherry-pick failed.  After resolving the conflicts,
  mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
  and commit the result with:

          git commit -c HEAD~23

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocherry-pick: show commit name instead of sha1
Jeff King [Thu, 11 Feb 2010 21:08:15 +0000 (16:08 -0500)]
cherry-pick: show commit name instead of sha1

When we have a conflict, we advise the user to do:

  git commit -c $sha1

This works fine, but is unnecessarily confusing and annoying
for the user to type, when:

  git commit -c $the_thing_you_called_cherry_pick_with

works just as well.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocherry-pick: format help message as strbuf
Jeff King [Thu, 11 Feb 2010 21:07:06 +0000 (16:07 -0500)]
cherry-pick: format help message as strbuf

This gets rid of the fixed-size buffer and an unchecked
sprintf. That sprintf is actually OK as the only
variable-sized thing put in it is an abbreviated sha1, which
is bounded at 40 characters. However, the next patch will
change that to something unbounded.

Note that this function now returns an allocated buffer
instead of a static one; however, it doesn't matter as the
only caller exits immediately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocherry-pick: refactor commit parsing code
Jeff King [Thu, 11 Feb 2010 21:06:43 +0000 (16:06 -0500)]
cherry-pick: refactor commit parsing code

These lines are really just lookup_commit_reference
re-implemented.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocherry-pick: rewrap advice message
Jeff King [Thu, 11 Feb 2010 21:06:01 +0000 (16:06 -0500)]
cherry-pick: rewrap advice message

The current message overflows on an 80-character terminal.
While we're at it, fix the spelling of 'committing'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoam: switch --resolved to --continue
Jeff King [Thu, 11 Feb 2010 22:27:14 +0000 (17:27 -0500)]
am: switch --resolved to --continue

Rebase calls this same function "--continue", which means
users may be trained to type it. There is no reason to
deprecate --resolved (or -r), so we will keep it as a
synonym.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUpdate draft release notes to 1.7.0 one more time
Junio C Hamano [Wed, 10 Feb 2010 21:47:46 +0000 (13:47 -0800)]
Update draft release notes to 1.7.0 one more time

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoSync with 1.6.6.2
Junio C Hamano [Wed, 10 Feb 2010 21:46:15 +0000 (13:46 -0800)]
Sync with 1.6.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.6.2 v1.6.6.2
Junio C Hamano [Wed, 10 Feb 2010 21:44:11 +0000 (13:44 -0800)]
Git 1.6.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.5' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:42:48 +0000 (13:42 -0800)]
Merge branch 'maint-1.6.5' into maint

* maint-1.6.5:
  t8003: check exit code of command and error message separately

14 years agot8003: check exit code of command and error message separately
Junio C Hamano [Tue, 9 Feb 2010 18:06:33 +0000 (10:06 -0800)]
t8003: check exit code of command and error message separately

Shell reports exit status only from the most downstream command
in a pipeline.  In these tests, we want to make sure that the
command fails in a controlled way, and produces a correct error
message.

This issue was known by Jay who submitted the patch, and also was
pointed out by Hannes during the review process, but I forgot to
fix it up before applying.  Sorry about that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'sp/maint-fast-import-large-blob' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:32:20 +0000 (13:32 -0800)]
Merge branch 'sp/maint-fast-import-large-blob' into maint

* sp/maint-fast-import-large-blob:
  fast-import: Stream very large blobs directly to pack

14 years agoMerge branch 'gp/maint-cvsserver' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:02:52 +0000 (13:02 -0800)]
Merge branch 'gp/maint-cvsserver' into maint

* gp/maint-cvsserver:
  git-cvsserver: allow regex metacharacters in CVSROOT

14 years agoMerge branch 'jc/maint-reflog-bad-timestamp' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:02:43 +0000 (13:02 -0800)]
Merge branch 'jc/maint-reflog-bad-timestamp' into maint

* jc/maint-reflog-bad-timestamp:
  t0101: use a fixed timestamp when searching in the reflog
  Update @{bogus.timestamp} fix not to die()
  approxidate_careful() reports errorneous date string

14 years agoMerge branch 'il/maint-xmallocz' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:02:16 +0000 (13:02 -0800)]
Merge branch 'il/maint-xmallocz' into maint

* il/maint-xmallocz:
  Fix integer overflow in unpack_compressed_entry()
  Fix integer overflow in unpack_sha1_rest()
  Fix integer overflow in patch_delta()
  Add xmallocz()

14 years agoMerge branch 'jh/maint-config-file-prefix' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:02:05 +0000 (13:02 -0800)]
Merge branch 'jh/maint-config-file-prefix' into maint

* jh/maint-config-file-prefix:
  builtin-config: Fix crash when using "-f <relative path>" from non-root dir

14 years agoMerge branch 'nd/include-termios-for-osol' into maint
Junio C Hamano [Wed, 10 Feb 2010 21:01:55 +0000 (13:01 -0800)]
Merge branch 'nd/include-termios-for-osol' into maint

* nd/include-termios-for-osol:
  Add missing #include to support TIOCGWINSZ on Solaris

14 years agoMerge branch 'jc/maint-1.6.1-checkout-m-custom-merge' into maint
Junio C Hamano [Wed, 10 Feb 2010 20:54:15 +0000 (12:54 -0800)]
Merge branch 'jc/maint-1.6.1-checkout-m-custom-merge' into maint

* jc/maint-1.6.1-checkout-m-custom-merge:
  checkout -m path: fix recreating conflicts

Conflicts:
t/t7201-co.sh

14 years agoMerge branch 'rs/maint-archive-match-pathspec' into maint
Junio C Hamano [Wed, 10 Feb 2010 20:52:39 +0000 (12:52 -0800)]
Merge branch 'rs/maint-archive-match-pathspec' into maint

* rs/maint-archive-match-pathspec:
  archive: complain about path specs that don't match anything

14 years agocheck-ref-format documentation: fix enumeration mark-up
Junio C Hamano [Wed, 10 Feb 2010 18:18:55 +0000 (10:18 -0800)]
check-ref-format documentation: fix enumeration mark-up

The last item in the enumerated refname rule was mistakenly made into
a sub-item of the 7th one.  It should be the 8th one in the list on its
own.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: quote braces in {upstream} notation
Thomas Rast [Wed, 10 Feb 2010 16:30:29 +0000 (17:30 +0100)]
Documentation: quote braces in {upstream} notation

The lack of quoting made the entire line disappear.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'sp/maint-push-sideband' into sp/push-sideband
Junio C Hamano [Wed, 10 Feb 2010 18:00:49 +0000 (10:00 -0800)]
Merge branch 'sp/maint-push-sideband' into sp/push-sideband

* sp/maint-push-sideband:
  receive-pack: Send internal errors over side-band #2
  t5401: Use a bare repository for the remote peer

Conflicts:
builtin-receive-pack.c
t/t5401-update-hooks.sh

14 years agoreceive-pack: Send internal errors over side-band #2
Shawn O. Pearce [Wed, 10 Feb 2010 17:34:12 +0000 (09:34 -0800)]
receive-pack: Send internal errors over side-band #2

If the client has requested side-band-64k capability, send any
of the internal error or warning messages in the muxed side-band
stream using the same band as our hook output, band #2.  By putting
everything in one stream we ensure all messages are processed by
the side-band demuxer, avoiding interleaving between our own stderr
and the side-band demuxer's stderr buffers.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot5401: Use a bare repository for the remote peer
Shawn O. Pearce [Wed, 10 Feb 2010 02:01:29 +0000 (18:01 -0800)]
t5401: Use a bare repository for the remote peer

We want to avoid the warnings (or later, test failures) about
updating the current branch.  It was never my intention to have
this test deal with a repository with a working directory, and it
is a very old bug that the test even used a non-bare repository
for the remote side of the push operations.

This fixes the interleaved output error we were seeing as a test
failure by avoiding the giant warning message we were getting back
about updating the current branch being risky.

Its not a real fix, but is something we should do no matter what,
because the behavior will change in the future to reject, and the
test would break at that time.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot3902: Protect against OS X normalization
Brian Gernhardt [Tue, 9 Feb 2010 04:07:25 +0000 (23:07 -0500)]
t3902: Protect against OS X normalization

8424981: "Fix invalid read in quote_c_style_counted" introduced a test
that used "caractère spécial" as a directory name.

Git creates it as "caract\303\250re sp\303\251cial"
OS X stores it as "caracte\314\200re spe\314\201cial"

To work around this problem, use the already introduced $FN as the
directory name.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Tue, 9 Feb 2010 05:54:10 +0000 (21:54 -0800)]
Merge branch 'maint'

* maint:
  blame: prevent a segv when -L given start > EOF
  git-push: document all the status flags used in the output
  Fix parsing of imap.preformattedHTML and imap.sslverify
  git-add documentation: Fix shell quoting example

14 years agoMerge branch 'maint-1.6.5' into maint
Junio C Hamano [Tue, 9 Feb 2010 05:53:54 +0000 (21:53 -0800)]
Merge branch 'maint-1.6.5' into maint

* maint-1.6.5:
  blame: prevent a segv when -L given start > EOF

14 years agoblame: prevent a segv when -L given start > EOF
Jay Soffian [Tue, 9 Feb 2010 03:48:13 +0000 (22:48 -0500)]
blame: prevent a segv when -L given start > EOF

blame would segv if given -L <lineno> with <lineno> past the end of the file.
While we're fixing the bug, add test cases for an invalid <start> when called
as -L <start>,<end> or -L<start>.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/maint-push-doc-status' into maint
Junio C Hamano [Tue, 9 Feb 2010 00:49:22 +0000 (16:49 -0800)]
Merge branch 'jc/maint-push-doc-status' into maint

* jc/maint-push-doc-status:
  git-push: document all the status flags used in the output