gitweb.git
object-store: move packed_git and packed_git_mru to... Stefan Beller Fri, 23 Mar 2018 17:20:59 +0000 (18:20 +0100)

object-store: move packed_git and packed_git_mru to object store

In a process with multiple repositories open, packfile accessors
should be associated to a single repository and not shared globally.
Move packed_git and packed_git_mru into the_repository and adjust
callers to reflect this.

[nd: while at there, wrap access to these two fields in get_packed_git()
and get_packed_git_mru(). This allows us to lazily initialize these
fields without caller doing that explicitly]

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

object-store: free alt_odb_listStefan Beller Fri, 23 Mar 2018 17:20:58 +0000 (18:20 +0100)

object-store: free alt_odb_list

Free the memory and reset alt_odb_{list, tail} to NULL.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

object-store: move alt_odb_list and alt_odb_tail to... Stefan Beller Fri, 23 Mar 2018 17:20:57 +0000 (18:20 +0100)

object-store: move alt_odb_list and alt_odb_tail to object store

In a process with multiple repositories open, alternates should be
associated to a single repository and not shared globally. Move
alt_odb_list and alt_odb_tail into the_repository and adjust callers
to reflect this.

Now that the alternative object data base is per repository, we're
leaking its memory upon freeing a repository. The next patch plugs
this hole.

No functional change intended.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

object-store: migrate alternates struct and functions... Stefan Beller Fri, 23 Mar 2018 17:20:56 +0000 (18:20 +0100)

object-store: migrate alternates struct and functions from cache.h

Migrate the struct alternate_object_database and all its related
functions to the object store as these functions are easier found in
that header. The migration is just a verbatim copy, no need to
include the object store header at any C file, because cache.h includes
repository.h which in turn includes the object-store.h

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository: introduce raw object store fieldStefan Beller Fri, 23 Mar 2018 17:20:55 +0000 (18:20 +0100)

repository: introduce raw object store field

The raw object store field will contain any objects needed for access
to objects in a given repository.

This patch introduces the raw object store and populates it with the
`objectdir`, which used to be part of the repository struct.

As the struct gains members, we'll also populate the function to clear
the memory for these members.

In a later step, we'll introduce a struct object_parser, that will
complement the object parsing in a repository struct: The raw object
parser is the layer that will provide access to raw object content,
while the higher level object parser code will parse raw objects and
keeps track of parenthood and other object relationships using 'struct
object'. For now only add the lower level to the repository struct.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository.h: add comment and clarify repo_set_gitdirNguyễn Thái Ngọc Duy Fri, 23 Mar 2018 15:55:23 +0000 (16:55 +0100)

repository.h: add comment and clarify repo_set_gitdir

The argument name "optional" may mislead the reader to think this
option could be NULL. But it can't be. While at there, document a bit
more about struct set_gitdir_args.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository: delete ignore_env memberNguyễn Thái Ngọc Duy Sat, 3 Mar 2018 11:35:58 +0000 (18:35 +0700)

repository: delete ignore_env member

This variable was added because the repo_set_gitdir() was created to
cover both submodule and main repos, but these two are initialized a
bit differently so ignore_env == 0 means main repo, while ignore_env
!= 0 is submodules.

Since the difference part (env variables) has been moved out of
repo_set_gitdir(), this function works the same way for both repo
types and ignore_env is not needed anymore.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file.c: move delayed getenv(altdb) back to setup_g... Nguyễn Thái Ngọc Duy Sat, 3 Mar 2018 11:35:57 +0000 (18:35 +0700)

sha1_file.c: move delayed getenv(altdb) back to setup_git_env()

getenv() is supposed to work on the main repository only. This delayed
getenv() code in sha1_file.c makes it more difficult to convert
sha1_file.c to a generic object store that could be used by both
submodule and main repositories.

Move the getenv() back in setup_git_env() where other env vars are
also fetched.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository.c: delete dead functionsNguyễn Thái Ngọc Duy Sat, 3 Mar 2018 11:35:56 +0000 (18:35 +0700)

repository.c: delete dead functions

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository.c: move env-related setup code back to envir... Nguyễn Thái Ngọc Duy Sat, 3 Mar 2018 11:35:55 +0000 (18:35 +0700)

repository.c: move env-related setup code back to environment.c

It does not make sense that generic repository code contains handling
of environment variables, which are specific for the main repository
only. Refactor repo_set_gitdir() function to take $GIT_DIR and
optionally _all_ other customizable paths. These optional paths can be
NULL and will be calculated according to the default directory layout.

Note that some dead functions are left behind to reduce diff
noise. They will be deleted in the next patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repository: initialize the_repository in main()Nguyễn Thái Ngọc Duy Sat, 3 Mar 2018 11:35:54 +0000 (18:35 +0700)

repository: initialize the_repository in main()

This simplifies initialization of struct repository and anything
inside. Easier to read. Easier to add/remove fields.

Everything will go through main() common-main.c so this should cover all
programs, including t/helper.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Second batch for 2.17Junio C Hamano Wed, 14 Feb 2018 00:22:16 +0000 (16:22 -0800)

Second batch for 2.17

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

Merge branch 'tz/doc-show-defaults-to-head'Junio C Hamano Tue, 13 Feb 2018 21:39:17 +0000 (13:39 -0800)

Merge branch 'tz/doc-show-defaults-to-head'

Doc update.

* tz/doc-show-defaults-to-head:
doc: mention 'git show' defaults to HEAD

Merge branch 'ew/svn-branch-segfault-fix'Junio C Hamano Tue, 13 Feb 2018 21:39:16 +0000 (13:39 -0800)

Merge branch 'ew/svn-branch-segfault-fix'

Workaround for segfault with more recent versions of SVN.

* ew/svn-branch-segfault-fix:
git-svn: control destruction order to avoid segfault

Merge branch 'sg/travis-linux32-sanity'Junio C Hamano Tue, 13 Feb 2018 21:39:16 +0000 (13:39 -0800)

Merge branch 'sg/travis-linux32-sanity'

Travis updates.

* sg/travis-linux32-sanity:
travis-ci: don't fail if user already exists on 32 bit Linux build job
travis-ci: don't run the test suite as root in the 32 bit Linux build
travis-ci: don't repeat the path of the cache directory
travis-ci: use 'set -e' in the 32 bit Linux build job
travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux build

Merge branch 'nd/list-merge-strategy'Junio C Hamano Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)

