gitweb.git
fix typos in 2.15.0 release notesJean Carlo Machado Sat, 4 Nov 2017 12:16:16 +0000 (10:16 -0200)

fix typos in 2.15.0 release notes

Signed-off-by: Jean Carlo Machado <contato@jeancarlomachado.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: update some more docs to use "oid" rather than... Michael Haggerty Sun, 5 Nov 2017 08:42:09 +0000 (09:42 +0100)

refs: update some more docs to use "oid" rather than "sha1"

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_packed_entry(): take `object_id` argumentsMichael Haggerty Sun, 5 Nov 2017 08:42:08 +0000 (09:42 +0100)

write_packed_entry(): take `object_id` arguments

Change `write_packed_entry()` to take `struct object_id *` rather than
`unsigned char *` arguments.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: rename constant `REF_ISPRUNING` to `REF_IS_PRUNING`Michael Haggerty Sun, 5 Nov 2017 08:42:07 +0000 (09:42 +0100)

refs: rename constant `REF_ISPRUNING` to `REF_IS_PRUNING`

Underscores are cheap, and help readability.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: rename constant `REF_NODEREF` to `REF_NO_DEREF`Michael Haggerty Sun, 5 Nov 2017 08:42:06 +0000 (09:42 +0100)

refs: rename constant `REF_NODEREF` to `REF_NO_DEREF`

Even after working with this code for years, I still see this constant
name as "ref node ref". Rename it to make it's meaning clearer.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: tidy up and adjust visibility of the `ref_update... Michael Haggerty Sun, 5 Nov 2017 08:42:05 +0000 (09:42 +0100)

refs: tidy up and adjust visibility of the `ref_update` flags

The constants used for `ref_update::flags` were rather disorganized:

* The definitions in `refs.h` were not close to the functions that
used them.

* Maybe constants were defined in `refs-internal.h`, making them
visible to the whole refs module, when in fact they only made sense
for the files backend.

* Their documentation wasn't very consistent and partly still referred
to sha1s rather than oids.

* The numerical values followed no rational scheme

Fix all of these problems. The main functional improvement is that
some constants' visibility is now limited to `files-backend.c`.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref_transaction_add_update(): remove a checkMichael Haggerty Sun, 5 Nov 2017 08:42:04 +0000 (09:42 +0100)

ref_transaction_add_update(): remove a check

We want to make `REF_ISPRUNING` internal to the files backend. For
this to be possible, `ref_transaction_add_update()` mustn't know about
it. So move the check that `REF_ISPRUNING` is only used with
`REF_NODEREF` from this function to `files_transaction_prepare()`.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref_transaction_update(): die on disallowed flagsMichael Haggerty Sun, 5 Nov 2017 08:42:03 +0000 (09:42 +0100)

ref_transaction_update(): die on disallowed flags

Callers shouldn't be passing disallowed flags into
`ref_transaction_update()`. So instead of masking them off, treat it
as a bug if any are set.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

prune_ref(): call `ref_transaction_add_update()` directlyMichael Haggerty Sun, 5 Nov 2017 08:42:02 +0000 (09:42 +0100)

prune_ref(): call `ref_transaction_add_update()` directly

`prune_ref()` needs to use the `REF_ISPRUNING` flag, but we want to
make that flag private to the files backend. So instead of calling
`ref_transaction_delete()`, which is a public function and therefore
shouldn't allow the `REF_ISPRUNING` flag, change `prune_ref()` to call
`ref_transaction_add_update()`, which is private to the refs
module. (Note that we don't need any of the other services provided by
`ref_transaction_delete()`.)

This allows us to change `ref_transaction_update()` to reject the
`REF_ISPRUNING` flag. Do so by adjusting
`REF_TRANSACTION_UPDATE_ALLOWED_FLAGS`. Also add parentheses to its
definition to avoid potential future mishaps.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

files_transaction_prepare(): don't leak flags to packed... Michael Haggerty Sun, 5 Nov 2017 08:42:01 +0000 (09:42 +0100)

files_transaction_prepare(): don't leak flags to packed transaction

The files backend uses `ref_update::flags` for several internal flags.
But those flags have no meaning to the packed backend. So when adding
updates for the packed-refs transaction, only use flags that make
sense to the packed backend.

