Commit graph

33229 commits

Author SHA1 Message Date
Ramsay Jones ec535cc27e compat/unsetenv.c: Fix a sparse warning
The gitunsetenv function includes an (redundant) declaration of the
'environ' symbol, which is a pointer to the table of environment
variables. Unfortunately, on MinGW, this provokes sparse to issue
the following warning:

    compat/unsetenv.c:5:20: warning: non-ANSI function declaration of \
    function '__p__environ'

On MinGW, the <stdlib.h> header defines the 'environ' symbol as a
preprocessor macro (via _environ) which obtains the environ table
pointer via a call to the __p__environ() function.

In order to suppress the warning, we simply remove the redundant
declaration of the 'environ' symbol, since the symbol is already
declared correctly in <stdlib.h> (included via git-compat-util.h).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:26:38 -07:00
Ramsay Jones eec7fd8bc5 compat/nedmalloc: Fix compiler warnings on linux
On linux, when the build variable USE_NED_ALLOCATOR is set, gcc
issues the following warnings:

    In file included from compat/nedmalloc/nedmalloc.c:63:
    .../malloc.c.h: In function 'mmap_resize':
    .../malloc.c.h:3762: warning: implicit declaration of function 'mremap'
    .../malloc.c.h: In function 'sys_trim':
    .../malloc.c.h:4195: warning: comparison between pointer and integer

The warnings are caused by the <sys/mman.h> header not enabling the
(conditional) declaration of the mremap() function.  The declaration
can be enabled by defining the _GNU_SOURCE symbol prior to including
certain system header files. In particular, it may not be sufficient
to simply define _GNU_SOURCE just prior to including the <sys/mman.h>
header. (e.g. defining the symbol after including <sys/types.h> will
be completely ineffective.)

In order to suppress the warnings, we define the _GNU_SOURCE symbol
at the start of the malloc.c.h header file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:26:09 -07:00
Ramsay Jones 241c957d89 compat/nedmalloc: Fix some sparse warnings
Sparse issues many "Using plain integer as NULL pointer" warnings
while checking nedmalloc.c (at least 98 such warnings before giving
up due to "too many warnings"). In addition, sparse issues some
"non-ANSI function declaration" type warnings for the symbols
'win32_getcurrentthreadid', 'malloc_stats' and 'malloc_footprint'.

In order to suppress the NULL pointer warnings, rather than replace
all uses of '0' as a null pointer representation with NULL, we add
-Wno-non-pointer-null to SPARSE_FLAGS while checking nedmalloc.c.

In order to suppress the "non-ANSI function declaration" warnings,
we simply include the missing 'empty parameter list' prototype (void)
in the function declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:24:48 -07:00
Ramsay Jones 4fc8fb48e9 compat/fnmatch/fnmatch.c: Fix a sparse error
Sparse issues the following error and warnings:

    SP compat/fnmatch/fnmatch.c
.../fnmatch.c:144:17: warning: Using plain integer as NULL pointer
.../fnmatch.c:238:67: warning: Using plain integer as NULL pointer
.../fnmatch.c:303:40: error: too many arguments for function getenv

The error is caused by the extern declaration for the getenv function
not including the function prototype. Without the prototype, sparse
effectively sees the declaration as 'char *getenv(void)'. In order to
suppress the error, we simply include the function prototype.

In order to suppress the warnings, we include the <stddef.h> header
which provides an appropriate definition of the NULL macro, rather
than using the (inappropriate) default definition at fnmatch.c:132.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:24:40 -07:00
Ramsay Jones 5b62e6374a compat/regex/regexec.c: Fix some sparse warnings
Sparse issues an "Using plain integer as NULL pointer" warning along
with two "symbol was not declared. Should it be static?" type warnings
for the 'merge_state_with_log' and 'find_recover_state' functions.

In order to suppress the warnings, we replace the use of '0' as a null
pointer constant with NULL and add the static modifier to the function
definitions.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:24:18 -07:00
Junio C Hamano c85f0a2a0e Merge branch 'nd/pretty-formats'
* nd/pretty-formats:
  pretty: Fix bug in truncation support for %>, %< and %><
2013-04-28 12:10:03 -07:00
Ramsay Jones 980419b993 pretty: Fix bug in truncation support for %>, %< and %><
Some systems experience failures in t4205-*.sh (tests 18-20, 27)
which all relate to the use of truncation with the %< padding
placeholder. This capability was added in the commit a7f01c6b
("pretty: support truncating in %>, %< and %><", 19-04-2013).

