Code

git.git
13 years agoGit 1.6.4.5 v1.6.4.5
Junio C Hamano [Wed, 15 Dec 2010 19:19:11 +0000 (11:19 -0800)]
Git 1.6.4.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Introduce esc_attr to escape attributes of HTML elements
Jakub Narebski [Tue, 14 Dec 2010 23:34:01 +0000 (00:34 +0100)]
gitweb: Introduce esc_attr to escape attributes of HTML elements

It is needed only to escape attributes of handcrafted HTML elements,
and not those generated using CGI.pm subroutines / methods for HTML
generation.

While at it, add esc_url and esc_html where needed, and prefer to use
CGI.pm HTML generating methods than handcrafted HTML code.  Most of
those are probably unnecessary (could be exploited only by person with
write access to gitweb config, or at least access to the repository).

This fixes CVE-2010-3906

Reported-by: Emanuele Gentili <e.gentili@tigersecurity.it>
Helped-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoCheck size of path buffer before writing into it
Greg Brockman [Tue, 20 Jul 2010 04:46:21 +0000 (00:46 -0400)]
Check size of path buffer before writing into it

This prevents a buffer overrun that could otherwise be triggered by
creating a file called '.git' with contents

  gitdir: (something really long)

Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
Uwe Kleine-König [Tue, 6 Jul 2010 14:46:05 +0000 (16:46 +0200)]
rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option

The ?: operator has a lower priority than |, so the implicit associativity
made the 6th argument of parse_options be PARSE_OPT_KEEP_DASHDASH if
keep_dashdash was true discarding PARSE_OPT_STOP_AT_NON_OPTION and
PARSE_OPT_SHELL_EVAL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.3' into maint-1.6.4
Junio C Hamano [Tue, 19 Jan 2010 05:37:06 +0000 (21:37 -0800)]
Merge branch 'maint-1.6.3' into maint-1.6.4

* maint-1.6.3:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
builtin-commit.c

14 years agoMerge branch 'maint-1.6.2' into maint-1.6.3
Junio C Hamano [Tue, 19 Jan 2010 05:29:47 +0000 (21:29 -0800)]
Merge branch 'maint-1.6.2' into maint-1.6.3

* maint-1.6.2:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
diff.c

14 years agoMerge commit 'v1.6.4.4-8-g8de6518' into maint-1.6.4
Junio C Hamano [Tue, 19 Jan 2010 05:18:41 +0000 (21:18 -0800)]
Merge commit 'v1.6.4.4-8-g8de6518' into maint-1.6.4

* commit 'v1.6.4.4-8-g8de6518':
  Fix mis-backport of t7002

14 years agoFix mis-backport of t7002
Junio C Hamano [Tue, 19 Jan 2010 05:14:41 +0000 (21:14 -0800)]
Fix mis-backport of t7002

The original patch that became cfe370c (grep: do not segfault when -f is
used, 2009-10-16), was made against "maint" or newer branch back then, but
the fix addressed the issue that was present as far as in 1.6.4 series.

The maintainer backported the patch to the 1.6.4 maintenance branch, but
failed to notice that the new tests assumed the setup done by the script
in "maint", which did quite a lot more than the same test script in 1.6.4
series, and the output didn't match the expected result.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 10 Jan 2010 08:49:47 +0000 (00:49 -0800)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
diff.c