`REF_NODEREF` is part of the public interface, and it's logically what
we want, so include it. In fact it is actually ignored by the packed
backend (which doesn't support symbolic references), but that's its
own business.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix memory leak when returning best elementMartin Ågren Sun, 5 Nov 2017 20:24:31 +0000 (21:24 +0100)

bisect: fix memory leak when returning best element

When `find_bisection()` returns a single list entry, it leaks the other
entries. Move the to-be-returned item to the front and free the
remainder.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix off-by-one error in `best_bisection_sorted()`Martin Ågren Sun, 5 Nov 2017 20:24:30 +0000 (21:24 +0100)

bisect: fix off-by-one error in `best_bisection_sorted()`

After we have sorted the `cnt`-many commits that we have selected, we
place them into the commit list. We then set `p->next` to NULL, but as
we do so, `p` is already pointing one beyond item number `cnt`. Indeed,
we check whether `p` is NULL before dereferencing it.

This only matters if there are TREESAME-commits. Since they should be
skipped, they are not included in `cnt` and we will hit the situation
where we set `p->next` to NULL. As a result, the list will be one longer
than it should be. The last commit in the list will be one which occurs
earlier, or which shouldn't be included.

Do not update `p` the very last round in the loop. This ensures that
after the loop, `p->next` points to the remainder of the list, and we
can set it to NULL. While we're here, free that remainder to fix a
memory leak.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix memory leak in `find_bisection()`Martin Ågren Sun, 5 Nov 2017 20:24:29 +0000 (21:24 +0100)

bisect: fix memory leak in `find_bisection()`

`find_bisection()` rebuilds the commit list it is given by reversing it
and skipping uninteresting commits. The uninteresting list entries are
leaked. Free them to fix the leak.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: change calling-convention of `find_bisection()`Martin Ågren Sun, 5 Nov 2017 20:24:28 +0000 (21:24 +0100)

bisect: change calling-convention of `find_bisection()`

This function takes a commit list and returns a commit list. The
returned list is built by modifying the original list. Thus the caller
should not use the original list again (and after the next commit fixes
a memory leak, it must not).

Change the function signature so that it takes a **list and has void
return type. That should make it harder to misuse this function.

While we're here, document this function.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: document blame configurationStefan Beller Fri, 3 Nov 2017 19:21:58 +0000 (12:21 -0700)

config: document blame configuration

The options are currently only referenced by the git-blame man page,
also explain them in git-config, which is the canonical page to
contain all config options.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-libsecret: unlock locked secretsDennis Kaarsemaker Fri, 3 Nov 2017 20:44:49 +0000 (21:44 +0100)

credential-libsecret: unlock locked secrets

Credentials exposed by the secret service DBUS interface may be locked.
Setting the SECRET_SEARCH_UNLOCK flag will make the secret service
unlock these secrets, possibly prompting the user for credentials to do
so. Without this flag, the secret is simply not loaded.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: avoid double slashes when looking for HEADJeff King Fri, 3 Nov 2017 12:58:02 +0000 (13:58 +0100)

setup: avoid double slashes when looking for HEAD

Andrew Baumann reported that when called outside of any Git worktree,
`git rev-parse --is-inside-work-tree` eventually tries to access
`//HEAD`, i.e. any `HEAD` file in the root directory, but with a double
slash.

This double slash is not only unintentional, but is allowed by the POSIX
standard to have a special meaning. And most notably on Windows, it
does, where it refers to a UNC path of the form `//server/share/`.

As a consequence, afore-mentioned `rev-parse` call not only looks for
the wrong thing, but it also causes serious delays, as Windows will try
to access a server called `HEAD`. Let's simply avoid the unintended
double slash.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: use Kaartic Sivaraam's new addressKaartic Sivaraam Fri, 3 Nov 2017 05:43:41 +0000 (11:13 +0530)

mailmap: use Kaartic Sivaraam's new address

Map the old address to the new, hopefully more permanent one.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: handle missing response codes gracefullyRené Scharfe Thu, 2 Nov 2017 17:27:05 +0000 (18:27 +0100)

imap-send: handle missing response codes gracefully

Response codes are optional. Exit parse_response_code() early if it's
passed a NULL string, indicating that we reached the end of the reply.
This avoids dereferencing said NULL pointer.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: handle NULL return of next_arg()René Scharfe Wed, 1 Nov 2017 17:03:20 +0000 (18:03 +0100)

imap-send: handle NULL return of next_arg()

next_arg() returns NULL if it runs out of arguments. Most call sites
already handle that gracefully. Check in the remaining cases as well.
Replace the NULL pointer with an empty string at the bottom of
get_cmd_result() -- it's nicely reported as an unexpected response a
few lines down. Error out explicitly at the remaining sites.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: --indent-heuristic is no longer experimentalCarlos Martín Nieto Sun, 29 Oct 2017 15:12:28 +0000 (16:12 +0100)

diff: --indent-heuristic is no longer experimental

This heuristic has been the default since 2.14 so we should not confuse our
users by saying that it's experimental and off by default.

Signed-off-by: Carlos Martín Nieto <cmn@dwim.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer.c: check return value of close() in rewrite_f... Simon Ruderich Wed, 1 Nov 2017 14:45:42 +0000 (15:45 +0100)

sequencer.c: check return value of close() in rewrite_file()

Not checking close(2) can hide errors as not all errors are reported
during the write(2).

Signed-off-by: Simon Ruderich <simon@ruderich.org>
Reviewed-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: document the standard handle redirectionJohannes Schindelin Wed, 1 Nov 2017 17:10:33 +0000 (18:10 +0100)

mingw: document the standard handle redirection

This feature has been in Git for Windows since v2.11.0(2), as an
experimental option. Now it is considered mature, and it is high time to
document it properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: optionally redirect stderr/stdout via the same... Johannes Schindelin Wed, 1 Nov 2017 17:10:30 +0000 (18:10 +0100)

mingw: optionally redirect stderr/stdout via the same handle

The "2>&1" notation in Powershell and in Unix shells implies that stderr
is redirected to the same handle into which stdout is already written.

Let's use this special value to allow the same trick with
GIT_REDIRECT_STDERR and GIT_REDIRECT_STDOUT: if the former's value is
`2>&1`, then stderr will simply be written to the same handle as stdout.

The functionality was suggested by Jeff Hostetler.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: add experimental feature to redirect standard... Johannes Schindelin Wed, 1 Nov 2017 17:10:25 +0000 (18:10 +0100)

mingw: add experimental feature to redirect standard handles

Particularly when calling Git from applications, such as Visual Studio's
Team Explorer, it is important that stdin/stdout/stderr are closed
properly. However, when spawning processes on Windows, those handles
must be marked as inheritable if we want to use them, but that flag is a
global flag and may very well be used by other spawned processes which
then do not know to close those handles.

Let's introduce a set of environment variables (GIT_REDIRECT_STDIN and
friends) that specify paths to files, or even better, named pipes (which
are similar to Unix sockets) and that are used by the spawned Git
process. This helps work around above-mentioned issue: those named
pipes will be opened in a non-inheritable way upon startup, and no
handles are passed around (and therefore no inherited handles need to be
closed by any spawned child).

This feature shipped with Git for Windows (marked as experimental) since
v2.11.0(2), so it has seen some serious testing in the meantime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: don't build Git for the static analysis jobSZEDER Gábor Wed, 1 Nov 2017 11:56:44 +0000 (12:56 +0100)

travis-ci: don't build Git for the static analysis job

The static analysis job on Travis CI builds Git ever since it was
introduced in d8245bb3f (travis-ci: add static analysis build job to
run coccicheck, 2017-04-11). However, Coccinelle, the only static
analysis tool in use, only needs Git's source code to work and it
doesn't care about built Git binaries at all.

Spare some of Travis CI's resources and don't build Git for the static
analysis job unnecessarily.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: fix running P4 and Git LFS tests in Linux... SZEDER Gábor Wed, 1 Nov 2017 11:55:35 +0000 (12:55 +0100)

travis-ci: fix running P4 and Git LFS tests in Linux build jobs

Linux build jobs on Travis CI skip the P4 and Git LFS tests since
commit 657343a60 (travis-ci: move Travis CI code into dedicated
scripts, 2017-09-10), claiming there are no P4 or Git LFS installed.

The reason is that P4 and Git LFS binaries are not installed to a
directory in the default $PATH, but their directories are prepended to
$PATH. This worked just fine before said commit, because $PATH was
set in a scriptlet embedded in our '.travis.yml', thus its new value
was visible during the rest of the build job. However, after these
embedded scriptlets were moved into dedicated scripts executed in
separate shell processes, any variable set in one of those scripts is
only visible in that single script but not in any of the others. In
this case, 'ci/install-dependencies.sh' downloads P4 and Git LFS and
modifies $PATH, but to no effect, because 'ci/run-tests.sh' only sees
Travis CI's default $PATH.

Move adjusting $PATH to 'ci/lib-travisci.sh', which is sourced in all
other 'ci/' scripts, so all those scripts will see the updated $PATH
value.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: take the read-lock when adding a submoduleMartin Ågren Wed, 1 Nov 2017 20:45:06 +0000 (21:45 +0100)