The truncation support was implemented with the assistance of a
new strbuf function (strbuf_utf8_replace). This function contains
the following code:

       strbuf_attach(sb_src, strbuf_detach(&sb_dst, NULL),
                     sb_dst.len, sb_dst.alloc);

Unfortunately, this code is subject to unspecified behaviour. In
particular, the order of evaluation of the argument expressions
(along with the associated side effects) is not specified by the
C standard. Note that the second argument expression is a call to
strbuf_detach() which, as a side effect, sets the 'len' and 'alloc'
fields of the sb_dst argument to zero. Depending on the order of
evaluation of the argument expressions to the strbuf_attach call,
this can lead to assigning an empty string to 'sb_src'.

In order to remove the undesired behaviour, we replace the above
line of code with:

       strbuf_swap(sb_src, &sb_dst);
       strbuf_release(&sb_dst);

which achieves the desired effect without provoking unspecified
behaviour.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 12:09:37 -07:00
Junio C Hamano a6fed65a6a Merge branch 'jk/check-corrupt-objects-carefully'
* jk/check-corrupt-objects-carefully:
  clone: Make the 'junk_mode' symbol a file static
2013-04-28 11:57:54 -07:00
Ramsay Jones 85064630fc clone: Make the 'junk_mode' symbol a file static
Sparse issues an "'junk_mode' not declared. Should it be static?"
warning. In order to suppress the warning, since this symbol does
not need more than file visibility, we simply add the static
modifier to its declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 11:57:35 -07:00
Junio C Hamano 27f0d3b63d Merge branch 'jk/merge-tree-added-identically'
off-by-one fix.

* jk/merge-tree-added-identically:
  merge-tree: fix typo in "both changed identically"
2013-04-28 11:53:57 -07:00
John Keeping ab5f42422d merge-tree: fix typo in "both changed identically"
Commit aacecc3 (merge-tree: don't print entries that match "local" -
2013-04-07) had a typo causing the "same in both" check to be incorrect
and check if both the base and "their" versions are removed instead of
checking that both the "our" and "their" versions are removed.  Fix
this.

Reported-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Test-written-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28 11:53:41 -07:00
Felipe Contreras ea57352182 completion: add missing format-patch options
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 16:09:47 -07:00
Felipe Contreras c29e317994 completion: remove __git_index_file_list_filter()
Refactor the code into the only caller; __git_index_files().

Also, Somehow messing up with the 'path' variable messes up the 'PATH'
variable. So let's not do that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:29 -07:00
Felipe Contreras fbe451182e completion: add space after completed filename
Just like before fea16b4 (git-completion.bash: add support for path
completion).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:29 -07:00
Felipe Contreras 3ffa4df4b2 completion: add hack to enable file mode in bash < 4
This way we don't need all the compat stuff, different filters, and so
on. Also, now we complete exactly the same in bash 3 and bash 4.

This is the way bash-completion did it for quite some time, when bash 3
was supported. For more information about the hack:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=272660#64

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:29 -07:00
Felipe Contreras fda54ef1aa completion: refactor __git_complete_index_file()
The calls to __gitcomp_file() are essentially the same, but with
different prefix.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:29 -07:00
Felipe Contreras f825972c38 completion: refactor diff_index wrappers
At the end of the day what we really need is to find out the files that
have been staged, or modified, because those files are the ones that
make sense to pass as arguments to 'git commit'.

We need diff-index to find those out, since 'git ls-files' doesn't do
that.

But we don't need wrappers and wrappers basically identical to the ones
used for 'git ls-files', when we can pretend it receives a --committable
option that would return what we need.

That way, we can remove a bunch of code without any functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:29 -07:00
Felipe Contreras 0afe8e9e98 completion: use __gitcompadd for __gitcomp_file
Like the rest of the script does; let's not access COMPREPLY directly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:28 -07:00
Felipe Contreras 9ab8d18322 completion; remove unuseful comments
The only caller, __git_complete_index_file() doesn't specify any limits
to the options for 'git ls-files', neither should this function.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:28 -07:00
Felipe Contreras f03efba4c0 completion: document tilde expansion failure in tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:28 -07:00
Felipe Contreras ddf07bddef completion: add file completion tests
The commit fea16b4 (git-completion.bash: add support for path
completion) introduced quite a few changes, without the usual tests.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 14:32:28 -07:00
Johannes Sixt 752db4254c git-remote-testgit: avoid process substitution
The implementation of bash on Windows does not offer process substitution.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 13:52:03 -07:00
John Keeping 54bb9015c8 t/Makefile: fix result handling with TEST_OUTPUT_DIRECTORY
When TEST_OUTPUT_DIRECTORY is set, the test results will be generated in
"$TEST_OUTPUT_DIRECTORY/test-results", which may not be the same as
"test-results" in t/Makefile.  This causes the aggregate-results target
to fail as it finds no count files.