Merge branch 'nd/list-merge-strategy'

Completion of "git merge -s<strategy>" (in contrib/) did not work
well in non-C locale.

* nd/list-merge-strategy:
completion: fix completing merge strategies on non-C locales

Merge branch 'jt/long-running-process-doc'Junio C Hamano Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)

Merge branch 'jt/long-running-process-doc'

Doc updates.

* jt/long-running-process-doc:
Docs: split out long-running subprocess handshake

Merge branch 'jk/daemon-fixes'Junio C Hamano Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)

Merge branch 'jk/daemon-fixes'

Assorted fixes to "git daemon".

* jk/daemon-fixes:
daemon: fix length computation in newline stripping
t/lib-git-daemon: add network-protocol helpers
daemon: handle NULs in extended attribute string
daemon: fix off-by-one in logging extended attributes
t/lib-git-daemon: record daemon log
t5570: use ls-remote instead of clone for interp tests

Merge branch 'pw/sequencer-in-process-commit'Junio C Hamano Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)

Merge branch 'pw/sequencer-in-process-commit'

The sequencer infrastructure is shared across "git cherry-pick",
"git rebase -i", etc., and has always spawned "git commit" when it
needs to create a commit. It has been taught to do so internally,
when able, by reusing the codepath "git commit" itself uses, which
gives performance boost for a few tens of percents in some sample
scenarios.

* pw/sequencer-in-process-commit:
sequencer: run 'prepare-commit-msg' hook
t7505: add tests for cherry-pick and rebase -i/-p
t7505: style fixes
sequencer: assign only free()able strings to gpg_sign
sequencer: improve config handling
t3512/t3513: remove KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
sequencer: try to commit without forking 'git commit'
sequencer: load commit related config
sequencer: simplify adding Signed-off-by: trailer
commit: move print_commit_summary() to libgit
commit: move post-rewrite code to libgit
Add a function to update HEAD after creating a commit
commit: move empty message checks to libgit
t3404: check intermediate squash messages

Merge branch 'nd/shared-index-fix'Junio C Hamano Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)

Merge branch 'nd/shared-index-fix'

Code clean-up.

* nd/shared-index-fix:
read-cache: don't write index twice if we can't write shared index
read-cache.c: move tempfile creation/cleanup out of write_shared_index
read-cache.c: change type of "temp" in write_shared_index()

Merge branch 'po/http-push-error-message'Junio C Hamano Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)

Merge branch 'po/http-push-error-message'

Debugging aid.

* po/http-push-error-message:
http-push: improve error log

Merge branch 'po/clang-format-functype-weight'Junio C Hamano Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)

Merge branch 'po/clang-format-functype-weight'

Prevent "clang-format" from breaking line after function return type.

* po/clang-format-functype-weight:
clang-format: adjust penalty for return type line break

Merge branch 'jc/mailinfo-cleanup-fix'Junio C Hamano Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)

Merge branch 'jc/mailinfo-cleanup-fix'

Corner case bugfix.

* jc/mailinfo-cleanup-fix:
mailinfo: avoid segfault when can't open files

Merge branch 'sg/cocci-move-array'Junio C Hamano Tue, 13 Feb 2018 21:39:13 +0000 (13:39 -0800)

Merge branch 'sg/cocci-move-array'

Code clean-up.

* sg/cocci-move-array:
Use MOVE_ARRAY

Merge branch 'tg/split-index-fixes'Junio C Hamano Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -0800)

Merge branch 'tg/split-index-fixes'

The split-index mode had a few corner case bugs fixed.

* tg/split-index-fixes:
travis: run tests with GIT_TEST_SPLIT_INDEX
split-index: don't write cache tree with null oid entries
read-cache: fix reading the shared index for other repos

Merge branch 'rs/strbuf-cocci-workaround'Junio C Hamano Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -0800)

Merge branch 'rs/strbuf-cocci-workaround'

Update Coccinelle rules to catch and optimize strbuf_addf(&buf, "%s", str)

* rs/strbuf-cocci-workaround:
cocci: use format keyword instead of a literal string

Merge branch 'mr/packed-ref-store-fix'Junio C Hamano Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)

Merge branch 'mr/packed-ref-store-fix'

Crash fix for a corner case where an error codepath tried to unlock
what it did not acquire lock on.

* mr/packed-ref-store-fix:
files_initial_transaction_commit(): only unlock if locked

Merge branch 'jt/http-redact-cookies'Junio C Hamano Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)

Merge branch 'jt/http-redact-cookies'

The http tracing code, often used to debug connection issues,
learned to redact potentially sensitive information from its output
so that it can be more safely sharable.

* jt/http-redact-cookies:
http: support omitting data from traces
http: support cookie redaction when tracing

Merge branch 'ds/use-get-be64'Junio C Hamano Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)

Merge branch 'ds/use-get-be64'

Code clean-up.

* ds/use-get-be64:
packfile: use get_be64() for large offsets

Merge branch 'cc/sha1-file-name'Junio C Hamano Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)

Merge branch 'cc/sha1-file-name'

Code clean-up.

* cc/sha1-file-name:
sha1_file: improve sha1_file_name() perfs
sha1_file: remove static strbuf from sha1_file_name()

Merge branch 'nd/trace-with-env'Junio C Hamano Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)

Merge branch 'nd/trace-with-env'

The tracing machinery learned to report tweaking of environment
variables as well.

* nd/trace-with-env:
run-command.c: print new cwd in trace_run_command()
run-command.c: print env vars in trace_run_command()
run-command.c: print program 'git' when tracing git_cmd mode
run-command.c: introduce trace_run_command()
trace.c: move strbuf_release() out of print_trace_line()
trace: avoid unnecessary quoting
sq_quote_argv: drop maxlen parameter

Merge branch 'pc/submodule-helper'Junio C Hamano Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)

Merge branch 'pc/submodule-helper'

Rewrite two more "git submodule" subcommands in C.

* pc/submodule-helper:
submodule: port submodule subcommand 'deinit' from shell to C
submodule: port submodule subcommand 'sync' from shell to C

Merge branch 'rb/hashmap-h-compilation-fix'Junio C Hamano Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)

Merge branch 'rb/hashmap-h-compilation-fix'

Code clean-up.

* rb/hashmap-h-compilation-fix:
hashmap.h: remove unused variable

Merge branch 'nd/diff-flush-before-warning'Junio C Hamano Tue, 13 Feb 2018 21:39:09 +0000 (13:39 -0800)