grep: take the read-lock when adding a submodule

With --recurse-submodules, we add each submodule that we encounter to
the list of alternate object databases. With threading, our changes to
the list are not protected against races. Indeed, ThreadSanitizer
reports a race when we call `add_to_alternates_memory()` around the same
time that another thread is reading in the list through
`read_sha1_file()`.

Take the grep read-lock while adding the submodule. The lock is used to
serialize uses of non-thread-safe parts of Git's API, including
`read_sha1_file()`.

Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: pass absolute GIT_DIR to exec commandsJacob Keller Tue, 31 Oct 2017 23:07:33 +0000 (16:07 -0700)

sequencer: pass absolute GIT_DIR to exec commands

When we replaced the old shell script based interactive rebase in
commmit 18633e1a22a6 ("rebase -i: use the rebase--helper builtin",
2017-02-09) we introduced a regression of functionality in that the
GIT_DIR would be sent to the environment of the exec command as-is.

This generally meant that it would be passed as "GIT_DIR=.git", which
causes problems for any exec command that wants to run git commands in
a subdirectory.

This isn't a very large regression, since it is not that likely that the
exec command will run a git command, and even less likely that it will
need to do so in a subdir. This regression was discovered by a build
system which uses git-describe to find the current version of the build
system, and happened to do so from the src/ sub directory of the
project.

Fix this by passing in the absolute path of the git directory into the
child environment.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wincred: handle empty username/password correctlyJakub Bereżański Mon, 30 Oct 2017 17:20:44 +0000 (18:20 +0100)

wincred: handle empty username/password correctly

Empty (length 0) usernames and/or passwords, when saved in the Windows
Credential Manager, come back as null when reading the credential.

One use case for such empty credentials is with NTLM authentication, where
empty username and password instruct libcurl to authenticate using the
credentials of the currently logged-on user (single sign-on).

When locating the relevant credentials, make empty username match null.
When outputting the credentials, handle nulls correctly.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0302: check helper can handle empty credentialsJakub Bereżański Mon, 30 Oct 2017 17:20:12 +0000 (18:20 +0100)

t0302: check helper can handle empty credentials

Make sure the helper does not crash when blank username and password is
provided. If the helper can save such credentials, it should be able to
read them back.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: include the full version information in the... Johannes Schindelin Mon, 30 Oct 2017 17:19:42 +0000 (18:19 +0100)

mingw: include the full version information in the resources

This fixes https://github.com/git-for-windows/git/issues/723

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-mediawiki: limit filenames to legalAntoine Beaupré Sun, 29 Oct 2017 18:15:11 +0000 (14:15 -0400)

remote-mediawiki: limit filenames to legal

mediawiki pages can have names longer than NAME_MAX (generally 255)
characters, which will fail on checkout. we simply strip out extra
characters, which may mean one page's content will overwrite another
(the last editing winning).

ideally, we would do a more clever system to find unique names, but
that would be more difficult and error prone for a situation that
should rarely happen in the first place.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: make struct diff_flags members lowercaseBrandon Williams Tue, 31 Oct 2017 18:19:11 +0000 (11:19 -0700)

diff: make struct diff_flags members lowercase

Now that the flags stored in struct diff_flags are being accessed
directly and not through macros, change all struct members from being
uppercase to lowercase.
This conversion is done using the following semantic patch:

@@
expression E;
@@
- E.RECURSIVE
+ E.recursive

@@
expression E;
@@
- E.TREE_IN_RECURSIVE
+ E.tree_in_recursive

@@
expression E;
@@
- E.BINARY
+ E.binary

@@
expression E;
@@
- E.TEXT
+ E.text

@@
expression E;
@@
- E.FULL_INDEX
+ E.full_index

@@
expression E;
@@
- E.SILENT_ON_REMOVE
+ E.silent_on_remove

@@
expression E;
@@
- E.FIND_COPIES_HARDER
+ E.find_copies_harder

@@
expression E;
@@
- E.FOLLOW_RENAMES
+ E.follow_renames

@@
expression E;
@@
- E.RENAME_EMPTY
+ E.rename_empty

@@
expression E;
@@
- E.HAS_CHANGES
+ E.has_changes

@@
expression E;
@@
- E.QUICK
+ E.quick

@@
expression E;
@@
- E.NO_INDEX
+ E.no_index

@@
expression E;
@@
- E.ALLOW_EXTERNAL
+ E.allow_external

@@
expression E;
@@
- E.EXIT_WITH_STATUS
+ E.exit_with_status

@@
expression E;
@@
- E.REVERSE_DIFF
+ E.reverse_diff

@@
expression E;
@@
- E.CHECK_FAILED
+ E.check_failed

@@
expression E;
@@
- E.RELATIVE_NAME
+ E.relative_name

@@
expression E;
@@
- E.IGNORE_SUBMODULES
+ E.ignore_submodules

@@
expression E;
@@
- E.DIRSTAT_CUMULATIVE
+ E.dirstat_cumulative

@@
expression E;
@@
- E.DIRSTAT_BY_FILE
+ E.dirstat_by_file

@@
expression E;
@@
- E.ALLOW_TEXTCONV
+ E.allow_textconv

@@
expression E;
@@
- E.TEXTCONV_SET_VIA_CMDLINE
+ E.textconv_set_via_cmdline

@@
expression E;
@@
- E.DIFF_FROM_CONTENTS
+ E.diff_from_contents

@@
expression E;
@@
- E.DIRTY_SUBMODULES
+ E.dirty_submodules

@@
expression E;
@@
- E.IGNORE_UNTRACKED_IN_SUBMODULES
+ E.ignore_untracked_in_submodules

@@
expression E;
@@
- E.IGNORE_DIRTY_SUBMODULES
+ E.ignore_dirty_submodules

@@
expression E;
@@
- E.OVERRIDE_SUBMODULE_CONFIG
+ E.override_submodule_config

@@
expression E;
@@
- E.DIRSTAT_BY_LINE
+ E.dirstat_by_line

@@
expression E;
@@
- E.FUNCCONTEXT
+ E.funccontext

@@
expression E;
@@
- E.PICKAXE_IGNORE_CASE
+ E.pickaxe_ignore_case

@@
expression E;
@@
- E.DEFAULT_FOLLOW_RENAMES
+ E.default_follow_renames

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: remove DIFF_OPT_CLR macroBrandon Williams Tue, 31 Oct 2017 18:19:10 +0000 (11:19 -0700)

diff: remove DIFF_OPT_CLR macro