Fix this by introducing TEST_RESULTS_DIRECTORY and using it wherever
test-results is referenced.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-27 13:41:31 -07:00
Junio C Hamano b75cdfaa88 Git 1.8.3-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:45:09 -07:00
Junio C Hamano 2a407d7443 Merge branch 'rr/shortlog-doc'
Update documentation for "log" and "shortlog".

* rr/shortlog-doc:
  builtin/shortlog.c: make usage string consistent with log
  builtin/log.c: make usage string consistent with doc
  git-shortlog.txt: make SYNOPSIS match log, update OPTIONS
  git-log.txt: rewrite note on why "--" may be required
  git-log.txt: generalize <since>..<until>
  git-log.txt: order OPTIONS properly; move <since>..<until>
  revisions.txt: clarify the .. and ... syntax
  git-shortlog.txt: remove (-h|--help) from OPTIONS
2013-04-26 15:28:39 -07:00
Junio C Hamano f44014b74d Merge branch 'th/bisect-skipped-log'
* th/bisect-skipped-log:
  bisect: Log possibly bad, skipped commits at bisection end
2013-04-26 15:28:37 -07:00
Junio C Hamano d1ab71804f Merge branch 'ph/rebase-original'
* ph/rebase-original:
  rebase: find orig_head unambiguously
2013-04-26 15:28:34 -07:00
Junio C Hamano 019eb0dd35 Merge branch 'jn/glossary-revision'
The wording for "revision" in the glossary wanted to say it refers
to "commit (noun) as a concept" but it was badly phrased.

This may need further updates to hint that in contexts where it is
clear, the word may refer to an object name, not necessarily a
commit. But the patch as-is is already an improvement.

* jn/glossary-revision:
  glossary: a revision is just a commit
2013-04-26 15:28:23 -07:00
Junio C Hamano 838f9c1eb6 Merge branch 'jc/add-ignore-removal'
Introduce "--ignore-removal" as a synonym to "--no-all" for "git
add", and improve the 2.0 migration warning with it.

* jc/add-ignore-removal:
  git add: rephrase -A/--no-all warning
  git add: --ignore-removal is a better named --no-all
2013-04-26 15:28:09 -07:00
Felipe Contreras 877ee9cc7e remote-bzr: strip extra newline
It's added by fast-export, the user didn't type it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:27 -07:00
Felipe Contreras 4d74cd4725 remote-bzr: tell bazaar to be quiet
Otherwise we get notification, progress bars, and what not.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:27 -07:00
Felipe Contreras d82c912c43 remote-bzr: store converted URL
Bazaar might convert the URL to something more appropriate, like an
absolute path. Lets store that instead of the original URL, which won't
work from a different working directory if it's relative.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:27 -07:00
Felipe Contreras 6134caf2c1 remote-hg: use hashlib instead of hg sha1 util
To be in sync with remote-bzr.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:27 -07:00
Felipe Contreras aa93845661 remote-bzr: add support to push URLs
Just like in remote-hg.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:27 -07:00
Felipe Contreras d6bb9136c9 remote-bzr: fix bad state issue
Carried from remote-hg.

The problem reportedly happened after doing a push that fails, the abort
causes the state of remote-hg to go bad, this happens because
remote-hg's marks are not stored, but 'git fast-export' marks are.