Merge branch 'nd/diff-flush-before-warning'

Avoid showing a warning message in the middle of a line of "git
diff" output.

* nd/diff-flush-before-warning:
diff.c: flush stdout before printing rename warnings

Merge branch 'tb/crlf-conv-flags'Junio C Hamano Tue, 13 Feb 2018 21:39:08 +0000 (13:39 -0800)

Merge branch 'tb/crlf-conv-flags'

Code clean-up.

* tb/crlf-conv-flags:
convert_to_git(): safe_crlf/checksafe becomes int conv_flags

Merge branch 'rs/describe-unique-abbrev'Junio C Hamano Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)

Merge branch 'rs/describe-unique-abbrev'

Code clean-up.

* rs/describe-unique-abbrev:
describe: use strbuf_add_unique_abbrev() for adding short hashes

Merge branch 'ks/submodule-doc-updates'Junio C Hamano Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)

Merge branch 'ks/submodule-doc-updates'

Doc updates.

* ks/submodule-doc-updates:
Doc/git-submodule: improve readability and grammar of a sentence
Doc/gitsubmodules: make some changes to improve readability and syntax

Merge branch 'cl/t9001-cleanup'Junio C Hamano Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)

Merge branch 'cl/t9001-cleanup'

Test clean-up.

* cl/t9001-cleanup:
t9001: use existing helper in send-email test

Merge branch 'gs/retire-mru'Junio C Hamano Tue, 13 Feb 2018 21:39:06 +0000 (13:39 -0800)

Merge branch 'gs/retire-mru'

Retire mru API as it does not give enough abstraction over
underlying list API to be worth it.

* gs/retire-mru:
mru: Replace mru.[ch] with list.h implementation

Merge branch 'ot/mru-on-list'Junio C Hamano Tue, 13 Feb 2018 21:39:05 +0000 (13:39 -0800)

Merge branch 'ot/mru-on-list'

The first step to getting rid of mru API and using the
doubly-linked list API directly instead.

* ot/mru-on-list:
mru: use double-linked list from list.h

Merge branch 'jh/partial-clone'Junio C Hamano Tue, 13 Feb 2018 21:39:04 +0000 (13:39 -0800)

Merge branch 'jh/partial-clone'

The machinery to clone & fetch, which in turn involves packing and
unpacking objects, have been told how to omit certain objects using
the filtering mechanism introduced by the jh/object-filtering
topic, and also mark the resulting pack as a promisor pack to
tolerate missing objects, taking advantage of the mechanism
introduced by the jh/fsck-promisors topic.

* jh/partial-clone:
t5616: test bulk prefetch after partial fetch
fetch: inherit filter-spec from partial clone
t5616: end-to-end tests for partial clone
fetch-pack: restore save_commit_buffer after use
unpack-trees: batch fetching of missing blobs
clone: partial clone
partial-clone: define partial clone settings in config
fetch: support filters
fetch: refactor calculation of remote list
fetch-pack: test support excluding large blobs
fetch-pack: add --no-filter
fetch-pack, index-pack, transport: partial clone
upload-pack: add object filtering for partial clone

Merge branch 'jh/fsck-promisors'Junio C Hamano Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)

Merge branch 'jh/fsck-promisors'

In preparation for implementing narrow/partial clone, the machinery
for checking object connectivity used by gc and fsck has been
taught that a missing object is OK when it is referenced by a
packfile specially marked as coming from trusted repository that
promises to make them available on-demand and lazily.

* jh/fsck-promisors:
gc: do not repack promisor packfiles
rev-list: support termination at promisor objects
sha1_file: support lazily fetching missing objects
introduce fetch-object: fetch one promisor object
index-pack: refactor writing of .keep files
fsck: support promisor objects as CLI argument
fsck: support referenced promisor objects
fsck: support refs pointing to promisor objects
fsck: introduce partialclone extension
extension.partialclone: introduce partial clone extension

Merge branch 'ab/simplify-perl-makefile'Junio C Hamano Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)

Merge branch 'ab/simplify-perl-makefile'

The build procedure for perl/ part has been greatly simplified by
weaning ourselves off of MakeMaker.

* ab/simplify-perl-makefile:
perl: treat PERLLIB_EXTRA as an extra path again
perl: avoid *.pmc and fix Error.pm further
Makefile: replace perl/Makefile.PL with simple make rules

travis-ci: don't fail if user already exists on 32... SZEDER Gábor Mon, 29 Jan 2018 17:17:13 +0000 (18:17 +0100)

travis-ci: don't fail if user already exists on 32 bit Linux build job

The 32 bit Linux build job runs in a Docker container, which lends
itself to running and debugging locally, too. Especially during
debugging one usually doesn't want to start with a fresh container
every time, to save time spent on installing a bunch of dependencies.
However, that doesn't work quite smootly, because the script running
in the container always creates a new user, which then must be removed
every time before subsequent executions, or the build script fails.

Make this process more convenient and don't try to create that user if
it already exists and has the right user ID in the container, so
developers don't have to bother with running a 'userdel' each time
before they run the build script.

The build job on Travis CI always starts with a fresh Docker
container, so this change doesn't make a difference there.

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

travis-ci: don't run the test suite as root in the... SZEDER Gábor Mon, 29 Jan 2018 17:17:12 +0000 (18:17 +0100)

travis-ci: don't run the test suite as root in the 32 bit Linux build

Travis CI runs the 32 bit Linux build job in a Docker container, where
all commands are executed as root by default. Therefore, ever since
we added this build job in 88dedd5e7 (Travis: also test on 32-bit
Linux, 2017-03-05), we have a bit of code to create a user in the
container matching the ID of the host user and then to run the test
suite as this user. Matching the host user ID is important, because
otherwise the host user would have no access to any files written by
processes running in the container, notably the logs of failed tests
couldn't be included in the build job's trace log.

Alas, this piece of code never worked, because it sets the variable
holding the user name ($CI_USER) in a subshell, meaning it doesn't
have any effect by the time we get to the point to actually use the
variable to switch users with 'su'. So all this time we were running
the test suite as root.

Reorganize that piece of code in 'ci/run-linux32-build.sh' a bit to
avoid that problematic subshell and to ensure that we switch to the
right user. Furthermore, make the script's optional host user ID
option mandatory, so running the build accidentally as root will
become harder when debugging locally. If someone really wants to run
the test suite as root, whatever the reasons might be, it'll still be
possible to do so by explicitly passing '0' as host user ID.