Remove the `DIFF_OPT_CLR` macro and instead set the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_CLR(&E, fld)
+ E.flags.fld = 0

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_CLR(ptr, fld)
+ ptr->flags.fld = 0

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: remove DIFF_OPT_SET macroBrandon Williams Tue, 31 Oct 2017 18:19:09 +0000 (11:19 -0700)

diff: remove DIFF_OPT_SET macro

Remove the `DIFF_OPT_SET` macro and instead set the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_SET(&E, fld)
+ E.flags.fld = 1

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_SET(ptr, fld)
+ ptr->flags.fld = 1

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: remove DIFF_OPT_TST macroBrandon Williams Tue, 31 Oct 2017 18:19:08 +0000 (11:19 -0700)

diff: remove DIFF_OPT_TST macro

Remove the `DIFF_OPT_TST` macro and instead access the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_TST(&E, fld)
+ E.flags.fld

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_TST(ptr, fld)
+ ptr->flags.fld

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: remove touched flagsBrandon Williams Tue, 31 Oct 2017 18:19:07 +0000 (11:19 -0700)

diff: remove touched flags

Now that the set of parallel touched flags are no longer being used,
remove them.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: add flag to indicate textconv was set via cmdlineBrandon Williams Tue, 31 Oct 2017 18:19:06 +0000 (11:19 -0700)

diff: add flag to indicate textconv was set via cmdline

git-show is unique in that it wants to use textconv by default except
for when it is showing blobs. When asked to show a blob, show doesn't
want to use textconv unless the user explicitly requested that it be
used by providing the command line flag '--textconv'.

Currently this is done by using a parallel set of 'touched' flags which
get set every time a particular flag is set or cleared. In a future
patch we want to eliminate this parallel set of flags so instead of
relying on if the textconv flag has been touched, add a new flag
'TEXTCONV_SET_VIA_CMDLINE' which is only set if textconv is set to true
via the command line.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: convert flags to be stored in bitfieldsBrandon Williams Tue, 31 Oct 2017 18:19:05 +0000 (11:19 -0700)

diff: convert flags to be stored in bitfields

We cannot add many more flags to the diff machinery due to the
limitations of the number of flags that can be stored in a single
unsigned int. In order to allow for more flags to be added to the diff
machinery in the future this patch converts the flags to be stored in
bitfields in 'struct diff_flags'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: use O_TRUNC to truncate filesRené Scharfe Tue, 31 Oct 2017 09:58:16 +0000 (10:58 +0100)

sequencer: use O_TRUNC to truncate files

Cut off any previous content of the file to be rewritten by passing the
flag O_TRUNC to open(2) instead of calling ftruncate(2) at the end.
That's easier and shorter.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: factor out rewrite_file()René Scharfe Tue, 31 Oct 2017 09:54:21 +0000 (10:54 +0100)

sequencer: factor out rewrite_file()

Reduce code duplication by extracting a function for rewriting an
existing file.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5580: add Cygwin supportAdam Dinwoodie Tue, 31 Oct 2017 13:19:03 +0000 (13:19 +0000)

t5580: add Cygwin support

t5580 tests that specifying Windows UNC paths works with Git. Cygwin
supports UNC paths, albeit only using forward slashes, not backslashes,
so run the compatible tests on Cygwin as well as MinGW.

The only complication is Cygwin's `pwd`, which returns a *nix-style
path, and that's not suitable for calculating the UNC path to the
current directory. Instead use Cygwin's `cygpath` utility to get the
Windows-style path.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: use hex_to_bytes()René Scharfe Tue, 31 Oct 2017 13:50:06 +0000 (14:50 +0100)

sha1_file: use hex_to_bytes()

The path of a loose object contains its hash value encoded into two
substrings of 2 and 38 hexadecimal digits separated by a slash. The
first part is handed to for_each_file_in_obj_subdir() in decoded form as
subdir_nr. The current code builds a full hexadecimal representation of
the hash in a temporary buffer, then uses get_oid_hex() to decode it.

Avoid the intermediate step by taking subdir_nr as-is and using
hex_to_bytes() directly on the second substring. That's shorter and
easier.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-push: use hex_to_bytes()René Scharfe Tue, 31 Oct 2017 13:49:56 +0000 (14:49 +0100)

http-push: use hex_to_bytes()

The path of a loose object contains its hash value encoded into two
substrings of hexadecimal digits, separated by a slash. The current
code copies the pieces into a temporary buffer to get rid of the slash
and then uses get_oid_hex() to decode the hash value.

Avoid the copy by using hex_to_bytes() directly on the substrings.
That's shorter and easier.

While at it correct the length of the second substring in a comment.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: move hex_to_bytes() to hex.c and export itRené Scharfe Tue, 31 Oct 2017 13:46:49 +0000 (14:46 +0100)

notes: move hex_to_bytes() to hex.c and export it

Make the function for converting pairs of hexadecimal digits to binary
available to other call sites.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: check GIT_MERGE_VERBOSITY only onceAndrey Okoshkin Tue, 31 Oct 2017 09:09:13 +0000 (12:09 +0300)

merge-recursive: check GIT_MERGE_VERBOSITY only once

Get rid of the duplicated getenv('GIT_MERGE_VERBOSITY') calls with the same
constant string argument. This makes code more readable and prevents typo in
the further development.

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add, reset: use DIFF_OPT_SET macro to set a diff flagBrandon Williams Mon, 30 Oct 2017 19:46:43 +0000 (12:46 -0700)

add, reset: use DIFF_OPT_SET macro to set a diff flag

Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG'
flag, use the 'DIFF_OPT_SET' macro.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: test ignored modesJameson Miller Mon, 30 Oct 2017 17:21:40 +0000 (13:21 -0400)

status: test ignored modes

Add tests around status reporting ignord files that match an exclude
pattern for both --untracked-files=normal and --untracked-files=all.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: document options to show matching ignored filesJameson Miller Mon, 30 Oct 2017 17:21:39 +0000 (13:21 -0400)

status: document options to show matching ignored files

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: report matching ignored and normal untrackedJameson Miller Mon, 30 Oct 2017 17:21:38 +0000 (13:21 -0400)

status: report matching ignored and normal untracked

Teach status command to handle `--ignored=matching` with
`--untracked-files=normal`

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: add option to show ignored files differentlyJameson Miller Mon, 30 Oct 2017 17:21:37 +0000 (13:21 -0400)

status: add option to show ignored files differently

Teach the status command more flexibility in how ignored files are
reported. Currently, the reporting of ignored files and untracked
files are linked. You cannot control how ignored files are reported
independently of how untracked files are reported (i.e. `all` vs
`normal`). This makes it impossible to show untracked files with the
`all` option, but show ignored files with the `normal` option.