14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 10 Jan 2010 08:48:47 +0000 (00:48 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".

14 years agobase85: Make the code more obvious instead of explaining the non-obvious
Andreas Gruenbacher [Fri, 8 Jan 2010 13:40:00 +0000 (14:40 +0100)]
base85: Make the code more obvious instead of explaining the non-obvious

Here is another cleanup ...

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85: encode_85() does not use the decode table
Andreas Gruenbacher [Fri, 8 Jan 2010 16:22:18 +0000 (17:22 +0100)]
base85: encode_85() does not use the decode table

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85 debug code: Fix length byte calculation
Andreas Gruenbacher [Fri, 8 Jan 2010 13:39:58 +0000 (14:39 +0100)]
base85 debug code: Fix length byte calculation

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheckout -m: do not try to fall back to --merge from an unborn branch
Junio C Hamano [Thu, 7 Jan 2010 07:51:47 +0000 (23:51 -0800)]
checkout -m: do not try to fall back to --merge from an unborn branch

If switching from an unborn branch (= empty tree) to a valid commit failed
without -m, it would fail with -m option as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobranch: die explicitly why when calling "git branch [-a|-r] branchname".
Matthieu Moy [Wed, 30 Dec 2009 14:45:31 +0000 (15:45 +0100)]
branch: die explicitly why when calling "git branch [-a|-r] branchname".

The -a and -r options used to be silently ignored in such a command.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotextconv: stop leaking file descriptors
Jeff King [Wed, 30 Dec 2009 09:02:53 +0000 (04:02 -0500)]
textconv: stop leaking file descriptors

We read the output from textconv helpers over a pipe, but we
never actually closed our end of the pipe after using it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 30 Dec 2009 04:16:34 +0000 (20:16 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  commit: --cleanup is a message option
  t7102: make the test fail if one of its check fails

14 years agocommit: --cleanup is a message option
Greg Price [Tue, 29 Dec 2009 21:54:49 +0000 (16:54 -0500)]
commit: --cleanup is a message option

In the usage message for "git commit", the --cleanup option appeared
at the end, as one of the "contents options":

usage: git commit [options] [--] <filepattern>...
...
Commit message options
...
Commit contents options
...
    --allow-empty         ok to record an empty change
    --cleanup <default>   how to strip spaces and #comments from message

This is confusing, in part because it makes it ambiguous whether
--allow-empty, just above, refers to an empty diff or an empty message.

Move --cleanup into the 'message options' group.  Also add a pair of
comments to prevent similar oversights in the future.

Signed-off-by: Greg Price <price@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit count-objects: handle packs bigger than 4G
Andreas Schwab [Tue, 29 Dec 2009 19:09:15 +0000 (20:09 +0100)]
git count-objects: handle packs bigger than 4G

Use off_t to count sizes of packs and objects to avoid overflow after
4Gb.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7102: make the test fail if one of its check fails
Nguyễn Thái Ngọc Duy [Tue, 29 Dec 2009 08:13:18 +0000 (15:13 +0700)]
t7102: make the test fail if one of its check fails

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: more graceful handling of invalid commands
Jan Krüger [Tue, 27 Oct 2009 14:58:14 +0000 (15:58 +0100)]
rebase -i: more graceful handling of invalid commands

Currently, when there is an invalid command, the rest of the line is
still treated as if the command had been valid, i.e. rebase -i attempts
to produce a patch, using the next argument as a SHA1 name. If there is
no next argument or an invalid one, very confusing error messages
appear (the line was '.'; path to git-rebase-todo substituted):

Unknown command: .
fatal: ambiguous argument 'Please fix this in the file $somefile.':
unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
fatal: Not a valid object name Please fix this in the file $somefile.
fatal: bad revision 'Please fix this in the file $somefile.'

Instead, verify the validity of the remaining line and error out earlier
if necessary.

Signed-off-by: Jan Krüger <jk@jk.gs>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agohelp -i: properly error out if no info viewer can be found
Gerrit Pape [Tue, 27 Oct 2009 13:31:33 +0000 (13:31 +0000)]
help -i: properly error out if no info viewer can be found

With this commit, git help -i <cmd> prints an error message and exits
non-zero instead of being silent and exit code 0.

Reported by Trent W. Buck through
 http://bugs.debian.org/537664

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jk/maint-1.6.3-ls-files-no-ignore-cached' into maint-1.6.4
Junio C Hamano [Sun, 25 Oct 2009 22:34:27 +0000 (15:34 -0700)]
Merge branch 'jk/maint-1.6.3-ls-files-no-ignore-cached' into maint-1.6.4

* jk/maint-1.6.3-ls-files-no-ignore-cached:
  ls-files: excludes should not impact tracked files

14 years agoMerge branch 'jn/maint-1.6.3-check-ref-format-doc' into maint-1.6.4
Junio C Hamano [Sun, 25 Oct 2009 22:34:21 +0000 (15:34 -0700)]
Merge branch 'jn/maint-1.6.3-check-ref-format-doc' into maint-1.6.4

* jn/maint-1.6.3-check-ref-format-doc:
  Documentation: describe check-ref-format --branch

14 years agogrep: do not segfault when -f is used
Matt Kraai [Fri, 16 Oct 2009 14:13:25 +0000 (07:13 -0700)]
grep: do not segfault when -f is used

"git grep" would segfault if its -f option was used because it would
try to use an uninitialized strbuf, so initialize the strbuf.

Thanks to Johannes Sixt <j.sixt@viscovery.net> for the help with the
test cases.

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: describe check-ref-format --branch
Jonathan Nieder [Mon, 12 Oct 2009 05:28:23 +0000 (00:28 -0500)]
Documentation: describe check-ref-format --branch

Unless one already knew, it was not obvious what sort of shorthand
"git check-ref-format --branch" expands.  Explain it.

The --branch argument is not optional.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-stash documentation: mention default options for 'list'
Miklos Vajna [Mon, 12 Oct 2009 19:37:39 +0000 (21:37 +0200)]
git-stash documentation: mention default options for 'list'

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agols-files: excludes should not impact tracked files
Jeff King [Mon, 12 Oct 2009 05:11:57 +0000 (01:11 -0400)]
ls-files: excludes should not impact tracked files

In all parts of git, .gitignore and other exclude files
impact only how we treat untracked files; they should have
no effect on files listed in the index.

This behavior was originally implemented very early on in
9ff768e, but only for --exclude-from. Later, commit 63d285c
accidentally caused us to trigger the behavior for
--exclude-per-directory.

This patch totally ignores excludes for files found in the
index. This means we are reversing the original intent of
9ff768e, while at the same time fixing the accidental
behavior of 63d285c. This is a good thing, though, as the
way that 9ff768e behaved does not really make sense with the
way exclusions are used in modern git.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agols-files: die instead of fprintf/exit in -i error
Ben Walton [Fri, 9 Oct 2009 01:53:35 +0000 (21:53 -0400)]
ls-files: die instead of fprintf/exit in -i error

When ls-files was called with -i but no exclude pattern, it was
calling fprintf(stderr, "...", NULL) and then exiting.  On Solaris,
passing NULL into fprintf was causing a segfault.  On glibc systems,
it was simply producing incorrect output (eg: "(null)": ...).  The
NULL pointer was a result of argv[0] not being preserved by the option
parser.  Instead of requesting that the option parser preserve
argv[0], use die() with a constant string.

A trigger for this bug was: `git ls-files -i`

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import.c::validate_raw_date(): really validate the value
Junio C Hamano [Tue, 29 Sep 2009 06:40:09 +0000 (23:40 -0700)]
fast-import.c::validate_raw_date(): really validate the value

When reading the "raw format" timestamp from the input stream, make sure
that the timezone offset is a reasonable value by imitating 7122f82
(date.c: improve guess between timezone offset and year., 2006-06-08).

We _might_ want to also check if the timestamp itself is reasonable, but
that is left for a separate commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/maint-1.6.4-show-branch-default' into maint
Junio C Hamano [Sun, 4 Oct 2009 21:48:44 +0000 (14:48 -0700)]
Merge branch 'jc/maint-1.6.4-show-branch-default' into maint

* jc/maint-1.6.4-show-branch-default:
  show-branch: fix segfault when showbranch.default exists

14 years agoshow-branch: fix segfault when showbranch.default exists
Junio C Hamano [Tue, 9 Jun 2009 06:26:44 +0000 (23:26 -0700)]
show-branch: fix segfault when showbranch.default exists

When running "git show-branch" without any parameter in a repository that
has showbranch.default defined, we used to rely on the fact that our
handcrafted option parsing loop never looked at av[0].

The array of default strings had the first real command line argument in
default_arg[0], but the option parser wanted to look at the array starting
at av[1], so we assigned the address of -1th element to av to force the
loop start working from default_arg[0].

This no longer worked since 5734365 (show-branch: migrate to parse-options
API, 2009-05-21), as parse_options_start() saved the incoming &av[0] in
its ctx->out and later in parse_options_end() it did memmove to ctx->out
(with ctx->cpidx == 0), overwriting the memory before default_arg[] array.

I am not sure if this is a bug in parse_options(), or a bug in the caller,
and tonight I do not have enough concentration to figure out which.  In
any case, this patch works the issue around.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agopush: Correctly initialize nonfastforward in transport_push.
Matthieu Moy [Sun, 20 Sep 2009 17:33:20 +0000 (19:33 +0200)]
push: Correctly initialize nonfastforward in transport_push.

The variable is assigned unconditionally in print_push_status, but
print_push_status is not reached by all codepaths. In particular, this
fixes a bug where "git push ... nonexisting-branch" was complaining about
non-fast forward.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGIT 1.6.4.4 v1.6.4.4
Junio C Hamano [Wed, 16 Sep 2009 21:53:26 +0000 (14:53 -0700)]
GIT 1.6.4.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/maint-unpack-objects-strict' into maint
Junio C Hamano [Wed, 16 Sep 2009 21:45:18 +0000 (14:45 -0700)]
Merge branch 'jc/maint-unpack-objects-strict' into maint

* jc/maint-unpack-objects-strict:
  Fix "unpack-objects --strict"

Conflicts:
builtin-unpack-objects.c

14 years agoMerge branch 'tf/diff-whitespace-incomplete-line' into maint
Junio C Hamano [Wed, 16 Sep 2009 21:27:08 +0000 (14:27 -0700)]
Merge branch 'tf/diff-whitespace-incomplete-line' into maint

* tf/diff-whitespace-incomplete-line:
  xutils: Fix xdl_recmatch() on incomplete lines
  xutils: Fix hashing an incomplete line with whitespaces at the end

14 years agoMerge branch 'jk/maint-1.6.3-checkout-unborn' into maint
Junio C Hamano [Wed, 16 Sep 2009 21:26:56 +0000 (14:26 -0700)]
Merge branch 'jk/maint-1.6.3-checkout-unborn' into maint

* jk/maint-1.6.3-checkout-unborn:
  checkout: do not imply "-f" on unborn branches

14 years agoMerge branch 'jc/maint-checkout-index-to-prefix' into maint
Junio C Hamano [Wed, 16 Sep 2009 21:26:40 +0000 (14:26 -0700)]
Merge branch 'jc/maint-checkout-index-to-prefix' into maint

* jc/maint-checkout-index-to-prefix:
  check_path(): allow symlinked directories to checkout-index --prefix

14 years agoMerge branch 'rc/maint-http-no-head-pack-check' into maint
Junio C Hamano [Mon, 14 Sep 2009 21:48:20 +0000 (14:48 -0700)]
Merge branch 'rc/maint-http-no-head-pack-check' into maint

* rc/maint-http-no-head-pack-check:
  http.c: avoid freeing an uninitialized pointer

14 years agohttp.c: avoid freeing an uninitialized pointer
Junio C Hamano [Mon, 14 Sep 2009 21:48:15 +0000 (14:48 -0700)]
http.c: avoid freeing an uninitialized pointer

An earlier 59b8d38 (http.c: remove verification of remote packs) left
the variable "url" uninitialized; "goto cleanup" codepath can free it
which is not very nice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGIT 1.6.4.3 v1.6.4.3
Junio C Hamano [Sun, 13 Sep 2009 08:04:23 +0000 (01:04 -0700)]
GIT 1.6.4.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agosvn: properly escape arguments for authors-prog
Mark Lodato [Sun, 13 Sep 2009 00:33:23 +0000 (20:33 -0400)]
svn: properly escape arguments for authors-prog

Previously, the call to authors-prog was not properly escaped, so any
special characters in the Subversion username, such as spaces and
semi-colons, would be interpreted by the shell rather than being passed
in as the first argument.  Now all unsafe characters are escaped using
"git rev-parse --sq-quote"

[ew: switched from "\Q..\E" to "rev-parse --sq-quote"]

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'cb/maint-1.6.3-grep-relative-up' into maint
Junio C Hamano [Sun, 13 Sep 2009 08:24:20 +0000 (01:24 -0700)]
Merge branch 'cb/maint-1.6.3-grep-relative-up' into maint

* cb/maint-1.6.3-grep-relative-up:
  grep: accept relative paths outside current working directory
  grep: fix exit status if external_grep() punts

Conflicts:
t/t7002-grep.sh

14 years agohttp.c: remove verification of remote packs
Tay Ray Chuan [Wed, 9 Sep 2009 12:33:50 +0000 (20:33 +0800)]
http.c: remove verification of remote packs

Make http.c::fetch_pack_index() no longer check for the remote pack
with a HEAD request before fetching the corresponding pack index file.

Not only does sending a HEAD request before we do a GET incur a
performance penalty, it does not offer any significant error-
prevention advantages (pack fetching in the *_http_pack_request()
methods is capable of handling any errors on its own).

This addresses an issue raised elsewhere:

  http://code.google.com/p/msysgit/issues/detail?id=323
  http://support.github.com/discussions/repos/957-cant-clone-over-http-or-git

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-pull: do not mention --quiet and --verbose twice
Emmanuel Trillaud [Mon, 7 Sep 2009 12:34:35 +0000 (14:34 +0200)]
git-pull: do not mention --quiet and --verbose twice

git-pull.txt includes fetch-options.txt and merge-options.txt, both of
which document the --quiet and --verbose.

Supress the ones from fetch-options.txt.

Signed-off-by: Emmanuel Trillaud <etrillaud@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogithooks.txt: put hooks into subsections
Bert Wesarg [Sun, 6 Sep 2009 10:22:58 +0000 (12:22 +0200)]
githooks.txt: put hooks into subsections

All hooks are currently in its own section. Which may confuse users,
because the section name serves as the hook file name and sections are
all caps for man pages. Putting them into a new HOOKS section and each
hook into a subsection keeps the case to lower case.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogrep: accept relative paths outside current working directory
Clemens Buchacher [Sat, 5 Sep 2009 12:31:17 +0000 (14:31 +0200)]
grep: accept relative paths outside current working directory

"git grep" would barf at relative paths pointing outside the current
working directory (or subdirectories thereof). Use quote_path_relative(),
which can handle such cases just fine.

[jc: added tests.]

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogrep: fix exit status if external_grep() punts
Clemens Buchacher [Mon, 7 Sep 2009 08:48:01 +0000 (10:48 +0200)]
grep: fix exit status if external_grep() punts

If external_grep() is called and punts, grep_cache() mistakenly reported a
hit, even if there were none.  The bug can be triggered by calling "git
grep --no-color" from a subdirectory.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agopush: re-flow non-fast-forward message
Jeff King [Sun, 6 Sep 2009 06:47:20 +0000 (02:47 -0400)]
push: re-flow non-fast-forward message

The extreme raggedness of the right edge make this jarring
to read. Let's re-flow the text to fill the lines in a more
even way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agopush: fix english in non-fast-forward message
Jeff King [Sun, 6 Sep 2009 06:46:25 +0000 (02:46 -0400)]
push: fix english in non-fast-forward message

We must use an article when referring to the section
because it is a non-proper noun, and it must be the definite
article because we are referring to a specific section.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.3' into maint
Junio C Hamano [Thu, 3 Sep 2009 16:42:56 +0000 (09:42 -0700)]
Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
  git-clone: add missing comma in --reference documentation
  git-cvsserver: no longer use deprecated 'git-subcommand' commands
  clone: disconnect transport after fetching

14 years agoMerge branch 'maint-1.6.2' into maint-1.6.3
Junio C Hamano [Thu, 3 Sep 2009 16:42:38 +0000 (09:42 -0700)]
Merge branch 'maint-1.6.2' into maint-1.6.3

* maint-1.6.2:
  git-clone: add missing comma in --reference documentation
  clone: disconnect transport after fetching

14 years agogit-clone: add missing comma in --reference documentation
Miklos Vajna [Thu, 3 Sep 2009 11:24:16 +0000 (13:24 +0200)]
git-clone: add missing comma in --reference documentation

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-cvsserver: no longer use deprecated 'git-subcommand' commands
Gerrit Pape [Wed, 2 Sep 2009 09:23:10 +0000 (09:23 +0000)]
git-cvsserver: no longer use deprecated 'git-subcommand' commands

git-cvsserver still references git commands like 'git-config', which
is depcrecated.  This commit changes git-cvsserver to use the
'git subcommand' form.

Sylvain Beucler reported the problem through
 http://bugs.debian.org/536067

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoclone: disconnect transport after fetching
Jeff King [Wed, 2 Sep 2009 06:36:47 +0000 (02:36 -0400)]
clone: disconnect transport after fetching

The current code just leaves the transport in whatever state
it was in after performing the fetch.  For a non-empty clone
over the git protocol, the transport code already
disconnects at the end of the fetch.

But for an empty clone, we leave the connection hanging, and
eventually close the socket when clone exits. This causes
the remote upload-pack to complain "the remote end hung up
unexpectedly". While this message is harmless to the clone
itself, it is unnecessarily scary for a user to see and may
pollute git-daemon logs.

This patch just explicitly calls disconnect after we are
done with the remote end, which sends a flush packet to
upload-pack and cleanly disconnects, avoiding the error
message.

Other transports are unaffected or slightly improved:

 - for a non-empty repo over the git protocol, the second
   disconnect is a no-op (since we are no longer connected)

 - for "walker" transports (like HTTP or FTP), we actually
   free some used memory (which previously just sat until
   the clone process exits)

 - for "rsync", disconnect is always a no-op anyway

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGIT 1.6.4.2 v1.6.4.2
Junio C Hamano [Sat, 29 Aug 2009 21:31:01 +0000 (14:31 -0700)]
GIT 1.6.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove unused t/t8005/iso8859-5.txt
Nanako Shiraishi [Sat, 29 Aug 2009 07:49:32 +0000 (00:49 -0700)]
Remove unused t/t8005/iso8859-5.txt

This file is no longer used since 54bc13c (t8005: Nobody writes Russian in
shift_jis, 2009-06-18).

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'rc/maint-http-fix' into maint
Junio C Hamano [Sat, 29 Aug 2009 02:34:16 +0000 (19:34 -0700)]
Merge branch 'rc/maint-http-fix' into maint

* rc/maint-http-fix:
  http.c: don't assume that urls don't end with slash

14 years agohttp.c: set slot callback members to NULL when releasing object
Tay Ray Chuan [Wed, 26 Aug 2009 12:20:53 +0000 (20:20 +0800)]
http.c: set slot callback members to NULL when releasing object

Set the members callback_func and callback_data of freq->slot to NULL
when releasing a http_object_request. release_active_slot() is also
invoked on the slot to remove the curl handle associated with the slot
from the multi stack (CURLM *curlm in http.c).

These prevent the callback function and data from being used in http
methods (like http.c::finish_active_slot()) after a
http_object_request has been free'd.

Noticed by Ali Polatel, who later tested this patch to verify that it
fixes the problem he saw; Dscho helped to identify the problem spot.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.3' into maint
Junio C Hamano [Fri, 28 Aug 2009 03:42:42 +0000 (20:42 -0700)]
Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
  Fix overridable written with an extra 'e'
  Documentation: git-archive: mark --format as optional in summary
  Round-down years in "years+months" relative date view

14 years agoMerge branch 'maint-1.6.2' into maint-1.6.3
Junio C Hamano [Fri, 28 Aug 2009 03:42:38 +0000 (20:42 -0700)]
Merge branch 'maint-1.6.2' into maint-1.6.3

* maint-1.6.2:
  Fix overridable written with an extra 'e'
  Documentation: git-archive: mark --format as optional in summary
  Round-down years in "years+months" relative date view

Conflicts:
Documentation/git-archive.txt

14 years agoFix overridable written with an extra 'e'
Nanako Shiraishi [Fri, 28 Aug 2009 03:18:49 +0000 (12:18 +0900)]
Fix overridable written with an extra 'e'

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Fri, 28 Aug 2009 03:41:37 +0000 (20:41 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  Documentation: git-archive: mark --format as optional in summary

14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Fri, 28 Aug 2009 03:41:31 +0000 (20:41 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  Documentation: git-archive: mark --format as optional in summary

14 years agoDocumentation: git-archive: mark --format as optional in summary
Wesley J. Landaker [Fri, 28 Aug 2009 02:55:43 +0000 (20:55 -0600)]
Documentation: git-archive: mark --format as optional in summary

The --format option was made optional in 8ff21b1 (git-archive: make
tar the default format, 2007-04-09), but it was not marked as optional
in the summary. This trival patch just changes the summary to match
the rest of the documentation.

Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.5.6' into maint-1.6.0
Junio C Hamano [Fri, 28 Aug 2009 03:03:35 +0000 (20:03 -0700)]
Merge branch 'maint-1.5.6' into maint-1.6.0

* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit

14 years agoRound-down years in "years+months" relative date view
David Reiss [Thu, 27 Aug 2009 23:39:38 +0000 (16:39 -0700)]
Round-down years in "years+months" relative date view

Previously, a commit from 1 year and 7 months ago would display as
"2 years, 7 months ago".

Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-log: allow --decorate[=short|full]
Lars Hjemli [Sat, 15 Aug 2009 14:23:12 +0000 (16:23 +0200)]
git-log: allow --decorate[=short|full]

Commit de435ac0 changed the behavior of --decorate from printing the
full ref (e.g., "refs/heads/master") to a shorter, more human-readable
version (e.g., just "master"). While this is nice for human readers,
external tools using the output from "git log" may prefer the full
version.

This patch introduces an extension to --decorate to allow the caller to
specify either the short or the full versions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMinor improvement to the write-tree documentation
David Kågedal [Wed, 26 Aug 2009 14:04:54 +0000 (16:04 +0200)]
Minor improvement to the write-tree documentation

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-bisect: call the found commit "*the* first bad commit"
Nanako Shiraishi [Wed, 26 Aug 2009 08:38:50 +0000 (17:38 +0900)]
git-bisect: call the found commit "*the* first bad commit"

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'js/maint-cover-letter-non-ascii' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'js/maint-cover-letter-non-ascii' into maint

* js/maint-cover-letter-non-ascii:
  Correctly mark cover letters' encodings if they are not pure ASCII
  Expose the has_non_ascii() function

14 years agoMerge branch 'jc/maint-clean-nested-dir-safety' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'jc/maint-clean-nested-dir-safety' into maint

* jc/maint-clean-nested-dir-safety:
  clean: require double -f options to nuke nested git repository and work tree

14 years agoMerge branch 'jk/maint-merge-msg-fix' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'jk/maint-merge-msg-fix' into maint

* jk/maint-merge-msg-fix:
  merge: indicate remote tracking branches in merge message
  merge: fix incorrect merge message for ambiguous tag/branch
  add tests for merge message headings

14 years agoMerge branch 'jc/apply-epoch-patch' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'jc/apply-epoch-patch' into maint

* jc/apply-epoch-patch:
  apply: notice creation/removal patches produced by GNU diff

14 years agoMerge branch 'jp/symlink-dirs' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'jp/symlink-dirs' into maint

* jp/symlink-dirs:
  t6035-merge-dir-to-symlink depends on SYMLINKS prerequisite
  git-checkout: be careful about untracked symlinks
  lstat_cache: guard against full match of length of 'name' parameter
  Demonstrate bugs when a directory is replaced with a symlink

14 years agoMerge branch 'maint-1.6.3' into maint
Junio C Hamano [Wed, 26 Aug 2009 19:05:57 +0000 (12:05 -0700)]
Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
  add -p: do not attempt to coalesce mode changes
  git add -p: demonstrate failure when staging both mode and hunk

14 years agoMerge branch 'tr/maint-1.6.3-add-p-modeonly-fix' into maint-1.6.3
Junio C Hamano [Wed, 26 Aug 2009 18:22:00 +0000 (11:22 -0700)]
Merge branch 'tr/maint-1.6.3-add-p-modeonly-fix' into maint-1.6.3

* tr/maint-1.6.3-add-p-modeonly-fix:
  add -p: do not attempt to coalesce mode changes
  git add -p: demonstrate failure when staging both mode and hunk

14 years agocheckout: do not imply "-f" on unborn branches
Jeff King [Tue, 25 Aug 2009 03:03:16 +0000 (23:03 -0400)]
checkout: do not imply "-f" on unborn branches

When checkout sees that HEAD points to a non-existent ref,
it currently acts as if "-f" was given; this behavior dates
back to 5a03e7f, which enabled checkout from unborn branches
in the shell version of "git-checkout". The reasoning given
is to avoid the code path which tries to merge the tree
contents. When checkout was converted to C, this code
remained intact.

The unfortunate side effect of this strategy is that the
"force" code path will overwrite working tree and index
state that may be precious to the user. Instead of enabling
"force", this patch uses the normal "merge" codepath for an
unborn branch, but substitutes the empty tree for the "old"
commit.

This means that in the absence of an index, any files in the
working tree will be treated as untracked files, and a
checkout which would overwrite them is aborted. Similarly,
any paths in the index will be merged with an empty entry
as the base, meaning that unless the new branch's content is
identical to what's in the index, there will be a conflict
and the checkout will be aborted.

The user is then free to correct the situation or proceed
with "-f" as appropriate.

This patch also removes the "warning: you are on a branch
yet to be born" message. Its function was to warn the user
that we were enabling the "-f" option. Since we are no
longer doing that, there is no reason for the user to care
whether we are switching away from an unborn branch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoxutils: Fix xdl_recmatch() on incomplete lines
Junio C Hamano [Sun, 23 Aug 2009 07:57:18 +0000 (00:57 -0700)]
xutils: Fix xdl_recmatch() on incomplete lines

Thell Fowler noticed that various "ignore whitespace" options to git diff
do not work well on an incomplete line.

The loop control of the function responsible for these bugs was extremely
difficult to follow.  This patch restructures the loops for three variants
of "ignore whitespace" logic.

The basic idea of the re-written logic is:

 - A loop runs while the characters from both strings we are looking at
   match.  We declare unmatch immediately when we find something that does
   not match and return false from the function.  We break out of the loop
   if we ran out of either side of the string.

   The way we skip spaces inside this loop varies depending on the style
   of ignoring whitespaces.

 - After the above loop breaks, we know that the parts of the strings we
   inspected so far match, ignoring the whitespaces.  The lines can match
   only if the remainder consists of nothing but whitespaces.  This part
   of the logic is shared across all three styles.

The new code is more obvious and should be much easier to follow.

Tested-by: Thell Fowler <git@tbfowler.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoxutils: Fix hashing an incomplete line with whitespaces at the end
Junio C Hamano [Sun, 23 Aug 2009 07:51:09 +0000 (00:51 -0700)]
xutils: Fix hashing an incomplete line with whitespaces at the end

Upon seeing a whitespace, xdl_hash_record_with_whitespace() first skipped
the run of whitespaces (excluding LF) that begins there, ensuring that the
pointer points at the last whitespace character in the run, and assumed
that the next character must be LF at the end of the line.  This does not
work when hashing an incomplete line, which lacks the LF at the end.

Introduce "at_eol" variable that is true when either we are at the end of
line (looking at LF) or at the end of an incomplete line, and use that
instead throughout the code.

Noticed by Thell Fowler.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGIT 1.6.4.1 v1.6.4.1
Junio C Hamano [Fri, 21 Aug 2009 19:02:25 +0000 (12:02 -0700)]
GIT 1.6.4.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'bc/maint-am-email' into maint
Junio C Hamano [Sat, 22 Aug 2009 01:51:30 +0000 (18:51 -0700)]
Merge branch 'bc/maint-am-email' into maint

* bc/maint-am-email:
  git-am: print fair error message when format detection fails
  am: allow individual e-mail files as input

14 years agoMerge branch 'jc/maint-merge-recursive-fix' into maint
Junio C Hamano [Fri, 21 Aug 2009 18:34:24 +0000 (11:34 -0700)]
Merge branch 'jc/maint-merge-recursive-fix' into maint

* jc/maint-merge-recursive-fix:
  merge-recursive: don't segfault while handling rename clashes

14 years agoMerge branch 'zf/maint-gitweb-acname' into maint
Junio C Hamano [Fri, 21 Aug 2009 18:34:17 +0000 (11:34 -0700)]
Merge branch 'zf/maint-gitweb-acname' into maint

* zf/maint-gitweb-acname:
  gitweb: parse_commit_text encoding fix

14 years agoMerge branch 'np/maint-limit-delta-cache' into maint
Junio C Hamano [Fri, 21 Aug 2009 18:34:02 +0000 (11:34 -0700)]
Merge branch 'np/maint-limit-delta-cache' into maint

* np/maint-limit-delta-cache:
  don't let the delta cache grow unbounded in 'git repack'

14 years agoMerge branch 'jk/maint-show-tag' into maint
Junio C Hamano [Fri, 21 Aug 2009 18:33:54 +0000 (11:33 -0700)]
Merge branch 'jk/maint-show-tag' into maint

* jk/maint-show-tag:
  show: add space between multiple items
  show: suppress extra newline when showing annotated tag

14 years agoMerge branch 'sb/maint-pull-rebase' into maint
Junio C Hamano [Fri, 21 Aug 2009 18:33:08 +0000 (11:33 -0700)]
Merge branch 'sb/maint-pull-rebase' into maint

* sb/maint-pull-rebase:
  pull: support rebased upstream + fetch + pull --rebase
  t5520-pull: Test for rebased upstream + fetch + pull --rebase

14 years agohttp.c: don't assume that urls don't end with slash
Tay Ray Chuan [Mon, 17 Aug 2009 09:09:43 +0000 (17:09 +0800)]
http.c: don't assume that urls don't end with slash

Make append_remote_object_url() (and by implication,
get_remote_object_url) use end_url_with_slash() to ensure that the url
ends with a slash.

Previously, they assumed that the url did not end with a slash and
as a result appended a slash, sometimes errorneously.

This fixes an issue introduced in 5424bc5 ("http*: add helper methods
for fetching objects (loose)"), where the append_remote_object_url()
implementation in http-push.c, which assumed that urls end with a
slash, was replaced by another one in http.c, which assumed urls did
not end with a slash.

The above issue was raised by Thomas Schlichter:

  http://marc.info/?l=git&m=125043105231327

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Tested-by: Thomas Schlichter <thomas.schlichter@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofilter-branch: make the usage string fit on 80 chars terminals.
Matthieu Moy [Tue, 18 Aug 2009 09:51:00 +0000 (11:51 +0200)]
filter-branch: make the usage string fit on 80 chars terminals.

It used to be a single, huge line, badly wrapped by xterm.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofilter-branch: add an example how to add ACKs to a range of commits
Johannes Schindelin [Mon, 17 Aug 2009 20:38:46 +0000 (22:38 +0200)]
filter-branch: add an example how to add ACKs to a range of commits

When you have to add certain lines like ACKs (or for that matter,
Signed-off-by:s) to a range of commits starting with HEAD, you might
be tempted to use 'git rebase -i -10', but that is a waste of your
time.

It is better to use 'git filter-branch' with an appropriate message
filter, and this commit adds an example how to do so to
filter-branch's man page.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheck_path(): allow symlinked directories to checkout-index --prefix
Junio C Hamano [Mon, 17 Aug 2009 06:53:12 +0000 (23:53 -0700)]
check_path(): allow symlinked directories to checkout-index --prefix

Merlyn noticed that Documentation/install-doc-quick.sh no longer correctly
removes old installed documents when the target directory has a leading
path that is a symlink.  It turns out that "checkout-index --prefix" was
broken by recent b6986d8 (git-checkout: be careful about untracked
symlinks, 2009-07-29).

I suspect has_symlink_leading_path() could learn the third parameter
(prefix that is allowed to be symlinked directories) to allow us to retire
a similar function has_dirs_only_path().

Another avenue of fixing this I considered was to get rid of base_dir and
base_dir_len from "struct checkout", and instead make "git checkout-index"
when run with --prefix mkdir the leading path and chdir in there.  It
might be the best longer term solution to this issue, as the base_dir
feature is used only by that rather obscure codepath as far as I know.

But at least this patch should fix this breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodocs: describe impact of repack on "clone -s"
Jeff King [Mon, 17 Aug 2009 06:19:17 +0000 (02:19 -0400)]
docs: describe impact of repack on "clone -s"

The effects of repacking on a repository with alternates are a bit
subtle. The two main things users will want are:

  1. Not to waste disk space by accidentally copying objects which could
     be shared.

  2. Copying all objects explicitly to break the dependency on the source
     repo.

This patch describes both under the "clone -s" documentation. It makes
sense to put it there rather than in git-repack.txt for both cases.

For (1), we are warning the user who is using "clone -s" about what _not_
to do, so we need to get their attention when reading about "clone -s".

For (2), we are telling them how git-repack can be used to accomplish a
task, but until they know that git-repack is the right tool, they have no
reason to look at the repack documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoadd -p: do not attempt to coalesce mode changes
Thomas Rast [Sat, 15 Aug 2009 13:56:39 +0000 (15:56 +0200)]
add -p: do not attempt to coalesce mode changes

In 0392513 (add-interactive: refactor mode hunk handling, 2009-04-16),
we merged the interaction loops for mode changes and hunk staging.
This was fine at the time, because 0beee4c (git-add--interactive:
remove hunk coalescing, 2008-07-02) removed hunk coalescing.

However, in 7a26e65 (Revert "git-add--interactive: remove hunk
coalescing", 2009-05-16), we resurrected it.  Since then, the code
would attempt in vain to merge mode changes with diff hunks,
corrupting both in the process.

We add a check to the coalescing loop to ensure it only looks at diff
hunks, thus skipping mode changes.

Noticed-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit add -p: demonstrate failure when staging both mode and hunk
Kirill Smelkov [Sat, 15 Aug 2009 12:26:49 +0000 (16:26 +0400)]
git add -p: demonstrate failure when staging both mode and hunk

When trying to stage changes to file which has also pending `chmod +x`,
`git add -p` produces lots of 'Use of uninitialized value ...' warnings
and fails to do the job:

    $ echo content >> file
    $ chmod +x file
    $ git add -p
    diff --git a/file b/file
    index e69de29..d95f3ad
    --- a/file
    +++ b/file
    old mode 100644
    new mode 100755
    Stage mode change [y,n,q,a,d,/,j,J,g,?]? y
    @@ -0,0 +1 @@
    +content
    Stage this hunk [y,n,q,a,d,/,K,g,e,?]? y
    Use of uninitialized value $o_ofs in addition (+) at .../git-add--interactive line 776.
    Use of uninitialized value $ofs in numeric le (<=) at .../git-add--interactive line 806.
    Use of uninitialized value $o0_ofs in concatenation (.) or string at .../git-add--interactive line 830.
    Use of uninitialized value $n0_ofs in concatenation (.) or string at .../git-add--interactive line 830.
    Use of uninitialized value $o_ofs in addition (+) at .../git-add--interactive line 776.
    fatal: corrupt patch at line 5
    diff --git a/file b/file
    index e69de29..d95f3ad
    --- a/file
    +++ b/file
    @@ -,0 + @@
    +content

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix "unpack-objects --strict"
Junio C Hamano [Thu, 13 Aug 2009 19:41:14 +0000 (12:41 -0700)]
Fix "unpack-objects --strict"

When unpack-objects is run under the --strict option, objects that have
pointers to other objects are verified for the reachability at the end, by
calling check_object() on each of them, and letting check_object to walk
the reachable objects from them using fsck_walk() recursively.

The function however misunderstands the semantics of fsck_walk() function
when it makes a call to it, setting itself as the callback.  fsck_walk()
expects the callback function to return a non-zero value to signal an
error (negative value causes an immediate abort, positive value is still
an error but allows further checks on sibling objects) and return zero to
signal a success.  The function however returned 1 on some non error
cases, and to cover up this mistake, complained only when fsck_walk() did
not detect any error.

To fix this double-bug, make the function return zero on all success
cases, and also check for non-zero return from fsck_walk() for an error.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.3' into maint
Junio C Hamano [Wed, 12 Aug 2009 23:15:55 +0000 (16:15 -0700)]
Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
  Change mentions of "git programs" to "git commands"
  Documentation: merge: one <remote> is required
  help.c: give correct structure's size to memset()

14 years agopush: point to 'git pull' and 'git push --force' in case of non-fast forward
Matthieu Moy [Sat, 8 Aug 2009 07:51:08 +0000 (09:51 +0200)]
push: point to 'git pull' and 'git push --force' in case of non-fast forward

'git push' failing because of non-fast forward is a very common situation,
and a beginner does not necessarily understand "fast forward" immediately.

Add a new section to the git-push documentation and refer them to it.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: add: <filepattern>... is optional
Paul Bolle [Tue, 11 Aug 2009 13:03:10 +0000 (15:03 +0200)]
Documentation: add: <filepattern>... is optional

<filepattern>... is optional (e.g. when the --all or --update
options are used) so use square brackets in the synopsis.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoChange mentions of "git programs" to "git commands"
Ori Avtalion [Fri, 7 Aug 2009 14:24:21 +0000 (17:24 +0300)]
Change mentions of "git programs" to "git commands"

Most of the docs and printouts refer to "commands" when discussing what
the end users call via the "git" top-level program. We should refer them
as "git programs" when we discuss the fact that the commands are
implemented as separate programs, but in other contexts, it is better to
use the term "git commands" consistently.

Signed-off-by: Ori Avtalion <ori@avtalion.name>
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: merge: one <remote> is required
Paul Bolle [Tue, 11 Aug 2009 13:03:58 +0000 (15:03 +0200)]
Documentation: merge: one <remote> is required

merge only requires one <remote>, so "<remote>..." should be used in the
synopsis (and not "<remote> <remote>...").

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>