Finally, one last catch: since commit 7e72cfcee (travis-ci: save prove
state for the 32 bit Linux build, 2017-12-27) the 'prove' test harness
has been writing its state to the Travis CI cache directory from
within the Docker container while running as root. After this patch
'prove' will run as a regular user, so in future build jobs it won't
be able overwrite a previously written, still root-owned state file,
resulting in build job failures. To resolve this we should manually
delete caches containing such root-owned files, but that would be a
hassle. Instead, work this around by changing the owner of the whole
contents of the cache directory to the host user ID.

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

travis-ci: don't repeat the path of the cache directorySZEDER Gábor Mon, 29 Jan 2018 17:17:11 +0000 (18:17 +0100)

travis-ci: don't repeat the path of the cache directory

Some of our 'ci/*' scripts repeat the name or full path of the Travis
CI cache directory, and the following patches will add new places
using that path.

Use a variable to refer to the path of the cache directory instead, so
it's hard-coded only in a single place.

Pay extra attention to the 32 bit Linux build: it runs in a Docker
container, so pass the path of the cache directory from the host to
the container in an environment variable. Note that an environment
variable passed this way is exported inside the container, therefore
its value is directly available in the 'su' snippet even though that
snippet is single quoted. Furthermore, use the variable in the
container only if it's been assigned a non-empty value, to prevent
errors when someone is running or debugging the Docker build locally,
because in that case the variable won't be set as there won't be any
Travis CI cache.

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

travis-ci: use 'set -e' in the 32 bit Linux build jobSZEDER Gábor Mon, 29 Jan 2018 17:17:10 +0000 (18:17 +0100)

travis-ci: use 'set -e' in the 32 bit Linux build job

The script 'ci/run-linux32-build.sh' running inside the Docker
container of the 32 bit Linux build job uses an && chain to break the
build if one of the commands fails. This is problematic for two
reasons:

- The && chain is broken, because there is this in the middle:

test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&

Luckily it is broken in a way that it didn't lead to false
successes. If installing dependencies fails, then the rest of the
first && chain is skipped and execution resumes after the ||
operator. At that point $HOST_UID is still unset, causing
'useradd' to error out with "invalid user ID 'ci'", which in turn
causes the second && chain to abort the script and thus break the
build.

- All other 'ci/*' scripts use 'set -e' to break the build if one of
the commands fails. This inconsistency among these scripts is
asking for trouble: I forgot about the && chain more than once
while working on this patch series.

Enable 'set -e' for the whole script and for the commands executed
under 'su' as well.

While touching every line in the 'su' command block anyway, change
their indentation to use a tab instead of spaces.

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

travis-ci: use 'set -x' for the commands under 'su... SZEDER Gábor Mon, 29 Jan 2018 17:17:09 +0000 (18:17 +0100)

travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux build

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

git-svn: control destruction order to avoid segfaultEric Wong Mon, 29 Jan 2018 23:11:07 +0000 (23:11 +0000)

git-svn: control destruction order to avoid segfault