This work 1) adds the ability to control the reporting of ignored
files independently of untracked files and 2) introduces the concept
of status reporting ignored paths that explicitly match an ignored
pattern. There are 2 benefits to these changes: 1) if a consumer needs
all untracked files but not all ignored files, there is a performance
benefit to not scanning all contents of an ignored directory and 2)
returning ignored files that explicitly match a path allow a consumer
to make more informed decisions about when a status result might be
stale.

This commit implements --ignored=matching with --untracked-files=all.
The following commit will implement --ignored=matching with
--untracked=files=normal.

As an example of where this flexibility could be useful is that our
application (Visual Studio) runs the status command and presents the
output. It shows all untracked files individually (e.g. using the
'--untracked-files==all' option), and would like to know about which
paths are ignored. It uses information about ignored paths to make
decisions about when the status result might have changed.
Additionally, many projects place build output into directories inside
a repository's working directory (e.g. in "bin/" and "obj/"
directories). Normal usage is to explicitly ignore these 2 directory
names in the .gitignore file (rather than or in addition to the *.obj
pattern).If an application could know that these directories are
explicitly ignored, it could infer that all contents are ignored as
well and make better informed decisions about files in these
directories. It could infer that any changes under these paths would
not affect the output of status. Additionally, there can be a
significant performance benefit by avoiding scanning through ignored
directories.

When status is set to report matching ignored files, it has the
following behavior. Ignored files and directories that explicitly
match an exclude pattern are reported. If an ignored directory matches
an exclude pattern, then the path of the directory is returned. If a
directory does not match an exclude pattern, but all of its contents
are ignored, then the contained files are reported instead of the
directory.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0000: check whether the shell supports the "local... Michael Haggerty Thu, 26 Oct 2017 08:18:53 +0000 (10:18 +0200)

t0000: check whether the shell supports the "local" keyword

Add a test balloon to see if we get complaints from anybody who is
using a shell that doesn't support the "local" keyword. If so, this
test can be reverted. If not, we might want to consider using "local"
in shell code throughout the git code base.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.15 v2.15.0Junio C Hamano Mon, 30 Oct 2017 05:00:44 +0000 (14:00 +0900)

Git 2.15

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

Documentation: enable compat-mode for Asciidoctorbrian m. carlson Sun, 29 Oct 2017 21:13:07 +0000 (21:13 +0000)

Documentation: enable compat-mode for Asciidoctor

Asciidoctor 1.5.0 and later have a compatibility mode that makes it more
compatible with some Asciidoc syntax, notably the single and double
quote handling. While this doesn't affect any of our current
documentation, it would be beneficial to enable this mode to reduce the
differences between AsciiDoc and Asciidoctor if we make use of those
features in the future.

Since this mode is specified as an attribute, if a version of
Asciidoctor doesn't understand it, it will simply be ignored.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

files-backend: don't rewrite the `packed-refs` file... Michael Haggerty Sat, 28 Oct 2017 09:16:02 +0000 (11:16 +0200)

files-backend: don't rewrite the `packed-refs` file unnecessarily

Even when we are deleting references, we needn't overwrite the
`packed-refs` file if the references that we are deleting only exist
as loose references. Implement this optimization as follows:

* Add a function `is_packed_transaction_needed()`, which checks
whether a given packed-refs transaction actually needs to be carried
out (i.e., it returns false if the transaction obviously wouldn't
have any effect). This function must be called while holding the
`packed-refs` lock to avoid races.

* Change `files_transaction_prepare()` to check whether the
packed-refs transaction is actually needed. If not, squelch it, but
continue holding the `packed-refs` lock until the end of the
transaction to avoid races.

This fixes a mild regression caused by dc39e09942 (files_ref_store:
use a transaction to update packed refs, 2017-09-08). Before that
commit, unnecessary rewrites of `packed-refs` were suppressed by
`repack_without_refs()`. But the transaction-based writing introduced
by that commit didn't perform that optimization.

Note that the pre-dc39e09942 code still had to *read* the whole
`packed-refs` file to determine that the rewrite could be skipped, so
the performance for the cases that the write could be elided was
`O(N)` in the number of packed references both before and after
dc39e09942. But after that commit the constant factor increased.

This commit reimplements the optimization of eliding unnecessary
`packed-refs` rewrites. That, plus the fact that since
cfa2e29c34 (packed_ref_store: get rid of the `ref_cache` entirely,
2017-03-17) we don't necessarily have to read the whole `packed-refs`
file at all, means that deletes of one or a few loose references can
now be done with `O(n lg N)` effort, where `n` is the number of loose
references being deleted and `N` is the total number of packed
references.

This commit fixes two tests in t1409.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'l10n-2.15.0-rnd2.1' of git://github.com... Junio C Hamano Mon, 30 Oct 2017 00:32:54 +0000 (09:32 +0900)

Merge tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po

l10n for Git 2.15.0 round 2 with Catalan updates

* tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po:
l10n: Update Catalan translation

l10n: Update Catalan translationJordi Mas Wed, 25 Oct 2017 17:50:59 +0000 (19:50 +0200)

l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>

diff: fix lstat() error handling in diff_populate_files... Andrey Okoshkin Fri, 27 Oct 2017 09:33:25 +0000 (12:33 +0300)

diff: fix lstat() error handling in diff_populate_filespec()

Add lstat() error handling not only for ENOENT case.
Otherwise uninitialised 'struct stat st' variable is used later in case of
lstat() non-ENOENT failure which leads to processing of rubbish values of
file mode ('S_ISLNK(st.st_mode)' check) or size ('xsize_t(st.st_size)').

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'bc/object-id' into baseMichael Haggerty Sat, 28 Oct 2017 07:27:15 +0000 (09:27 +0200)

Merge branch 'bc/object-id' into base

Hopefully final batch before 2.15Junio C Hamano Sat, 28 Oct 2017 01:20:30 +0000 (10:20 +0900)

Hopefully final batch before 2.15

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

Merge branch 'sg/rev-list-doc-reorder-fix'Junio C Hamano Sat, 28 Oct 2017 01:18:42 +0000 (10:18 +0900)

Merge branch 'sg/rev-list-doc-reorder-fix'

Doc flow fix.

* sg/rev-list-doc-reorder-fix:
rev-list-options.txt: use correct directional reference

Merge branch 'sb/rev-parse-show-superproject-root'Junio C Hamano Sat, 28 Oct 2017 01:18:40 +0000 (10:18 +0900)

Merge branch 'sb/rev-parse-show-superproject-root'

Doc markup fix.

* sb/rev-parse-show-superproject-root:
docs: fix formatting of rev-parse's --show-superproject-working-tree