Ensure that the marks are _always_ stored.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:26 -07:00
Felipe Contreras 23df5e40f0 remote-hg: remove extra check
Not needed since we use xrange ourselves.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:26 -07:00
Felipe Contreras 75301a4588 remote-helpers: trivial cleanups
No functional changes. Typos, unused variables, redundant operations,
and white-spaces.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 15:20:26 -07:00
Junio C Hamano c8c82b1ba3 Merge branch 'fc/remote-hg'
* fc/remote-hg:
  remote-hg: strip extra newline
  remote-hg: use marks instead of inlined files
  remote-hg: small performance improvement
  remote-hg: allow refs with spaces
  remote-hg: don't update bookmarks unnecessarily
  remote-hg: add support for schemes extension
  remote-hg: improve email sanitation
  remote-hg: add custom local tag write code
  remote-hg: write tags in the appropriate branch
  remote-hg: custom method to write tags
  remote-hg: add support for tag objects
  remote-hg: add branch_tip() helper
  remote-hg: properly mark branches up-to-date
  remote-hg: use python urlparse
  remote-hg: safer bookmark pushing
  remote-helpers: avoid has_key
2013-04-26 15:19:03 -07:00
Junio C Hamano df8597258e Merge branch 'fc/remote-bzr'
* fc/remote-bzr:
  remote-bzr: use proper push method
2013-04-26 15:18:26 -07:00
Junio C Hamano aedb94b3f0 Merge branch 'jc/warn-pathless-add-finishing-touches'
* jc/warn-pathless-add-finishing-touches:
  git add: avoid "-u/-A without pathspec" warning on stat-dirty paths
2013-04-26 15:17:48 -07:00
Junio C Hamano 0df7b8e55c git add: avoid "-u/-A without pathspec" warning on stat-dirty paths
In preparation for Git 2.0, "git add -u/-A" without pathspec checks
all the working tree (not limited to the current directory) and
issues a warning when it finds any path that we might add in Git
2.0, because that would mean the users' fingers need to be trained
to explicitly say "." if they want to keep the current behaviour.

However, the check was incomplete, because "git add" usually does
not refresh the index, considers a path that is stat-dirty but has
contents that is otherwise up-to-date in the index as "we might
add", and relies on that it is a no-op to add the same thing again
via the add_file_to_index() API (which also knows not to say "added"
in verbose mode when this happens).  We do not want to trigger the
warning for a path that is outside the current directory is merely
stat-dirty, as it won't be added in Git 2.0, either.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
2013-04-26 14:55:20 -07:00
Junio C Hamano e27004e341 Sync with 1.8.2.2 2013-04-26 13:00:48 -07:00
Junio C Hamano 4a9a4f0ec1 Git 1.8.2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-26 12:59:36 -07:00
Junio C Hamano 7a011aac0e Merge branch 'jk/a-thread-only-dies-once' into maint
* jk/a-thread-only-dies-once:
  run-command: use thread-aware die_is_recursing routine
  usage: allow pluggable die-recursion checks
2013-04-26 11:25:59 -07:00
Junio C Hamano 40a9c3c9a0 Merge branch 'jn/gitweb-install-doc' into maint
* jn/gitweb-install-doc:
  gitweb/INSTALL: GITWEB_CONFIG_SYSTEM is for backward compatibility
  gitweb/INSTALL: Simplify description of GITWEB_CONFIG_SYSTEM
2013-04-26 11:12:48 -07:00
Junio C Hamano 1a475c4a2f Merge branch 'fc/untracked-zsh-prompt' into maint
* fc/untracked-zsh-prompt:
  prompt: fix untracked files for zsh
2013-04-26 11:12:30 -07:00
Junio C Hamano bd8e3385d5 Merge branch 'jk/receive-pack-deadlocks-with-early-failure' into maint
* jk/receive-pack-deadlocks-with-early-failure:
  receive-pack: close sideband fd on early pack errors
2013-04-26 11:12:17 -07:00
Junio C Hamano 30e8180b27 Merge branch 'jk/chopped-ident' into maint
* jk/chopped-ident:
  blame: handle broken commit headers gracefully
  pretty: handle broken commit headers gracefully
  cat-file: print tags raw for "cat-file -p"
2013-04-26 11:11:51 -07:00
Junio C Hamano 0222bc9102 Merge branch 'rt/commentchar-fmt-merge-msg' into maint
* rt/commentchar-fmt-merge-msg:
  t6200: avoid path mangling issue on Windows
  fmt-merge-msg: use core.commentchar in tag signatures completely
  fmt-merge-msg: respect core.commentchar in people credits
2013-04-26 11:10:47 -07:00
Junio C Hamano 167843f285 Merge branch 'rs/empty-archive' into maint
* rs/empty-archive:
  t5004: fix issue with empty archive test and bsdtar
2013-04-26 11:03:31 -07:00