It seems necessary to control destruction ordering to avoid a
segfault with SVN 1.9.5 when using "git svn branch". I've also
reported the problem against libsvn-perl to Debian [Bug #888791],
but releasing the SVN::Client instance can be beneficial anyways to
save memory.

ref: https://bugs.debian.org/888791
Tested-by: Todd Zullinger <tmz@pobox.com>
Reported-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: mention 'git show' defaults to HEADTodd Zullinger Sun, 28 Jan 2018 19:16:07 +0000 (14:16 -0500)

doc: mention 'git show' defaults to HEAD

When 'git show' is called without any object it defaults to HEAD. This
has been true since d4ed9793fd ("Simplify common default options setup
for built-in log family.", 2006-04-16).

The SYNOPSIS suggests that the object argument is required. Clarify
that it is not required and note the default.

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

completion: fix completing merge strategies on non... Duy Nguyen Fri, 26 Jan 2018 01:31:42 +0000 (08:31 +0700)

completion: fix completing merge strategies on non-C locales

The anchor string "Available strategies are:" is translatable so
__git_list_merge_strategies may fail to collect available strategies
from 'git merge' on non-C locales. Force C locale on this command.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: fix length computation in newline strippingJeff King Thu, 25 Jan 2018 00:58:54 +0000 (19:58 -0500)

daemon: fix length computation in newline stripping

When git-daemon gets a pktline request, we strip off any
trailing newline, replacing it with a NUL. Clients prior to
5ad312bede (in git v1.4.0) would send:

git-upload-pack repo.git\n

and we need to strip it off to understand their request.
After 5ad312bede, we send the host attribute but no newline,
like:

git-upload-pack repo.git\0host=example.com\0

Both of these are parsed correctly by git-daemon. But if
some client were to combine the two:

git-upload-pack repo.git\n\0host=example.com\0

we don't parse it correctly. The problem is that we use the
"len" variable to record the position of the NUL separator,
but then decrement it when we strip the newline. So we start
with:

git-upload-pack repo.git\n\0host=example.com\0
^-- len

and end up with:

git-upload-pack repo.git\0\0host=example.com\0
^-- len

This is arguably correct, since "len" tells us the length of
the initial string, but we don't actually use it for that.
What we do use it for is finding the offset of the extended
attributes; they used to be at len+1, but are now at len+2.

We can solve that by just leaving "len" where it is. We
don't have to care about the length of the shortened string,
since we just treat it like a C string.

No version of Git ever produced such a string, but it seems
like the daemon code meant to handle this case (and it seems
like a reasonable thing for somebody to do in a 3rd-party
implementation).

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

t/lib-git-daemon: add network-protocol helpersJeff King Thu, 25 Jan 2018 00:58:19 +0000 (19:58 -0500)

t/lib-git-daemon: add network-protocol helpers

All of our git-protocol tests rely on invoking the client
and having it make a request of a server. That gives a nice
real-world test of how the two behave together, but it
doesn't leave any room for testing how a server might react
to _other_ clients.

Let's add a few test helper functions which can be used to
manually conduct a git-protocol conversation with a remote
git-daemon:

1. To connect to a remote git-daemon, we need something
like "netcat". But not everybody will have netcat. And
even if they do, the behavior with respect to
half-duplex shutdowns is not portable (openbsd netcat
has "-N", with others you must rely on "-q 1", which is
racy).

Here we provide a "fake_nc" that is capable of doing
a client-side netcat, with sane half-duplex semantics.
It relies on perl's IO::Socket::INET. That's been in
the base distribution since 5.6.0, so it's probably
available everywhere. But just to be on the safe side,
we'll add a prereq.

2. To help tests speak and read pktline, this patch adds
packetize() and depacketize() functions.

I've put fake_nc() into lib-git-daemon.sh, since that's
really the only server where we'd need to use a network
socket. Whereas the pktline helpers may be of more general
use, so I've added them to test-lib-functions.sh. Programs
like upload-pack speak pktline, but can talk directly over
stdio without a network socket.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: handle NULs in extended attribute stringJeff King Thu, 25 Jan 2018 00:56:20 +0000 (19:56 -0500)

daemon: handle NULs in extended attribute string

If we receive a request with extended attributes after the
NUL, we try to write those attributes to the log. We do so
with a "%s" format specifier, which will only show
characters up to the first NUL.

That's enough for printing a "host=" specifier. But since
dfe422d04d (daemon: recognize hidden request arguments,
2017-10-16) we may have another NUL, followed by protocol
parameters, and those are not logged at all.

Let's cut out the attempt to show the whole string, and
instead log when we parse individual attributes. We could
leave the "extended attributes (%d bytes) exist" part of the
log, which in theory could alert us to attributes that fail
to parse. But anything we don't parse as a "host=" parameter
gets blindly added to the "protocol" attribute, so we'd see
it in that part of the log.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: fix off-by-one in logging extended attributesJeff King Thu, 25 Jan 2018 00:56:07 +0000 (19:56 -0500)

daemon: fix off-by-one in logging extended attributes

If receive a request like:

git-upload-pack /foo.git\0host=localhost

we mark the offset of the NUL byte as "len", and then log
the bytes after the NUL with a "%.*s" placeholder, using
"pktlen - len" as the length, and "line + len + 1" as the
start of the string.

This is off-by-one, since the start of the string skips past
the separating NUL byte, but the adjusted length includes
it. Fortunately this doesn't actually read past the end of
the buffer, since "%.*s" will stop when it hits a NUL. And
regardless of what is in the buffer, packet_read() will
always add an extra NUL terminator for safety.

As an aside, the git.git client sends an extra NUL after a
"host" field, too, so we'd generally hit that one first, not
the one added by packet_read(). You can see this in the test
output which reports 15 bytes, even though the string has
only 14 bytes of visible data. But the point is that even a
client sending unusual data could not get us to read past
the end of the buffer, so this is purely a cosmetic fix.

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

t/lib-git-daemon: record daemon logJeff King Thu, 25 Jan 2018 19:16:41 +0000 (14:16 -0500)

t/lib-git-daemon: record daemon log

When we start git-daemon for our tests, we send its stderr
log stream to a named pipe. We synchronously read the first
line to make sure that the daemon started, and then dump the
rest to descriptor 4. This is handy for debugging test
output with "--verbose", but the tests themselves can't
access the log data.

Let's dump the log into a file, as well, so that future
tests can check the log. There are a few subtleties worth
calling out here:

- we'll continue to send output to descriptor 4 for
viewing/debugging, which would imply swapping out "cat"
for "tee". But we want to ensure that there's no
buffering, and "tee" doesn't have a standard way to
ask for that. So we'll use a shell loop around "read"
and "printf" instead. That ensures that after a request
has been served, the matching log entries will have made
it to the file.

- the existing first-line shell loop used read/echo. We'll
switch to consistently using "read -r" and "printf" to
relay data as faithfully as possible.

- we open the logfile for append, rather than just output.
That makes it OK for tests to truncate the logfile
without restarting the daemon (the OS will atomically
seek to the end of the file when outputting each line).
That allows tests to look at the log without worrying
about pollution from earlier tests.

Helped-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Docs: split out long-running subprocess handshakeJonathan Tan Thu, 25 Jan 2018 18:53:24 +0000 (10:53 -0800)

Docs: split out long-running subprocess handshake

Separating out the implementation of the handshake when starting a
long-running subprocess (for example, as is done for a clean/smudge
filter) was done in commit fa64a2fdbeed ("sub-process: refactor
handshake to common function", 2017-07-26), but its documentation still
resides in gitattributes. Split out the documentation as well.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5570: use ls-remote instead of clone for interp testsJeff King Thu, 25 Jan 2018 00:55:05 +0000 (19:55 -0500)

t5570: use ls-remote instead of clone for interp tests

We don't actually care about the clone operation here; we
just want to know if we were able to actually contact the
remote repository. Using ls-remote does that more
efficiently, and without us having to worry about managing
the tmp.git directory.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-push: improve error logPatryk Obara Wed, 24 Jan 2018 11:11:53 +0000 (12:11 +0100)

http-push: improve error log

When git push fails due to server-side WebDAV error, it's not easy to
point to the main culprit. Additional information about exact cURL
error and HTTP server response is helpful for debugging purpose.

New error log helped me pinpoint failing test t5540-http-push-webdav
to a missing Apache dependency in Fedora 27:
https://bugzilla.redhat.com/show_bug.cgi?id=1491151

Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clang-format: adjust penalty for return type line breakPatryk Obara Wed, 24 Jan 2018 11:11:54 +0000 (12:11 +0100)

clang-format: adjust penalty for return type line break

The penalty of 5 makes clang-format very eager to put even short type
declarations (e.g. "extern int") into a separate line, even when
breaking parameters list is sufficient.

Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: run 'prepare-commit-msg' hookPhillip Wood Wed, 24 Jan 2018 12:34:22 +0000 (12:34 +0000)

sequencer: run 'prepare-commit-msg' hook

Commit 356ee4659b ("sequencer: try to commit without forking 'git
commit'", 2017-11-24) forgot to run the 'prepare-commit-msg' hook when
creating the commit. Fix this by writing the commit message to a
different file and running the hook. Using a different file means that
if the commit is cancelled the original message file is
unchanged. Also move the checks for an empty commit so the order
matches 'git commit'.

Reported-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7505: add tests for cherry-pick and rebase -i/-pPhillip Wood Wed, 24 Jan 2018 12:34:21 +0000 (12:34 +0000)

t7505: add tests for cherry-pick and rebase -i/-p

Check that cherry-pick and rebase call the 'prepare-commit-msg' hook
correctly. The expected values for the hook arguments are taken to
match the current master branch. I think there is scope for improving
the arguments passed so they make a bit more sense - for instance
cherry-pick currently passes different arguments depending on whether
the commit message is being edited. Also the arguments for rebase
could be improved. Commit 7c4188360ac ("rebase -i: proper
prepare-commit-msg hook argument when squashing", 2008-10-3) apparently
changed things so that when squashing rebase would pass 'squash' as
the argument to the hook but that has been lost.

I think that it would make more sense to pass 'message' for revert and
cherry-pick -x/-s (i.e. cases where there is a new message or the
current message in modified by the command), 'squash' when squashing
with a new message and 'commit HEAD/CHERRY_PICK_HEAD'
otherwise (picking and squashing without a new message).

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7505: style fixesPhillip Wood Wed, 24 Jan 2018 12:34:20 +0000 (12:34 +0000)

t7505: style fixes

Fix the indentation and style of the hook script in preparation for
further changes.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: avoid segfault when can't open filesJuan F. Codagnone Wed, 24 Jan 2018 16:56:47 +0000 (13:56 -0300)

mailinfo: avoid segfault when can't open files

If <msg> or <patch> files can't be opened, then mailinfo() returns an
error before it even initializes mi->p_hdr_data or mi->s_hdr_data.
When cmd_mailinfo() then calls clear_mailinfo(), we dereference the
NULL pointers trying to free their contents.

Signed-off-by: Juan F. Codagnone <jcodagnone@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: don't write index twice if we can't write... Nguyễn Thái Ngọc Duy Wed, 24 Jan 2018 09:38:29 +0000 (16:38 +0700)

read-cache: don't write index twice if we can't write shared index

In a0a967568e ("update-index --split-index: do not split if $GIT_DIR is
read only", 2014-06-13), we tried to make sure we can still write an
index, even if the shared index can not be written.

We did so by just calling 'do_write_locked_index()' just before
'write_shared_index()'. 'do_write_locked_index()' always at least
closes the tempfile nowadays, and used to close or commit the lockfile
if COMMIT_LOCK or CLOSE_LOCK were given at the time this feature was
introduced. COMMIT_LOCK or CLOSE_LOCK is passed in by most callers of
'write_locked_index()'.

After calling 'write_shared_index()', we call 'write_split_index()',
which calls 'do_write_locked_index()' again, which then tries to use the
closed lockfile again, but in fact fails to do so as it's already
closed. This eventually leads to a segfault.

Make sure to write the main index only once.

[nd: most of the commit message and investigation done by Thomas, I only
tweaked the solution a bit]

Helped-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mru: Replace mru.[ch] with list.h implementationGargi Sharma Tue, 23 Jan 2018 23:46:51 +0000 (18:46 -0500)

mru: Replace mru.[ch] with list.h implementation

Replace the custom calls to mru.[ch] with calls to list.h. This patch is
the final step in removing the mru API completely and inlining the logic.
This patch leads to significant code reduction and the mru API hence, is
not a useful abstraction anymore.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

First batch after 2.16Junio C Hamano Tue, 23 Jan 2018 21:21:10 +0000 (13:21 -0800)

First batch after 2.16

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

Merge branch 'nd/add-i-ignore-submodules'Junio C Hamano Tue, 23 Jan 2018 21:16:41 +0000 (13:16 -0800)

Merge branch 'nd/add-i-ignore-submodules'

"git add -p" was taught to ignore local changes to submodules as
they do not interfere with the partial addition of regular changes
anyway.

* nd/add-i-ignore-submodules:
add--interactive: ignore submodule changes except HEAD

Merge branch 'mm/send-email-fallback-to-local-mail... Junio C Hamano Tue, 23 Jan 2018 21:16:41 +0000 (13:16 -0800)

Merge branch 'mm/send-email-fallback-to-local-mail-address'

Instead of maintaining home-grown email address parsing code, ship
a copy of reasonably recent Mail::Address to be used as a fallback
in 'git send-email' when the platform lacks it.

* mm/send-email-fallback-to-local-mail-address:
send-email: add test for Linux's get_maintainer.pl
perl/Git: remove now useless email-address parsing code
send-email: add and use a local copy of Mail::Address

Merge branch 'ab/doc-cat-file-e-still-shows-errors'Junio C Hamano Tue, 23 Jan 2018 21:16:41 +0000 (13:16 -0800)

Merge branch 'ab/doc-cat-file-e-still-shows-errors'

Doc update.

* ab/doc-cat-file-e-still-shows-errors:
cat-file doc: document that -e will return some output

Merge branch 'as/read-tree-prefix-doc-fix'Junio C Hamano Tue, 23 Jan 2018 21:16:41 +0000 (13:16 -0800)

Merge branch 'as/read-tree-prefix-doc-fix'

Doc update.

* as/read-tree-prefix-doc-fix:
doc/read-tree: remove obsolete remark

Merge branch 'ys/bisect-object-id-missing-conversion... Junio C Hamano Tue, 23 Jan 2018 21:16:40 +0000 (13:16 -0800)

Merge branch 'ys/bisect-object-id-missing-conversion-fix'

Fix for a commented-out code to adjust it to a rather old API change.

* ys/bisect-object-id-missing-conversion-fix:
bisect: debug: convert struct object to object_id

Merge branch 'tg/stash-with-pathspec-fix'Junio C Hamano Tue, 23 Jan 2018 21:16:39 +0000 (13:16 -0800)

Merge branch 'tg/stash-with-pathspec-fix'

"git stash -- <pathspec>" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.

* tg/stash-with-pathspec-fix:
stash: don't delete untracked files that match pathspec

Merge branch 'sb/submodule-update-reset-fix'Junio C Hamano Tue, 23 Jan 2018 21:16:39 +0000 (13:16 -0800)

Merge branch 'sb/submodule-update-reset-fix'

When resetting the working tree files recursively, the working tree
of submodules are now also reset to match.

* sb/submodule-update-reset-fix:
submodule: submodule_move_head omits old argument in forced case
unpack-trees: oneway_merge to update submodules
t/lib-submodule-update.sh: fix test ignoring ignored files in submodules
t/lib-submodule-update.sh: clarify test

Merge branch 'bw/oidmap-autoinit'Junio C Hamano Tue, 23 Jan 2018 21:16:39 +0000 (13:16 -0800)

Merge branch 'bw/oidmap-autoinit'

Code clean-up.

* bw/oidmap-autoinit:
oidmap: ensure map is initialized

Merge branch 'ab/commit-m-with-fixup'Junio C Hamano Tue, 23 Jan 2018 21:16:38 +0000 (13:16 -0800)

Merge branch 'ab/commit-m-with-fixup'

"git commit --fixup" did not allow "-m<message>" option to be used
at the same time; allow it to annotate resulting commit with more
text.

* ab/commit-m-with-fixup:
commit: add support for --fixup <commit> -m"<extra message>"
commit doc: document that -c, -C, -F and --fixup with -m error

Merge branch 'cc/codespeed'Junio C Hamano Tue, 23 Jan 2018 21:16:38 +0000 (13:16 -0800)

Merge branch 'cc/codespeed'

"perf" test output can be sent to codespeed server.

* cc/codespeed:
perf/run: read GIT_PERF_REPO_NAME from perf.repoName
perf/run: learn to send output to codespeed server
perf/run: learn about perf.codespeedOutput
perf/run: add conf_opts argument to get_var_from_env_or_config()
perf/aggregate: implement codespeed JSON output
perf/aggregate: refactor printing results
perf/aggregate: fix checking ENV{GIT_PERF_SUBSECTION}

Merge branch 'ab/perf-grep-threads'Junio C Hamano Tue, 23 Jan 2018 21:16:37 +0000 (13:16 -0800)

Merge branch 'ab/perf-grep-threads'

More perf tests for threaded grep

* ab/perf-grep-threads:
perf: amend the grep tests to test grep.threads

Merge branch 'sb/diff-blobfind-pickaxe'Junio C Hamano Tue, 23 Jan 2018 21:16:37 +0000 (13:16 -0800)

Merge branch 'sb/diff-blobfind-pickaxe'

"diff" family of commands learned "--find-object=<object-id>" option
to limit the findings to changes that involve the named object.

* sb/diff-blobfind-pickaxe:
diff: use HAS_MULTI_BITS instead of counting bits manually
diff: properly error out when combining multiple pickaxe options
diffcore: add a pickaxe option to find a specific blob
diff: introduce DIFF_PICKAXE_KINDS_MASK
diff: migrate diff_flags.pickaxe_ignore_case to a pickaxe_opts bit
diff.h: make pickaxe_opts an unsigned bit field

Merge branch 'jk/abort-clone-with-existing-dest'Junio C Hamano Tue, 23 Jan 2018 21:16:37 +0000 (13:16 -0800)

Merge branch 'jk/abort-clone-with-existing-dest'

"git clone $there $here" is allowed even when here directory exists
as long as it is an empty directory, but the command incorrectly
removed it upon a failure of the operation.

* jk/abort-clone-with-existing-dest:
clone: do not clean up directories we didn't create
clone: factor out dir_exists() helper
t5600: modernize style
t5600: fix outdated comment about unborn HEAD

Merge branch 'jc/merge-symlink-ours-theirs'Junio C Hamano Tue, 23 Jan 2018 21:16:37 +0000 (13:16 -0800)

Merge branch 'jc/merge-symlink-ours-theirs'

"git merge -Xours/-Xtheirs" learned to use our/their version when
resolving a conflicting updates to a symbolic link.

* jc/merge-symlink-ours-theirs:
merge: teach -Xours/-Xtheirs to symbolic link merge

Merge branch 'rs/lose-leak-pending'Junio C Hamano Tue, 23 Jan 2018 21:16:36 +0000 (13:16 -0800)

Merge branch 'rs/lose-leak-pending'

API clean-up around revision traversal.

* rs/lose-leak-pending:
commit: remove unused function clear_commit_marks_for_object_array()
revision: remove the unused flag leak_pending
checkout: avoid using the rev_info flag leak_pending
bundle: avoid using the rev_info flag leak_pending
bisect: avoid using the rev_info flag leak_pending
object: add clear_commit_marks_all()
ref-filter: use clear_commit_marks_many() in do_merge_filter()
commit: use clear_commit_marks_many() in remove_redundant()
commit: avoid allocation in clear_commit_marks_many()

Merge branch 'jm/svn-pushmergeinfo-fix'Junio C Hamano Tue, 23 Jan 2018 21:16:36 +0000 (13:16 -0800)

Merge branch 'jm/svn-pushmergeinfo-fix'

"git svn dcommit" did not take into account the fact that a
svn+ssh:// URL with a username@ (typically used for pushing) refers
to the same SVN repository without the username@ and failed when
svn.pushmergeinfo option is set.

* jm/svn-pushmergeinfo-fix:
git-svn: fix svn.pushmergeinfo handling of svn+ssh usernames.

Merge branch 'nd/ita-wt-renames-in-status'Junio C Hamano Tue, 23 Jan 2018 21:16:28 +0000 (13:16 -0800)

Merge branch 'nd/ita-wt-renames-in-status'

"git status" after moving a path in the working tree (hence making
it appear "removed") and then adding with the -N option (hence
making that appear "added") detected it as a rename, but did not
report the old and new pathnames correctly.

* nd/ita-wt-renames-in-status:
wt-status.c: handle worktree renames
wt-status.c: rename rename-related fields in wt_status_change_data
wt-status.c: catch unhandled diff status codes
wt-status.c: coding style fix
Use DIFF_DETECT_RENAME for detect_rename assignments
t2203: test status output with porcelain v2 format

Merge branch 'dk/describe-all-output-fix'Junio C Hamano Tue, 23 Jan 2018 21:16:28 +0000 (13:16 -0800)

Merge branch 'dk/describe-all-output-fix'

An old regression in "git describe --all $annotated_tag^0" has been
fixed.

* dk/describe-all-output-fix:
describe: prepend "tags/" when describing tags with embedded name

Use MOVE_ARRAYSZEDER Gábor Mon, 22 Jan 2018 17:50:09 +0000 (18:50 +0100)

Use MOVE_ARRAY

Use the helper macro MOVE_ARRAY to move arrays. This is shorter and
safer, as it automatically infers the size of elements.

Patch generated by Coccinelle and contrib/coccinelle/array.cocci in
Travis CI's static analysis build job.

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

Sync with v2.16.1Junio C Hamano Mon, 22 Jan 2018 05:14:54 +0000 (21:14 -0800)

Sync with v2.16.1

* maint:
Git 2.16.1
t5601-clone: test case-conflicting files on case-insensitive filesystem
repository: pre-initialize hash algo pointer

Git 2.16.1 v2.16.1Junio C Hamano Mon, 22 Jan 2018 05:14:25 +0000 (21:14 -0800)

Git 2.16.1

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

Start 2.17 cycleJunio C Hamano Mon, 22 Jan 2018 05:14:09 +0000 (21:14 -0800)

Start 2.17 cycle

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

Merge branch 'bc/hash-algo' into maintJunio C Hamano Mon, 22 Jan 2018 05:12:37 +0000 (21:12 -0800)

Merge branch 'bc/hash-algo' into maint

* bc/hash-algo:
t5601-clone: test case-conflicting files on case-insensitive filesystem
repository: pre-initialize hash algo pointer

t5601-clone: test case-conflicting files on case-insens... Eric Sunshine Sun, 21 Jan 2018 08:07:28 +0000 (03:07 -0500)

t5601-clone: test case-conflicting files on case-insensitive filesystem

A recently introduced regression caused a segfault at clone time on
case-insensitive filesystems when filenames differing only in case are
present. This bug has already been fixed (repository: pre-initialize
hash algo pointer, 2018-01-18), but it's not the first time similar
problems have arisen. Therefore, introduce a test to catch this case and
protect against future regressions.

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

repository: pre-initialize hash algo pointerbrian m. carlson Fri, 19 Jan 2018 04:18:25 +0000 (04:18 +0000)

repository: pre-initialize hash algo pointer

There are various git subcommands (among them, clone) which don't set up
the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but
end up needing to have information about the hash algorithm in use.
Because the hash algorithm is part of struct repository and it's only
initialized in repository setup, we can end up dereferencing a NULL
pointer in some cases if we call one of these subcommands and look up
the empty blob or empty tree values.

A "git clone" of a project that has two paths that differ only in
case suffers from this if it is run on a case insensitive platform.
When the command attempts to check out one of these two paths after
checking out the other one, the checkout codepath needs to see if
the version that is already on the filesystem (which should not
happen if the FS were case sensitive) is dirty, and it needs to
exercise the hashing code at that point.

In the future, we can add a command line option for this or read it
from the configuration, but until we're ready to expose that
functionality to the user, simply initialize the repository
structure to use the current hash algorithm, SHA-1.

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

files_initial_transaction_commit(): only unlock if... Mathias Rav Thu, 18 Jan 2018 13:38:41 +0000 (14:38 +0100)

files_initial_transaction_commit(): only unlock if locked

Running git clone --single-branch --mirror -b TAGNAME previously
triggered the following error message:

fatal: multiple updates for ref 'refs/tags/TAGNAME' not allowed.

This error condition is handled in files_initial_transaction_commit().

42c7f7ff9 ("commit_packed_refs(): remove call to `packed_refs_unlock()`", 2017-06-23)
introduced incorrect unlocking in the error path of this function,
which changes the error message to

fatal: BUG: packed_refs_unlock() called when not locked

Move the call to packed_refs_unlock() above the "cleanup:" label
since the unlocking should only be done in the last error path.

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: improve sha1_file_name() perfsChristian Couder Thu, 18 Jan 2018 10:08:54 +0000 (11:08 +0100)

sha1_file: improve sha1_file_name() perfs

As sha1_file_name() could be performance sensitive, let's
make it faster by using strbuf_addstr() and strbuf_addc()
instead of strbuf_addf().

Helped-by: Derrick Stolee <stolee@gmail.com>
Helped-by: Jeff Hostetler <git@jeffhostetler.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: support omitting data from tracesJonathan Tan Fri, 19 Jan 2018 00:28:02 +0000 (16:28 -0800)

http: support omitting data from traces

GIT_TRACE_CURL provides a way to debug what is being sent and received
over HTTP, with automatic redaction of sensitive information. But it
also logs data transmissions, which significantly increases the log file
size, sometimes unnecessarily. Add an option "GIT_TRACE_CURL_NO_DATA" to
allow the user to omit such data transmissions.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: support cookie redaction when tracingJonathan Tan Fri, 19 Jan 2018 00:28:01 +0000 (16:28 -0800)

http: support cookie redaction when tracing

When using GIT_TRACE_CURL, Git already redacts the "Authorization:" and
"Proxy-Authorization:" HTTP headers. Extend this redaction to a
user-specified list of cookies, specified through the
"GIT_REDACT_COOKIES" environment variable.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cocci: use format keyword instead of a literal stringRené Scharfe Fri, 19 Jan 2018 17:05:59 +0000 (18:05 +0100)

cocci: use format keyword instead of a literal string

There's a rule in strbuf.cocci for converting trivial uses of
strbuf_addf() to strbuf_addstr() in order to simplify the code and
improve performance a bit. Coccinelle 1.0.0~rc19.deb-3 on Travis CI
lets the "%s" in that rule match format strings like "%d" as well for
some reason, though, leading to invalid proposed patches.

Use the "format" keyword to let Coccinelle parse the format string and
match the conversion specifier with a trivial regular expression
instead. This works fine with both Coccinelle 1.0.0~rc19.deb-3 and
1.0.4.deb-3+b3 (the current version on Debian testing).

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Tested-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packfile: use get_be64() for large offsetsDerrick Stolee Wed, 17 Jan 2018 19:08:23 +0000 (14:08 -0500)

packfile: use get_be64() for large offsets

The pack-index version 2 format uses two 4-byte integers in
network-byte order to represent one 8-byte value. The current
implementation has several code clones for stitching these integers
together.

Use get_be64() to create an 8-byte integer from two 4-byte integers
represented this way.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command.c: print new cwd in trace_run_command()Nguyễn Thái Ngọc Duy Thu, 18 Jan 2018 09:45:12 +0000 (16:45 +0700)

run-command.c: print new cwd in trace_run_command()

If a command sets a new env variable GIT_DIR=.git, we need more context
to know where that '.git' is related to.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command.c: print env vars in trace_run_command()Nguyễn Thái Ngọc Duy Thu, 18 Jan 2018 09:45:11 +0000 (16:45 +0700)

run-command.c: print env vars in trace_run_command()

Occasionally submodule code could execute new commands with GIT_DIR set
to some submodule. GIT_TRACE prints just the command line which makes it
hard to tell that it's not really executed on this repository.

Print the env delta (compared to parent environment) in this case.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>