Merge branch 'ao/path-use-xmalloc'Junio C Hamano Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)

Merge branch 'ao/path-use-xmalloc'

A possible oom error is now caught as a fatal error, instead of
continuing and dereferencing NULL.

* ao/path-use-xmalloc:
path.c: use xmalloc() in add_to_trie()

Merge branch 'np/config-path-doc'Junio C Hamano Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)

Merge branch 'np/config-path-doc'

Doc update.

* np/config-path-doc:
config doc: clarify "git config --path" example

docs: fix formatting of rev-parse's --show-superproject... Sebastian Schuberth Thu, 26 Oct 2017 11:53:37 +0000 (11:53 +0000)

docs: fix formatting of rev-parse's --show-superproject-working-tree

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list-options.txt: use correct directional referenceSZEDER Gábor Thu, 26 Oct 2017 15:26:37 +0000 (17:26 +0200)

rev-list-options.txt: use correct directional reference

The descriptions of the options '--parents', '--children' and
'--graph' say "see 'History Simplification' below", although the
referred section is in fact above the description of these options.

Send readers in the right direction by saying "above" instead of
"below".

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t1409: check that `packed-refs` is not rewritten unnece... Michael Haggerty Wed, 25 Oct 2017 09:53:20 +0000 (11:53 +0200)

t1409: check that `packed-refs` is not rewritten unnecessarily

There is no need to rewrite the `packed-refs` file except for the case
that we are deleting a reference that has a packed version. Verify
that `packed-refs` is not rewritten when it shouldn't be.

In fact, two of these tests fail:

* A new (empty) `packed-refs` file is created when deleting any loose
reference and no `packed-refs` file previously existed.

* The `packed-refs` file is rewritten unnecessarily when deleting a
loose reference that has no packed counterpart.

Both problems will be fixed in the next commit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: remove now superfluos help for "stash push"Thomas Gummerer Sun, 22 Oct 2017 17:04:09 +0000 (18:04 +0100)

stash: remove now superfluos help for "stash push"

With the 'git stash save' interface, it was easily possible for users to
try to add a message which would start with "-", which 'git stash save'
would interpret as a command line argument, and fail. For this case we
added some extra help on how to create a stash with a message starting
with "-".

For 'stash push', messages are passed with the -m flag, avoiding this
potential pitfall. Now only pathspecs starting with "-" would have to
be distinguished from command line parameters by using
"-- --<pathspec>". This is fairly common in the git command line
interface, and we don't try to guess what the users wanted in the other
cases.

Because this way of passing pathspecs is quite common in other git
commands, and we don't provide any extra help there, do the same in the
error message for 'git stash push'.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: mark "git stash save" deprecated in the man... Thomas Gummerer Sun, 22 Oct 2017 17:04:08 +0000 (18:04 +0100)

stash: mark "git stash save" deprecated in the man page

'git stash push' fixes a historical wart in the interface of 'git stash
save'. As 'git stash push' has all functionality of 'git stash save',
with a nicer, more consistent user interface deprecate 'git stash
save'. To do this, remove it from the synopsis of the man page, and
move it to a separate section, stating that it is deprecated.

Helped-by: Robert P. J. Day <rpjday@crashcourse.ca>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: replace "git stash save" with "git stash push... Thomas Gummerer Sun, 22 Oct 2017 17:04:07 +0000 (18:04 +0100)

stash: replace "git stash save" with "git stash push" in the documentation

"git stash push" is the newer interface for creating a stash. While we
are still keeping "git stash save" around for the time being, it's better
to point new users of "git stash" to the more modern (and more feature
rich) interface, instead of teaching them the older version that we
might want to phase out in the future.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mh/ref-locking-fix'Junio C Hamano Thu, 26 Oct 2017 03:29:23 +0000 (12:29 +0900)

Merge branch 'mh/ref-locking-fix'

Transactions to update multiple references that involves a deletion
was quite broken in an error codepath and did not abort everything
correctly.

* mh/ref-locking-fix:
files_transaction_prepare(): fix handling of ref lock failure
t1404: add a bunch of tests of D/F conflicts

status: do not get confused by submodules in excluded... Johannes Schindelin Wed, 25 Oct 2017 20:40:40 +0000 (22:40 +0200)

status: do not get confused by submodules in excluded directories

We meticulously pass the `exclude` flag to the `treat_directory()`
function so that we can indicate that files in it are excluded rather
than untracked when recursing.

But we did not yet treat submodules the same way.

Because of that, `git status --ignored --untracked` with a submodule
`submodule` in a gitignored `tracked/` would show the submodule in the
"Untracked files" section, e.g.

On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)

tracked/submodule/

Ignored files:
(use "git add -f <file>..." to include in what will be committed)

tracked/submodule/initial.t

Instead, we would want it to show the submodule in the "Ignored files"
section:

On branch master
Ignored files:
(use "git add -f <file>..." to include in what will be committed)

tracked/submodule/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: get rid of duplicate implementationStefan Beller Wed, 25 Oct 2017 18:49:12 +0000 (11:49 -0700)

diff.c: get rid of duplicate implementation

The implementations in diff.c to detect moved lines needs to compare
strings and hash strings, which is implemented in that file, as well
as in the xdiff library.

Remove the rather recent implementation in diff.c and rely on the well
exercised code in the xdiff lib.

With this change the hash used for bucketing the strings for the moved
line detection changes from FNV32 (that is provided via the hashmaps
memhash) to DJB2 (which is used internally in xdiff). Benchmarks found
on the web[1] do not indicate that these hashes are different in
performance for readable strings.

[1] https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff-interface: export comparing and hashing stringsStefan Beller Wed, 25 Oct 2017 18:49:11 +0000 (11:49 -0700)

xdiff-interface: export comparing and hashing strings

This will turn out to be useful in a later patch.

xdl_recmatch is exported in xdiff/xutils.h, to be used by various
xdiff/*.c files, but not outside of xdiff/. This one makes it available
to the outside, too.

While at it, add documentation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: use xmalloc() in add_to_trie()Andrey Okoshkin Tue, 24 Oct 2017 15:15:05 +0000 (18:15 +0300)

path.c: use xmalloc() in add_to_trie()

Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps
and checks memory allocation result.

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add remaining flags to checkoutThomas Braun Tue, 24 Oct 2017 13:19:31 +0000 (15:19 +0200)

completion: add remaining flags to checkout

In the commits 1fc458d9 (builtin/checkout: add --recurse-submodules
switch, 2017-03-14), 08d595dc (checkout: add --ignore-skip-worktree-bits
in sparse checkout mode, 2013-04-13) and 32669671 (checkout: introduce
--detach synonym for "git checkout foo^{commit}", 2011-02-08) checkout
gained new flags but the completion was not updated, although these flags
are useful completions. Add them.

The flags --force and --ignore-other-worktrees are not added as they are
potentially dangerous.

The flags --progress and --no-progress are only useful for scripting and are
therefore also not included.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

files_transaction_prepare(): fix handling of ref lock... Michael Haggerty Tue, 24 Oct 2017 15:16:25 +0000 (17:16 +0200)

files_transaction_prepare(): fix handling of ref lock failure

Since dc39e09942 (files_ref_store: use a transaction to update packed
refs, 2017-09-08), failure to lock a reference has been handled
incorrectly by `files_transaction_prepare()`. If
`lock_ref_for_update()` fails in the lock-acquisition loop of that
function, it sets `ret` then breaks out of that loop. Prior to
dc39e09942, that was OK, because the only thing following the loop was
the cleanup code. But dc39e09942 added another blurb of code between
the loop and the cleanup. That blurb sometimes resets `ret` to zero,
making the cleanup code think that the locking was successful.

Specifically, whenever

* One or more reference deletions have been processed successfully in
the lock-acquisition loop. (Processing the first such reference
causes a packed-ref transaction to be initialized.)

* Then `lock_ref_for_update()` fails for a subsequent reference. Such
a failure can happen for a number of reasons, such as the old SHA-1
not being correct, lock contention, etc. This causes a `break` out
of the lock-acquisition loop.

* The `packed-refs` lock is acquired successfully and
`ref_transaction_prepare()` succeeds for the packed-ref transaction.
This has the effect of resetting `ret` back to 0, and making the
cleanup code think that lock acquisition was successful.

In that case, any reference updates that were processed prior to
breaking out of the loop would be carried out (loose and packed), but
the reference that couldn't be locked and any subsequent references
would silently be ignored.

This can easily cause data loss if, for example, the user was trying
to push a new name for an existing branch while deleting the old name.
After the push, the branch could be left unreachable, and could even
subsequently be garbage-collected.

This problem was noticed in the context of deleting one reference and
creating another in a single transaction, when the two references D/F
conflict with each other, like

git update-ref --stdin <<EOF
delete refs/foo
create refs/foo/bar HEAD
EOF

This triggers the above bug because the deletion is processed
successfully for `refs/foo`, then the D/F conflict causes
`lock_ref_for_update()` to fail when `refs/foo/bar` is processed. In
this case the transaction *should* fail, but instead it causes
`refs/foo` to be deleted without creating `refs/foo`. This could
easily result in data loss.

The fix is simple: instead of just breaking out of the loop, jump
directly to the cleanup code. This fixes some tests in t1404 that were
added in the previous commit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t1404: add a bunch of tests of D/F conflictsMichael Haggerty Tue, 24 Oct 2017 15:16:24 +0000 (17:16 +0200)

t1404: add a bunch of tests of D/F conflicts

It is currently not allowed, in a single transaction, to add one
reference and delete another reference if the two reference names D/F
conflict with each other (e.g., like `refs/foo/bar` and `refs/foo`).
The reason is that the code would need to take locks

$GIT_DIR/refs/foo.lock
$GIT_DIR/refs/foo/bar.lock

But the latter lock couldn't coexist with the loose reference file

$GIT_DIR/refs/foo

, because `$GIT_DIR/refs/foo` cannot be both a directory and a file at
the same time (hence the name "D/F conflict).

Add a bunch of tests that we cleanly reject such transactions.

In fact, many of the new tests currently fail. They will be fixed in
the next commit along with an explanation.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'l10n-2.15.0-rnd2' of git://github.com/git... Junio C Hamano Tue, 24 Oct 2017 02:44:52 +0000 (11:44 +0900)

Merge tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po

l10n for Git 2.15.0 round 2

* tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
l10n: zh_CN: review for git v2.15.0 l10n round 2
l10n: zh_CN: for git v2.15.0 l10n round 2
l10n: de.po: fix typos
l10n: de.po: translate 70 new messages
l10n: ru.po: update Russian translation
l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 round 2
l10n: sv.po: Update Swedish translation (3245t0f0u)
l10n: fr.po: v2.15.0 round 2
l10n: fr.po change translation of "First, rewinding"
l10n: fr.po fix some mistakes
l10n: Update Catalan translation
l10n: ko.po: Update Korean translation
l10n: es.po: v2.15.0 round 2
l10n: git.pot: v2.15.0 round 2 (2 new, 2 removed)
l10n: ru.po: update Russian translation
l10n: bg.po: Updated Bulgarian translation (3245t)
l10n: sv.po: Update Swedish translation (3245t0f0u)
l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0
l10n: es.po: Update translation v2.15.0 round 1
l10n: git.pot: v2.15.0 round 1 (68 new, 36 removed)
...

Merge branch 'jx/zh_CN-proposed' of github.com:jiangxin/gitJiang Xin Tue, 24 Oct 2017 02:11:48 +0000 (10:11 +0800)

Merge branch 'jx/zh_CN-proposed' of github.com:jiangxin/git

* 'jx/zh_CN-proposed' of github.com:jiangxin/git:
l10n: zh_CN: review for git v2.15.0 l10n round 2
l10n: zh_CN: for git v2.15.0 l10n round 2

l10n: zh_CN: review for git v2.15.0 l10n round 2Ray Chen Mon, 23 Oct 2017 16:17:59 +0000 (00:17 +0800)

l10n: zh_CN: review for git v2.15.0 l10n round 2

Signed-off-by: Ray Chen <oldsharp@gmail.com>

l10n: zh_CN: for git v2.15.0 l10n round 2Jiang Xin Sun, 8 Oct 2017 07:29:11 +0000 (15:29 +0800)

l10n: zh_CN: for git v2.15.0 l10n round 2

Translate 69 messages (3245t0f0u) for git v2.15.0-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>

Merge branch 'master' of https://github.com/ralfth... Jiang Xin Tue, 24 Oct 2017 01:56:09 +0000 (09:56 +0800)

Merge branch 'master' of https://github.com/ralfth/git-po-de

* 'master' of https://github.com/ralfth/git-po-de:
l10n: de.po: fix typos
l10n: de.po: translate 70 new messages

column: do not include pager.cJunio C Hamano Tue, 24 Oct 2017 01:11:18 +0000 (10:11 +0900)

column: do not include pager.c

Everything this file needs from the pager API (e.g. term_columns(),
pager_in_use()) is already declared in the header file it includes.

Noticed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: use filetest to allow ACLsGuillaume Castagnino Thu, 19 Oct 2017 07:32:46 +0000 (09:32 +0200)

gitweb: use filetest to allow ACLs

In commit 46a1385 (gitweb: skip unreadable subdirectories, 2017-07-18)
we forgot to handle non-unix ACLs as well. Fix this.

Signed-off-by: Guillaume Castagnino <casta@xwing.info>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/push.c: add push.pushOption configMarius Paliga Mon, 23 Oct 2017 11:44:49 +0000 (13:44 +0200)

builtin/push.c: add push.pushOption config

Push options need to be given explicitly, via the command line as "git
push --push-option <option>". Add the config option push.pushOption,
which is a multi-valued option, containing push options that are sent
by default.

When push options are set in the lower-priority configulation file
(e.g. /etc/gitconfig, or $HOME/.gitconfig), they can be unset later in
the more specific repository config by the empty string.

Add tests and update documentation as well.

Signed-off-by: Marius Paliga <marius.paliga@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: de.po: fix typosAndre Hinrichs Thu, 19 Oct 2017 06:25:25 +0000 (08:25 +0200)

l10n: de.po: fix typos

Signed-off-by: Andre Hinrichs <andre.hinrichs@gmx.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

l10n: de.po: translate 70 new messagesRalf Thielow Wed, 11 Oct 2017 10:48:48 +0000 (12:48 +0200)

l10n: de.po: translate 70 new messages

Translate 70 new messages came from git.pot update in 25eab542b
(l10n: git.pot: v2.15.0 round 1 (68 new, 36 removed)) and 9c07fab78
(l10n: git.pot: v2.15.0 round 2 (2 new, 2 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

Sync with 2.14.3Junio C Hamano Mon, 23 Oct 2017 05:54:30 +0000 (14:54 +0900)

Sync with 2.14.3

Git 2.14.3 v2.14.3Junio C Hamano Mon, 23 Oct 2017 05:44:17 +0000 (14:44 +0900)

Git 2.14.3

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

Merge branch 'jk/info-alternates-fix' into maintJunio C Hamano Mon, 23 Oct 2017 05:40:00 +0000 (14:40 +0900)

Merge branch 'jk/info-alternates-fix' into maint

A regression fix for 2.11 that made the code to read the list of
alternate object stores overrun the end of the string.

* jk/info-alternates-fix:
read_info_alternates: warn on non-trivial errors
read_info_alternates: read contents into strbuf

Merge branch 'jc/fetch-refspec-doc-update' into maintJunio C Hamano Mon, 23 Oct 2017 05:39:08 +0000 (14:39 +0900)

Merge branch 'jc/fetch-refspec-doc-update' into maint

"git fetch <there> <src>:<dst>" allows an object name on the <src>
side when the other side accepts such a request since Git v2.5, but
the documentation was left stale.

* jc/fetch-refspec-doc-update:
fetch doc: src side of refspec could be full SHA-1

Merge branch 'jk/write-in-full-fix' into maintJunio C Hamano Mon, 23 Oct 2017 05:37:21 +0000 (14:37 +0900)

Merge branch 'jk/write-in-full-fix' into maint

Many codepaths did not diagnose write failures correctly when disks
go full, due to their misuse of write_in_full() helper function,
which have been corrected.

* jk/write-in-full-fix:
read_pack_header: handle signed/unsigned comparison in read result
config: flip return value of store_write_*()
notes-merge: use ssize_t for write_in_full() return value
pkt-line: check write_in_full() errors against "< 0"
convert less-trivial versions of "write_in_full() != len"
avoid "write_in_full(fd, buf, len) != len" pattern
get-tar-commit-id: check write_in_full() return against 0
config: avoid "write_in_full(fd, buf, len) < len" pattern

Merge branch 'rj/no-sign-compare' into maintJunio C Hamano Mon, 23 Oct 2017 05:20:18 +0000 (14:20 +0900)

Merge branch 'rj/no-sign-compare' into maint

Many codepaths have been updated to squelch -Wsign-compare
warnings.

* rj/no-sign-compare:
ALLOC_GROW: avoid -Wsign-compare warnings
cache.h: hex2chr() - avoid -Wsign-compare warnings
commit-slab.h: avoid -Wsign-compare warnings
git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings

Merge branch 'ma/ts-cleanups' into maintJunio C Hamano Mon, 23 Oct 2017 05:19:02 +0000 (14:19 +0900)

Merge branch 'ma/ts-cleanups' into maint

Assorted bugfixes and clean-ups.

* ma/ts-cleanups:
ThreadSanitizer: add suppressions
strbuf_setlen: don't write to strbuf_slopbuf
pack-objects: take lock before accessing `remaining`
convert: always initialize attr_action in convert_attrs

Merge branch 'ls/travis-scriptify' into maintJunio C Hamano Mon, 23 Oct 2017 05:17:53 +0000 (14:17 +0900)

Merge branch 'ls/travis-scriptify' into maint

The scripts to drive TravisCI has been reorganized and then an
optimization to avoid spending cycles on a branch whose tip is
tagged has been implemented.

* ls/travis-scriptify:
travis-ci: fix "skip_branch_tip_with_tag()" string comparison
travis: dedent a few scripts that are indented overly deeply
travis-ci: skip a branch build if equal tag is present
travis-ci: move Travis CI code into dedicated scripts

Merge branch 'er/fast-import-dump-refs-on-checkpoint... Junio C Hamano Mon, 23 Oct 2017 05:17:27 +0000 (14:17 +0900)

Merge branch 'er/fast-import-dump-refs-on-checkpoint' into maint

The checkpoint command "git fast-import" did not flush updates to
refs and marks unless at least one object was created since the
last checkpoint, which has been corrected, as these things can
happen without any new object getting created.

* er/fast-import-dump-refs-on-checkpoint:
fast-import: checkpoint: dump branches/tags/marks even if object_count==0

Merge branch 'jt/fast-export-copy-modify-fix' into... Junio C Hamano Mon, 23 Oct 2017 05:14:51 +0000 (14:14 +0900)

Merge branch 'jt/fast-export-copy-modify-fix' into maint

"git fast-export" with -M/-C option issued "copy" instruction on a
path that is simultaneously modified, which was incorrect.

* jt/fast-export-copy-modify-fix:
fast-export: do not copy from modified file

Merge branch 'nd/worktree-kill-parse-ref' into maintJunio C Hamano Mon, 23 Oct 2017 05:14:16 +0000 (14:14 +0900)

Merge branch 'nd/worktree-kill-parse-ref' into maint

"git branch -M a b" while on a branch that is completely unrelated
to either branch a or branch b misbehaved when multiple worktree
was in use. This has been fixed.

* nd/worktree-kill-parse-ref:
branch: fix branch renaming not updating HEADs correctly