git
6 years agoMerge branch 'sb/worktree-remove-opt-force'
Junio C Hamano [Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)] 
Merge branch 'sb/worktree-remove-opt-force'

"git worktree remove" learned that "-f" is a shorthand for
"--force" option, just like for "git worktree add".

* sb/worktree-remove-opt-force:
  worktree: accept -f as short for --force for removal

6 years agoMerge branch 'ma/double-dashes-in-docs'
Junio C Hamano [Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)] 
Merge branch 'ma/double-dashes-in-docs'

Doc formatting updates.

* ma/double-dashes-in-docs:
  git-submodule.txt: quote usage in monospace, drop backslash
  git-[short]log.txt: unify quoted standalone --
  doc: convert [\--] to [--]
  doc: convert \--option to --option

6 years agoMerge branch 'tq/t1510'
Junio C Hamano [Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)] 
Merge branch 'tq/t1510'

Test cleanup.

* tq/t1510:
  t1510-repo-setup.sh: remove useless mkdir

6 years agoMerge branch 'so/glossary-ancestor'
Junio C Hamano [Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)] 
Merge branch 'so/glossary-ancestor'

Docfix.

* so/glossary-ancestor:
  glossary: substitute "ancestor" for "direct ancestor" in 'push' description.

6 years agoMerge branch 'ls/checkout-encoding'
Junio C Hamano [Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)] 
Merge branch 'ls/checkout-encoding'

The new "checkout-encoding" attribute can ask Git to convert the
contents to the specified encoding when checking out to the working
tree (and the other way around when checking in).

* ls/checkout-encoding:
  convert: add round trip check based on 'core.checkRoundtripEncoding'
  convert: add tracing for 'working-tree-encoding' attribute
  convert: check for detectable errors in UTF encodings
  convert: add 'working-tree-encoding' attribute
  utf8: add function to detect a missing UTF-16/32 BOM
  utf8: add function to detect prohibited UTF-16/32 BOM
  utf8: teach same_encoding() alternative UTF encoding names
  strbuf: add a case insensitive starts_with()
  strbuf: add xstrdup_toupper()
  strbuf: remove unnecessary NUL assignment in xstrdup_tolower()

6 years agoMerge branch 'ab/nuke-emacs-contrib'
Junio C Hamano [Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)] 
Merge branch 'ab/nuke-emacs-contrib'

The scripts in contrib/emacs/ have outlived their usefulness and
have been replaced with a stub that errors out and tells the user
there are replacements.

* ab/nuke-emacs-contrib:
  git{,-blame}.el: remove old bitrotting Emacs code

6 years agoMerge branch 'nd/warn-more-for-devs'
Junio C Hamano [Tue, 8 May 2018 06:59:21 +0000 (15:59 +0900)] 
Merge branch 'nd/warn-more-for-devs'

The build procedure "make DEVELOPER=YesPlease" learned to enable a
bit more warning options depending on the compiler used to help
developers more.  There also is "make DEVOPTS=tokens" knob
available now, for those who want to help fixing warnings we
usually ignore, for example.

* nd/warn-more-for-devs:
  Makefile: add a DEVOPTS to get all of -Wextra
  Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER
  Makefile: detect compiler and enable more warnings in DEVELOPER=1
  connect.c: mark die_initial_contact() NORETURN

6 years agoMerge branch 'sb/object-store-replace'
Junio C Hamano [Tue, 8 May 2018 06:59:21 +0000 (15:59 +0900)] 
Merge branch 'sb/object-store-replace'

The effort to pass the repository in-core structure throughout the
API continues.  This round deals with the code that implements the
refs/replace/ mechanism.

* sb/object-store-replace:
  replace-object: allow lookup_replace_object to handle arbitrary repositories
  replace-object: allow do_lookup_replace_object to handle arbitrary repositories
  replace-object: allow prepare_replace_object to handle arbitrary repositories
  refs: allow for_each_replace_ref to handle arbitrary repositories
  refs: store the main ref store inside the repository struct
  replace-object: add repository argument to lookup_replace_object
  replace-object: add repository argument to do_lookup_replace_object
  replace-object: add repository argument to prepare_replace_object
  refs: add repository argument to for_each_replace_ref
  refs: add repository argument to get_main_ref_store
  replace-object: check_replace_refs is safe in multi repo environment
  replace-object: eliminate replace objects prepared flag
  object-store: move lookup_replace_object to replace-object.h
  replace-object: move replace_map to object store
  replace_object: use oidmap

6 years agoMerge branch 'ds/commit-graph'
Junio C Hamano [Tue, 8 May 2018 06:59:20 +0000 (15:59 +0900)] 
Merge branch 'ds/commit-graph'

Precompute and store information necessary for ancestry traversal
in a separate file to optimize graph walking.

* ds/commit-graph:
  commit-graph: implement "--append" option
  commit-graph: build graph from starting commits
  commit-graph: read only from specific pack-indexes
  commit: integrate commit graph with commit parsing
  commit-graph: close under reachability
  commit-graph: add core.commitGraph setting
  commit-graph: implement git commit-graph read
  commit-graph: implement git-commit-graph write
  commit-graph: implement write_commit_graph()
  commit-graph: create git-commit-graph builtin
  graph: add commit graph design document
  commit-graph: add format document
  csum-file: refactor finalize_hashfile() method
  csum-file: rename hashclose() to finalize_hashfile()

6 years agoMerge branch 'js/empty-config-section-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:18 +0000 (15:59 +0900)] 
Merge branch 'js/empty-config-section-fix'

"git config --unset a.b", when "a.b" is the last variable in an
otherwise empty section "a", left an empty section "a" behind, and
worse yet, a subsequent "git config a.c value" did not reuse that
empty shell and instead created a new one.  These have been
(partially) corrected.

* js/empty-config-section-fix:
  git_config_set: reuse empty sections
  git config --unset: remove empty sections (in the common case)
  git_config_set: make use of the config parser's event stream
  git_config_set: do not use a state machine
  config_set_store: rename some fields for consistency
  config: avoid using the global variable `store`
  config: introduce an optional event stream while parsing
  t1300: `--unset-all` can leave an empty section behind (bug)
  t1300: add a few more hairy examples of sections becoming empty
  t1300: remove unreasonable expectation from TODO
  t1300: avoid relying on a bug
  config --replace-all: avoid extra line breaks
  t1300: demonstrate that --replace-all can "invent" newlines
  t1300: rename it to reflect that `repo-config` was deprecated
  git_config_set: fix off-by-two

6 years agoMerge branch 'ot/libify-get-ref-atom-value'
Junio C Hamano [Tue, 8 May 2018 06:59:18 +0000 (15:59 +0900)] 
Merge branch 'ot/libify-get-ref-atom-value'

Code restructuring, in preparation for further work.

* ot/libify-get-ref-atom-value:
  ref-filter: libify get_ref_atom_value()
  ref-filter: add return value to parsers
  ref-filter: change parsing function error handling
  ref-filter: add return value && strbuf to handlers
  ref-filter: start adding strbufs with errors
  ref-filter: add shortcut to work with strbufs

6 years agoMerge branch 'sb/submodule-move-nested'
Junio C Hamano [Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)] 
Merge branch 'sb/submodule-move-nested'

Moving a submodule that itself has submodule in it with "git mv"
forgot to make necessary adjustment to the nested sub-submodules;
now the codepath learned to recurse into the submodules.

* sb/submodule-move-nested:
  submodule: fixup nested submodules after moving the submodule
  submodule-config: remove submodule_from_cache
  submodule-config: add repository argument to submodule_from_{name, path}
  submodule-config: allow submodule_free to handle arbitrary repositories
  grep: remove "repo" arg from non-supporting funcs
  submodule.h: drop declaration of connect_work_tree_and_git_dir

6 years agoMerge branch 'dj/runtime-prefix'
Junio C Hamano [Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)] 
Merge branch 'dj/runtime-prefix'

A build-time option has been added to allow Git to be told to refer
to its associated files relative to the main binary, in the same
way that has been possible on Windows for quite some time, for
Linux, BSDs and Darwin.

* dj/runtime-prefix:
  Makefile: quote $INSTLIBDIR when passing it to sed
  Makefile: remove unused @@PERLLIBDIR@@ substitution variable
  mingw/msvc: use the new-style RUNTIME_PREFIX helper
  exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows
  exec_cmd: RUNTIME_PREFIX on some POSIX systems
  Makefile: add Perl runtime prefix support
  Makefile: generate Perl header from template file

6 years agoMerge branch 'ab/simplify-perl-makefile'
Junio C Hamano [Tue, 8 May 2018 06:59:16 +0000 (15:59 +0900)] 
Merge branch 'ab/simplify-perl-makefile'

Recent simplification of build procedure forgot a bit of tweak to
the build procedure of contrib/mw-to-git/

* ab/simplify-perl-makefile:
  Makefile: mark perllibdir as a .PHONY target
  perl: fix installing modules from contrib

6 years agoMerge branch 'bw/protocol-v2'
Junio C Hamano [Tue, 8 May 2018 06:59:15 +0000 (15:59 +0900)] 
Merge branch 'bw/protocol-v2'

The beginning of the next-gen transfer protocol.

* bw/protocol-v2: (35 commits)
  remote-curl: don't request v2 when pushing
  remote-curl: implement stateless-connect command
  http: eliminate "# service" line when using protocol v2
  http: don't always add Git-Protocol header
  http: allow providing extra headers for http requests
  remote-curl: store the protocol version the server responded with
  remote-curl: create copy of the service name
  pkt-line: add packet_buf_write_len function
  transport-helper: introduce stateless-connect
  transport-helper: refactor process_connect_service
  transport-helper: remove name parameter
  connect: don't request v2 when pushing
  connect: refactor git_connect to only get the protocol version once
  fetch-pack: support shallow requests
  fetch-pack: perform a fetch using v2
  upload-pack: introduce fetch server command
  push: pass ref prefixes when pushing
  fetch: pass ref prefixes when fetching
  ls-remote: pass ref prefixes when requesting a remote's refs
  transport: convert transport_get_remote_refs to take a list of ref prefixes
  ...

6 years agoThe fourth batch for 2.18
Junio C Hamano [Wed, 25 Apr 2018 04:44:42 +0000 (13:44 +0900)] 
The fourth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jm/mem-pool'
Junio C Hamano [Wed, 25 Apr 2018 04:29:06 +0000 (13:29 +0900)] 
Merge branch 'jm/mem-pool'

An reusable "memory pool" implementation has been extracted from
fast-import.c, which in turn has become the first user of the
mem-pool API.

* jm/mem-pool:
  mem-pool: move reusable parts of memory pool into its own file
  fast-import: introduce mem_pool type
  fast-import: rename mem_pool type to mp_block

6 years agoMerge branch 'tg/use-git-contacts'
Junio C Hamano [Wed, 25 Apr 2018 04:29:05 +0000 (13:29 +0900)] 
Merge branch 'tg/use-git-contacts'

Doc update.

* tg/use-git-contacts:
  SubmittingPatches: mention the git contacts command

6 years agoMerge branch 'sb/filenames-with-dashes'
Junio C Hamano [Wed, 25 Apr 2018 04:29:05 +0000 (13:29 +0900)] 
Merge branch 'sb/filenames-with-dashes'

Rename bunch of source files to more consistently use dashes
instead of underscores to connect words.

* sb/filenames-with-dashes:
  replace_object.c: rename to use dash in file name
  sha1_file.c: rename to use dash in file name
  sha1_name.c: rename to use dash in file name
  exec_cmd: rename to use dash in file name
  unicode_width.h: rename to use dash in file name
  write_or_die.c: rename to use dashes in file name

6 years agoMerge branch 'cc/perf-bisect'
Junio C Hamano [Wed, 25 Apr 2018 04:29:04 +0000 (13:29 +0900)] 
Merge branch 'cc/perf-bisect'

Performance measuring framework in t/perf learned to help bisecting
performance regressions.

* cc/perf-bisect:
  t/perf: add scripts to bisect performance regressions
  perf/run: add --subsection option

6 years agoMerge branch 'bp/fsmonitor-prime-index'
Junio C Hamano [Wed, 25 Apr 2018 04:29:04 +0000 (13:29 +0900)] 
Merge branch 'bp/fsmonitor-prime-index'

The index file is updated to record the fsmonitor section after a
full scan was made, to avoid wasting the effort that has already
spent.

* bp/fsmonitor-prime-index:
  fsmonitor: force index write after full scan

6 years agoMerge branch 'bp/fsmonitor-bufsize-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:03 +0000 (13:29 +0900)] 
Merge branch 'bp/fsmonitor-bufsize-fix'

Fix an unexploitable (because the oversized contents are not under
attacker's control) buffer overflow.

* bp/fsmonitor-bufsize-fix:
  fsmonitor: fix incorrect buffer size when printing version number

6 years agoMerge branch 'cb/bash-completion-ls-files-processing'
Junio C Hamano [Wed, 25 Apr 2018 04:29:02 +0000 (13:29 +0900)] 
Merge branch 'cb/bash-completion-ls-files-processing'

Shell completion (in contrib) that gives list of paths have been
optimized somewhat.

* cb/bash-completion-ls-files-processing:
  completion: improve ls-files filter performance

6 years agoMerge branch 'es/worktree-docs'
Junio C Hamano [Wed, 25 Apr 2018 04:29:02 +0000 (13:29 +0900)] 
Merge branch 'es/worktree-docs'

Doc updates.

* es/worktree-docs:
  git-worktree.txt: unify command-line prompt in example blocks
  git-worktree.txt: recommend 'git worktree remove' over manual deletion

6 years agoMerge branch 'es/fread-reads-dir-autoconf-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:01 +0000 (13:29 +0900)] 
Merge branch 'es/fread-reads-dir-autoconf-fix'

Small fix to the autoconf build procedure.

* es/fread-reads-dir-autoconf-fix:
  configure.ac: fix botched FREAD_READS_DIRECTORIES check

6 years agoMerge branch 'ps/test-chmtime-get'
Junio C Hamano [Wed, 25 Apr 2018 04:29:00 +0000 (13:29 +0900)] 
Merge branch 'ps/test-chmtime-get'

Test cleanup.

* ps/test-chmtime-get:
  t/helper: 'test-chmtime (--get|-g)' to print only the mtime

6 years agoMerge branch 'js/t5404-path-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:00 +0000 (13:29 +0900)] 
Merge branch 'js/t5404-path-fix'

Test fix.

* js/t5404-path-fix:
  t5404: relax overzealous test

6 years agoMerge branch 'jk/ref-array-push'
Junio C Hamano [Wed, 25 Apr 2018 04:28:59 +0000 (13:28 +0900)] 
Merge branch 'jk/ref-array-push'

API clean-up aournd ref-filter code.

* jk/ref-array-push:
  ref-filter: factor ref_array pushing into its own function
  ref-filter: make ref_array_item allocation more consistent
  ref-filter: use "struct object_id" consistently

6 years agoMerge branch 'en/doc-typoes'
Junio C Hamano [Wed, 25 Apr 2018 04:28:58 +0000 (13:28 +0900)] 
Merge branch 'en/doc-typoes'

Docfix.

* en/doc-typoes:
  Documentation: normalize spelling of 'normalised'
  Documentation: fix several one-character-off spelling errors

6 years agoMerge branch 'lw/daemon-log-destination'
Junio C Hamano [Wed, 25 Apr 2018 04:28:58 +0000 (13:28 +0900)] 
Merge branch 'lw/daemon-log-destination'

Recent introduction of "--log-destination" option to "git daemon"
did not work well when the daemon was run under "--inetd" mode.

* lw/daemon-log-destination:
  daemon.c: fix condition for redirecting stderr

6 years agoMerge branch 'mn/send-email-credential-doc'
Junio C Hamano [Wed, 25 Apr 2018 04:28:57 +0000 (13:28 +0900)] 
Merge branch 'mn/send-email-credential-doc'

Doc update.

* mn/send-email-credential-doc:
  send-email: simplify Gmail example in the documentation

6 years agoMerge branch 'ak/bisect-doc-typofix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:56 +0000 (13:28 +0900)] 
Merge branch 'ak/bisect-doc-typofix'

Docfix.

* ak/bisect-doc-typofix:
  Documentation/git-bisect.txt: git bisect term → git bisect terms

6 years agoMerge branch 'br/mergetools-guiffy'
Junio C Hamano [Wed, 25 Apr 2018 04:28:54 +0000 (13:28 +0900)] 
Merge branch 'br/mergetools-guiffy'

"git mergetools" learned talking to guiffy.

* br/mergetools-guiffy:
  mergetools: add support for guiffy

6 years agoMerge branch 'nd/worktree-move'
Junio C Hamano [Wed, 25 Apr 2018 04:28:54 +0000 (13:28 +0900)] 
Merge branch 'nd/worktree-move'

Test update.

* nd/worktree-move:
  t2028: tighten grep expression to make "move worktree" test more robust

6 years agoMerge branch 'ks/branch-list-detached-rebase-i'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'ks/branch-list-detached-rebase-i'

"git branch --list" during an interrupted "rebase -i" now lets
users distinguish the case where a detached HEAD is being rebased
and a normal branch is being rebased.

* ks/branch-list-detached-rebase-i:
  t3200: verify "branch --list" sanity when rebasing from detached HEAD
  branch --list: print useful info whilst interactive rebasing a detached HEAD

6 years agoMerge branch 'jk/t5561-missing-curl'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'jk/t5561-missing-curl'

Test fixes.

* jk/t5561-missing-curl:
  t5561: skip tests if curl is not available
  t5561: drop curl stderr redirects

6 years agoMerge branch 'bw/commit-partial-from-subdirectory-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'bw/commit-partial-from-subdirectory-fix'

"cd sub/dir && git commit ../path" ought to record the changes to
the file "sub/path", but this regressed long time ago.

* bw/commit-partial-from-subdirectory-fix:
  commit: allow partial commits with relative paths

6 years agoMerge branch 'jk/relative-directory-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:52 +0000 (13:28 +0900)] 
Merge branch 'jk/relative-directory-fix'

Some codepaths, including the refs API, get and keep relative
paths, that go out of sync when the process does chdir(2).  The
chdir-notify API is introduced to let these codepaths adjust these
cached paths to the new current directory.

* jk/relative-directory-fix:
  refs: use chdir_notify to update cached relative paths
  set_work_tree: use chdir_notify
  add chdir-notify API
  trace.c: export trace_setup_key
  set_git_dir: die when setenv() fails

6 years agoMerge branch 'jk/flockfile-stdio'
Junio C Hamano [Wed, 25 Apr 2018 04:28:52 +0000 (13:28 +0900)] 
Merge branch 'jk/flockfile-stdio'

Code clean-up.

* jk/flockfile-stdio:
  config: move flockfile() closer to unlocked functions

6 years agoMerge branch 'pw/rebase-signoff'
Junio C Hamano [Wed, 25 Apr 2018 04:28:51 +0000 (13:28 +0900)] 
Merge branch 'pw/rebase-signoff'

"git rebase" has learned to honor "--signoff" option when using
backends other than "am" (but not "--preserve-merges").

* pw/rebase-signoff:
  rebase --keep-empty: always use interactive rebase
  rebase -p: error out if --signoff is given
  rebase: extend --signoff support

6 years agoMerge branch 'pw/rebase-keep-empty-fixes'
Junio C Hamano [Wed, 25 Apr 2018 04:28:49 +0000 (13:28 +0900)] 
Merge branch 'pw/rebase-keep-empty-fixes'

"git rebase --keep-empty" still removed an empty commit if the
other side contained an empty commit (due to the "does an
equivalent patch exist already?" check), which has been corrected.

* pw/rebase-keep-empty-fixes:
  rebase: respect --no-keep-empty
  rebase -i --keep-empty: don't prune empty commits
  rebase --root: stop assuming squash_onto is unset

6 years agoMerge branch 'cb/git-gui-ttk-style'
Junio C Hamano [Wed, 25 Apr 2018 04:28:49 +0000 (13:28 +0900)] 
Merge branch 'cb/git-gui-ttk-style'

"git gui" has been taught to work with old versions of tk (like
8.5.7) that do not support "ttk::style theme use" as a way to query
the current theme.

* cb/git-gui-ttk-style:
  git-gui: workaround ttk:style theme use

6 years agoMerge branch 'bp/git-gui-bind-kp-enter'
Junio C Hamano [Wed, 25 Apr 2018 04:28:48 +0000 (13:28 +0900)] 
Merge branch 'bp/git-gui-bind-kp-enter'

"git gui" performs commit upon CTRL/CMD+ENTER but the
CTRL/CMD+KP_ENTER (i.e. enter key on the numpad) did not have the
same key binding.  It now does.

* bp/git-gui-bind-kp-enter:
  git-gui: bind CTRL/CMD+numpad ENTER to do_commit

6 years agoMerge branch 'bb/git-gui-ssh-key-files'
Junio C Hamano [Wed, 25 Apr 2018 04:28:48 +0000 (13:28 +0900)] 
Merge branch 'bb/git-gui-ssh-key-files'

"git gui" learned that "~/.ssh/id_ecdsa.pub" and
"~/.ssh/id_ed25519.pub" are also possible SSH key files.

* bb/git-gui-ssh-key-files:
  git-gui: search for all current SSH key types

6 years agoMakefile: quote $INSTLIBDIR when passing it to sed
Jonathan Nieder [Mon, 23 Apr 2018 23:25:35 +0000 (16:25 -0700)] 
Makefile: quote $INSTLIBDIR when passing it to sed

f6a0ad4b (Makefile: generate Perl header from template file,
2018-04-10) moved code for generating the 'use lib' lines at the top
of perl scripts from the $(SCRIPT_PERL_GEN) rule to a separate
GIT-PERL-HEADER rule.

This rule first populates INSTLIBDIR and then substitutes it into the
GIT-PERL-HEADER using sed:

INSTLIBDIR=... something ...
sed -e 's=@@INSTLIBDIR@@='$$INSTLIBDIR'=g' $< > $@

Because $INSTLIBDIR is not surrounded by double quotes, the shell
splits it at each space, causing errors if INSTLIBDIR contains an $IFS
character:

 sed: 1: "s=@@INSTLIBDIR@@=/usr/l ...": unescaped newline inside substitute pattern

Add back the missing double-quotes to make it work again.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: remove unused @@PERLLIBDIR@@ substitution variable
Jonathan Nieder [Mon, 23 Apr 2018 23:24:22 +0000 (16:24 -0700)] 
Makefile: remove unused @@PERLLIBDIR@@ substitution variable

Junio noticed that this variable is not quoted correctly when it is
passed to sed.  As a shell-quoted string, it should be inside
single-quotes like $(perllibdir_relative_SQ), not outside them like
$INSTLIBDIR.

In fact, this substitution variable is not used.  Simplify by removing
it.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: mark perllibdir as a .PHONY target
Christian Hesse [Wed, 18 Apr 2018 21:44:40 +0000 (06:44 +0900)] 
Makefile: mark perllibdir as a .PHONY target

This target should be marked as .PHONY, just like other targets that
exist only for their side effects that do not create filesystem
entities with the same name.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-submodule.txt: quote usage in monospace, drop backslash
Martin Ågren [Tue, 17 Apr 2018 19:15:29 +0000 (21:15 +0200)] 
git-submodule.txt: quote usage in monospace, drop backslash

We tend to quote command line examples using `` to set them in a
monospace font. The immediate motivation for this patch is to get rid of
another instance of \--. As noted in the previous commits, \-- has a
tendency of rendering badly. Here, it renders ok (at least with
AsciiDoc 8.6.9 and Asciidoctor 1.5.4), but by getting rid of this
instance, we reduce the chances of \-- cropping up in places where it
matters more.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
6 years agogit-[short]log.txt: unify quoted standalone --
Martin Ågren [Tue, 17 Apr 2018 19:15:28 +0000 (21:15 +0200)] 
git-[short]log.txt: unify quoted standalone --

In git-log.txt, we have an instance of \--, which is known to sometimes
render badly. This one is even worse than normal though, since ``\-- ''
(with or without that trailing space) appears to be entirely broken,
both in HTML and manpages, both with AsciiDoc (version 8.6.9) and
Asciidoctor (version 1.5.4).

Further down in git-log.txt we have a ``--'', which renders good. In
git-shortlog.txt, we use "\-- " (including the quotes and the space),
which happens to look fairly good. I failed to find any other similar
instances. So all in all, we quote a double-dash in three different
places and do it differently each time, with various degrees of success.

Switch all of these to `--`. This sets the double-dash in monospace and
matches what we usually do with example command line usages and options.
Note that we drop the trailing space as well, since `-- ` does not
render well. These should still be clear enough since just a few lines
above each instance, the space is clearly visible in a longer context.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
6 years agodoc: convert [\--] to [--]
Martin Ågren [Tue, 17 Apr 2018 19:15:27 +0000 (21:15 +0200)] 
doc: convert [\--] to [--]

Commit 1c262bb7b (doc: convert \--option to --option, 2015-05-13)
explains that we used to need to write \--option to play well with older
versions of AsciiDoc, but that we do not support such versions anymore
anyway, and that Asciidoctor literally renders \--.

With [\--], which is used to denote the optional separator between
revisions and paths, Asciidoctor renders the backslash literally.
Change all [\--] to [--]. This changes nothing for AsciiDoc version
8.6.9, but is an improvement for Asciidoctor version 1.5.4.

We use double-dashes in several list entries (\--::). In my testing, it
appears that we do need to use the backslash there, so leave those.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
6 years agodoc: convert \--option to --option
Martin Ågren [Tue, 17 Apr 2018 19:15:26 +0000 (21:15 +0200)] 
doc: convert \--option to --option

Rather than using a backslash in \--foo, with or without ''-quoting,
write `--foo` for better rendering. As explained in commit 1c262bb7b
(doc: convert \--option to --option, 2015-05-13), the backslash is not
needed for the versions of AsciiDoc that we support, but is rendered
literally by Asciidoctor.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
6 years agoworktree: accept -f as short for --force for removal
Stefan Beller [Tue, 17 Apr 2018 18:19:39 +0000 (11:19 -0700)] 
worktree: accept -f as short for --force for removal

Many commands support a "--force" option, frequently abbreviated as
"-f", however, "git worktree remove"'s hand-rolled OPT_BOOL forgets
to recognize the short form, despite git-worktree.txt documenting
"-f" as supported. Replace OPT_BOOL with OPT__FORCE, which provides
"-f" for free, and makes 'remove' consistent with 'add' option
parsing (which also specifies the PARSE_OPT_NOCOMPLETE flag).

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoglossary: substitute "ancestor" for "direct ancestor" in 'push' description.
Sergey Organov [Mon, 16 Apr 2018 05:43:16 +0000 (08:43 +0300)] 
glossary: substitute "ancestor" for "direct ancestor" in 'push' description.

Even though "direct ancestor" is not defined in the glossary, the
common meaning of the term is simply "parent", parents being the only
direct ancestors, and the rest of ancestors being indirect ancestors.

As "parent" is obviously wrong in this place in the description, we
should simply say "ancestor", as everywhere else.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1510-repo-setup.sh: remove useless mkdir
Tao Qingyun [Sun, 15 Apr 2018 02:45:04 +0000 (10:45 +0800)] 
t1510-repo-setup.sh: remove useless mkdir

Signed-off-by: Tao Qingyun <845767657@qq.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit{,-blame}.el: remove old bitrotting Emacs code
Ævar Arnfjörð Bjarmason [Wed, 11 Apr 2018 20:42:05 +0000 (20:42 +0000)] 
git{,-blame}.el: remove old bitrotting Emacs code

The git-blame.el mode has been superseded by Emacs's own
vc-annotate (invoked by C-x v g). Users of the git.el mode are now
much better off using either Magit or the Git backend for Emacs's own
VC mode.

These modes were added over 10 years ago when Emacs's own Git support
was much less mature, and there weren't other mature modes in the wild
or shipped with Emacs itself.

These days these modes have few if any users, and users of git aren't
well served by us shipping these (some OS's install them alongside git
by default, which is confusing and leads users astray).

So let's remove these per Alexandre Julliard's message to the
ML[1]. If someone still wants these for some reason they're better
served by hosting these elsewhere (e.g. on ELPA), instead of us
distributing them with git.

However, since downstream packagers such as Debian are packaging this
as git-el it's less disruptive to still carry these files as Elisp
code that'll error out with a message suggesting alternatives, rather
than drop the files entirely[2].

Then rather than receive a cryptic load error when they upgrade
existing users will get an error directing them to the README file, or
to just stop requiring these modes. I think it makes sense to link to
GitHub's hosting of contrib/emacs/README (which'll be updated by the
time users see this) so they don't have to hunt down the packaged
README on their local system.

1. "Re: [PATCH] git.el: handle default excludesfile
   properly" (87muzlwhb0.fsf@winehq.org) --
   https://public-inbox.org/git/87muzlwhb0.fsf@winehq.org/

2. "Re: [PATCH v3] git{,-blame}.el: remove old bitrotting Emacs
   code" (20180327165751.GA4343@aiede.svl.corp.google.com) --
   https://public-inbox.org/git/20180327165751.GA4343@aiede.svl.corp.google.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: add a DEVOPTS to get all of -Wextra
Ævar Arnfjörð Bjarmason [Sat, 14 Apr 2018 19:19:46 +0000 (19:19 +0000)] 
Makefile: add a DEVOPTS to get all of -Wextra

Change DEVOPTS to understand a "extra-all" option. When the DEVELOPER
flag is enabled we turn on -Wextra, but manually switch some of the
warnings it turns on off.

This is because we have many existing occurrences of them in the code
base. This mode will stop the suppression, let the developer see and
decide whether to  fix them.

This change is a slight alteration of Nguyễn Thái Ngọc Duy
EAGER_DEVELOPER mode patch[1]

1. "[PATCH v3 3/3] Makefile: add EAGER_DEVELOPER
    mode" (<20180329150322.10722-4-pclouds@gmail.com>;
    https://public-inbox.org/git/20180329150322.10722-4-pclouds@gmail.com/)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: add a DEVOPTS to suppress -Werror under DEVELOPER
Ævar Arnfjörð Bjarmason [Sat, 14 Apr 2018 19:19:45 +0000 (19:19 +0000)] 
Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER

Add a DEVOPTS variable that'll be used to tweak the behavior of
DEVELOPER.

I've long wanted to use DEVELOPER=1 in my production builds, but on
some old systems I still get warnings, and thus the build would
fail. However if the build/tests fail for some other reason, it would
still be useful to scroll up and see what the relevant code is warning
about.

This change allows for that. Now setting DEVELOPER will set -Werror as
before, but if DEVOPTS=no-error is provided is set you'll get the same
warnings, but without -Werror.

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: detect compiler and enable more warnings in DEVELOPER=1
Nguyễn Thái Ngọc Duy [Sat, 14 Apr 2018 19:19:44 +0000 (19:19 +0000)] 
Makefile: detect compiler and enable more warnings in DEVELOPER=1

The set of extra warnings we enable when DEVELOPER has to be
conservative because we can't assume any compiler version the
developer may use. Detect the compiler version so we know when it's
safe to enable -Wextra and maybe more.

These warning settings are mostly from my custom config.mak a long
time ago when I tried to enable as many warnings as possible that can
still build without showing warnings. Some of those warnings are
probably worth fixing instead of just suppressing in future.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconnect.c: mark die_initial_contact() NORETURN
Nguyễn Thái Ngọc Duy [Sat, 14 Apr 2018 19:19:43 +0000 (19:19 +0000)] 
connect.c: mark die_initial_contact() NORETURN

There is a series running in parallel with this one that adds code
like this

    switch (...) {
    case ...:
        die_initial_contact();
    case ...:

There is nothing wrong with this. There is no actual falling
through. But since gcc is not that smart and gcc 7.x introduces
-Wimplicit-fallthrough, it raises a false alarm in this case.

This class of warnings may be useful elsewhere, so instead of
suppressing the whole class, let's try to fix just this code. gcc is
smart enough to realize that no execution can continue after a
NORETURN function call and no longer raises the warning.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconvert: add round trip check based on 'core.checkRoundtripEncoding'
Lars Schneider [Sun, 15 Apr 2018 18:16:10 +0000 (20:16 +0200)] 
convert: add round trip check based on 'core.checkRoundtripEncoding'

UTF supports lossless conversion round tripping and conversions between
UTF and other encodings are mostly round trip safe as Unicode aims to be
a superset of all other character encodings. However, certain encodings
(e.g. SHIFT-JIS) are known to have round trip issues [1].

Add 'core.checkRoundtripEncoding', which contains a comma separated
list of encodings, to define for what encodings Git should check the
conversion round trip if they are used in the 'working-tree-encoding'
attribute.

Set SHIFT-JIS as default value for 'core.checkRoundtripEncoding'.

[1] https://support.microsoft.com/en-us/help/170559/prb-conversion-problem-between-shift-jis-and-unicode

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconvert: add tracing for 'working-tree-encoding' attribute
Lars Schneider [Sun, 15 Apr 2018 18:16:09 +0000 (20:16 +0200)] 
convert: add tracing for 'working-tree-encoding' attribute

Add the GIT_TRACE_WORKING_TREE_ENCODING environment variable to enable
tracing for content that is reencoded with the 'working-tree-encoding'
attribute. This is useful to debug encoding issues.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconvert: check for detectable errors in UTF encodings
Lars Schneider [Sun, 15 Apr 2018 18:16:08 +0000 (20:16 +0200)] 
convert: check for detectable errors in UTF encodings

Check that new content is valid with respect to the user defined
'working-tree-encoding' attribute.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconvert: add 'working-tree-encoding' attribute
Lars Schneider [Sun, 15 Apr 2018 18:16:07 +0000 (20:16 +0200)] 
convert: add 'working-tree-encoding' attribute

Git recognizes files encoded with ASCII or one of its supersets (e.g.
UTF-8 or ISO-8859-1) as text files. All other encodings are usually
interpreted as binary and consequently built-in Git text processing
tools (e.g. 'git diff') as well as most Git web front ends do not
visualize the content.

Add an attribute to tell Git what encoding the user has defined for a
given file. If the content is added to the index, then Git reencodes
the content to a canonical UTF-8 representation. On checkout Git will
reverse this operation.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoutf8: add function to detect a missing UTF-16/32 BOM
Lars Schneider [Sun, 15 Apr 2018 18:16:06 +0000 (20:16 +0200)] 
utf8: add function to detect a missing UTF-16/32 BOM

If the endianness is not defined in the encoding name, then let's
be strict and require a BOM to avoid any encoding confusion. The
is_missing_required_utf_bom() function returns true if a required BOM
is missing.

The Unicode standard instructs to assume big-endian if there in no BOM
for UTF-16/32 [1][2]. However, the W3C/WHATWG encoding standard used
in HTML5 recommends to assume little-endian to "deal with deployed
content" [3]. Strictly requiring a BOM seems to be the safest option
for content in Git.

This function is used in a subsequent commit.

[1] http://unicode.org/faq/utf_bom.html#gen6
[2] http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
     Section 3.10, D98, page 132
[3] https://encoding.spec.whatwg.org/#utf-16le

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoutf8: add function to detect prohibited UTF-16/32 BOM
Lars Schneider [Sun, 15 Apr 2018 18:16:05 +0000 (20:16 +0200)] 
utf8: add function to detect prohibited UTF-16/32 BOM

Whenever a data stream is declared to be UTF-16BE, UTF-16LE, UTF-32BE
or UTF-32LE a BOM must not be used [1]. The function returns true if
this is the case.

This function is used in a subsequent commit.

[1] http://unicode.org/faq/utf_bom.html#bom10

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoutf8: teach same_encoding() alternative UTF encoding names
Lars Schneider [Sun, 15 Apr 2018 18:16:04 +0000 (20:16 +0200)] 
utf8: teach same_encoding() alternative UTF encoding names

The function same_encoding() could only recognize alternative names for
UTF-8 encodings. Teach it to recognize all kinds of alternative UTF
encoding names (e.g. utf16).

While we are at it, fix a crash that would occur if same_encoding() was
called with a NULL argument and a non-NULL argument.

This function is used in a subsequent commit.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomem-pool: move reusable parts of memory pool into its own file
Jameson Miller [Wed, 11 Apr 2018 18:37:55 +0000 (18:37 +0000)] 
mem-pool: move reusable parts of memory pool into its own file

This moves the reusable parts of the memory pool logic used by
fast-import.c into its own file for use by other components.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: allow lookup_replace_object to handle arbitrary repositories
Stefan Beller [Thu, 12 Apr 2018 00:21:18 +0000 (17:21 -0700)] 
replace-object: allow lookup_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: allow do_lookup_replace_object to handle arbitrary repositories
Stefan Beller [Thu, 12 Apr 2018 00:21:17 +0000 (17:21 -0700)] 
replace-object: allow do_lookup_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: allow prepare_replace_object to handle arbitrary repositories
Stefan Beller [Thu, 12 Apr 2018 00:21:16 +0000 (17:21 -0700)] 
replace-object: allow prepare_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: allow for_each_replace_ref to handle arbitrary repositories
Stefan Beller [Thu, 12 Apr 2018 00:21:15 +0000 (17:21 -0700)] 
refs: allow for_each_replace_ref to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: store the main ref store inside the repository struct
Stefan Beller [Thu, 12 Apr 2018 00:21:14 +0000 (17:21 -0700)] 
refs: store the main ref store inside the repository struct

This moves the 'main_ref_store', which was a global variable in refs.c
into the repository struct.

This patch does not deal with the parts in the refs subsystem which deal
with the submodules there. A later patch needs to get rid of the submodule
exposure in the refs API, such as 'get_submodule_ref_store(path)'.

Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: add repository argument to lookup_replace_object
Stefan Beller [Thu, 12 Apr 2018 00:21:13 +0000 (17:21 -0700)] 
replace-object: add repository argument to lookup_replace_object

Add a repository argument to allow callers of lookup_replace_object
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: add repository argument to do_lookup_replace_object
Stefan Beller [Thu, 12 Apr 2018 00:21:12 +0000 (17:21 -0700)] 
replace-object: add repository argument to do_lookup_replace_object

Add a repository argument to allow the do_lookup_replace_object caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: add repository argument to prepare_replace_object
Stefan Beller [Thu, 12 Apr 2018 00:21:11 +0000 (17:21 -0700)] 
replace-object: add repository argument to prepare_replace_object

Add a repository argument to allow the prepare_replace_object caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: add repository argument to for_each_replace_ref
Stefan Beller [Thu, 12 Apr 2018 00:21:10 +0000 (17:21 -0700)] 
refs: add repository argument to for_each_replace_ref

Add a repository argument to allow for_each_replace_ref callers to be
more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefs: add repository argument to get_main_ref_store
Stefan Beller [Thu, 12 Apr 2018 00:21:09 +0000 (17:21 -0700)] 
refs: add repository argument to get_main_ref_store

Add a repository argument to allow the get_main_ref_store caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: check_replace_refs is safe in multi repo environment
Stefan Beller [Thu, 12 Apr 2018 00:21:08 +0000 (17:21 -0700)] 
replace-object: check_replace_refs is safe in multi repo environment

In e1111cef23 (inline lookup_replace_object() calls, 2011-05-15) a shortcut
for checking the object replacement was added by setting check_replace_refs
to 0 once the replacements were evaluated to not exist. This works fine in
with the assumption of only one repository in existence.

The assumption won't hold true any more when we work on multiple instances
of a repository structs (e.g. one struct per submodule), as the first
repository to be inspected may have no replacements and would set the
global variable. Other repositories would then completely omit their
evaluation of replacements.

This reverts back the meaning of the flag `check_replace_refs` of
"Do we need to check with the lookup table?" to "Do we need to read
the replacement definition?", adding the bypassing logic to
lookup_replace_object after the replacement definition was read.
As with the original patch, delay the renaming of the global variable

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: eliminate replace objects prepared flag
Stefan Beller [Thu, 12 Apr 2018 00:21:07 +0000 (17:21 -0700)] 
replace-object: eliminate replace objects prepared flag

Make the oidmap a pointer.

That way we eliminate the need for the global boolean
variable 'replace_object_prepared' as we can put this information
into the pointer being NULL or not.

Another advantage of this is that we would more quickly catch
code that tries to access replace-map without initializing it.

This also allows the '#include "oidmap.h"' introduced in a previous
patch to be replaced by the forward declaration of 'struct oidmap;'.
Keeping the type opaque discourages circumventing accessor functions;
not dragging in other headers avoids some compile time overhead.

One disadvantage of this is change is performance as we need to
pay the overhead for a malloc. The alternative of moving the
global variable into the object store is less modular code.

Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject-store: move lookup_replace_object to replace-object.h
Stefan Beller [Thu, 12 Apr 2018 00:21:06 +0000 (17:21 -0700)] 
object-store: move lookup_replace_object to replace-object.h

lookup_replace_object is a low-level function that most users of the
object store do not need to use directly.

Move it to replace-object.h to avoid a dependency loop in an upcoming
change to its inline definition that will make use of repository.h.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object: move replace_map to object store
Stefan Beller [Thu, 12 Apr 2018 00:21:05 +0000 (17:21 -0700)] 
replace-object: move replace_map to object store

The relationship between an object X and another object Y that
replaces the object X is defined only within the scope of a
single repository.

The exception in reachability rule around these replacement objects
is also local to a repository (i.e. if traversal from refs reaches
X, then both X and Y are reachable and need to be kept from gc).

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace_object: use oidmap
René Scharfe [Thu, 12 Apr 2018 00:21:04 +0000 (17:21 -0700)] 
replace_object: use oidmap

Load the replace objects into an oidmap to allow for easy lookups in
constant time.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSubmittingPatches: mention the git contacts command
Thomas Gummerer [Wed, 11 Apr 2018 20:20:00 +0000 (21:20 +0100)] 
SubmittingPatches: mention the git contacts command

Instead of just mentioning 'git blame' and 'git shortlog', which make it
quite hard for new contributors to pick out the appropriate list of
people to cc on their patch series, mention the 'git contacts' utility,
which makes it much easier to get a reasonable list of contacts for a
change.

This should help new contributors pick out a reasonable cc list by
simply using a single command.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-import: introduce mem_pool type
Jameson Miller [Wed, 11 Apr 2018 18:37:54 +0000 (18:37 +0000)] 
fast-import: introduce mem_pool type

Introduce the mem_pool type which encapsulates all the information necessary to
manage a pool of memory. This change moves the existing variables in
fast-import used to support the global memory pool to use this structure. It
also renames variables that are no longer used by memory pools to reflect their
more scoped usage.

These changes allow for the multiple instances of a memory pool to
exist and be reused outside of fast-import. In a future commit the
mem_pool type will be moved to its own file.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-import: rename mem_pool type to mp_block
Jameson Miller [Wed, 11 Apr 2018 18:37:53 +0000 (18:37 +0000)] 
fast-import: rename mem_pool type to mp_block

This is part of a patch series to extract the memory pool logic in
fast-import into a more generalized version. The existing mem_pool type
maps more closely to a "block of memory" (mp_block) in the more
generalized memory pool. This commit renames the mem_pool to mp_block to
reduce churn in future patches.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn
Junio C Hamano [Wed, 11 Apr 2018 23:05:28 +0000 (08:05 +0900)] 
Merge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn

* 'svn/authors-prog-2' of git://bogomips.org/git-svn:
  git-svn: allow empty email-address using authors-prog and authors-file
  git-svn: search --authors-prog in PATH too

6 years agoreplace_object.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:21 +0000 (14:26 -0700)] 
replace_object.c: rename to use dash in file name

This is more consistent with the project style. The majority of
Git's source files use dashes in preference to underscores in their file
names.

Noticed while adding a header corresponding to this file.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agosha1_file.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:20 +0000 (14:26 -0700)] 
sha1_file.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agosha1_name.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:19 +0000 (14:26 -0700)] 
sha1_name.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agoexec_cmd: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:18 +0000 (14:26 -0700)] 
exec_cmd: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agounicode_width.h: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:17 +0000 (14:26 -0700)] 
unicode_width.h: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Also adjust contrib/update-unicode as well.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agowrite_or_die.c: rename to use dashes in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:16 +0000 (14:26 -0700)] 
write_or_die.c: rename to use dashes in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agomingw/msvc: use the new-style RUNTIME_PREFIX helper
Johannes Schindelin [Tue, 10 Apr 2018 15:05:46 +0000 (11:05 -0400)] 
mingw/msvc: use the new-style RUNTIME_PREFIX helper

This change also allows us to stop overriding argv[0] with the absolute
path of the executable, allowing us to preserve e.g. the case of the
executable's file name.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoexec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows
Johannes Schindelin [Tue, 10 Apr 2018 15:05:45 +0000 (11:05 -0400)] 
exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows

The RUNTIME_PREFIX feature comes from Git for Windows, but it was
enhanced to allow support for other platforms. While changing the
original idea, the concept was also improved by not forcing argv[0] to
be adjusted.

Let's allow the same for Windows by implementing a helper just as for
the other platforms.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoexec_cmd: RUNTIME_PREFIX on some POSIX systems
Dan Jacques [Tue, 10 Apr 2018 15:05:44 +0000 (11:05 -0400)] 
exec_cmd: RUNTIME_PREFIX on some POSIX systems

Enable Git to resolve its own binary location using a variety of
OS-specific and generic methods, including:

- procfs via "/proc/self/exe" (Linux)
- _NSGetExecutablePath (Darwin)
- KERN_PROC_PATHNAME sysctl on BSDs.
- argv0, if absolute (all, including Windows).

This is used to enable RUNTIME_PREFIX support for non-Windows systems,
notably Linux and Darwin. When configured with RUNTIME_PREFIX, Git will
do a best-effort resolution of its executable path and automatically use
this as its "exec_path" for relative helper and data lookups, unless
explicitly overridden.

Small incidental formatting cleanup of "exec_cmd.c".

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Robbie Iannucci <iannucci@google.com>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: add Perl runtime prefix support
Dan Jacques [Tue, 10 Apr 2018 15:05:43 +0000 (11:05 -0400)] 
Makefile: add Perl runtime prefix support

Broaden the RUNTIME_PREFIX flag to configure Git's Perl scripts to
locate the Git installation's Perl support libraries by resolving
against the script's path, rather than hard-coding that path at
build-time. Hard-coding at build time worked on previous
RUNTIME_PREFIX configurations (i.e., Windows) because the Perl
scripts were run within a virtual filesystem whose paths were
consistent regardless of the location of the actual installation.
This will no longer be the case for non-Windows RUNTIME_PREFIX users.

When enabled, RUNTIME_PREFIX now requires Perl's system paths to be
expressed relative to a common installation directory in the Makefile,
and uses that relationship to locate support files based on the known
starting point of the script being executed, much like RUNTIME_PREFIX
does for the Git binary.

This change enables Git's Perl scripts to work when their Git installation
is relocated or moved to another system, even when they are not in a
virtual filesystem environment.

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: generate Perl header from template file
Dan Jacques [Tue, 10 Apr 2018 15:05:42 +0000 (11:05 -0400)] 
Makefile: generate Perl header from template file

Currently, the generated Perl script headers are emitted by commands in
the Makefile. This mechanism restricts options to introduce alternative
header content, needed by Perl runtime prefix support, and obscures the
origin of the Perl script header.

Change the Makefile to generate a header by processing a template file and
move the header content into the "perl/" subdirectory. The generated
header content will now be stored in the "GIT-PERL-HEADER" file. This
allows the content of the Perl header to be controlled by changing the path
of the template in the Makefile.

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: force index write after full scan
Ben Peart [Tue, 10 Apr 2018 18:14:31 +0000 (14:14 -0400)] 
fsmonitor: force index write after full scan

fsmonitor currently only flags the index as dirty if the extension is being
added or removed. This is a performance optimization that recognizes you can
stat() a lot of files in less time than it takes to write out an updated index.

This patch makes a small enhancement and flags the index dirty if we end up
having to stat() all files and scan the entire working directory.  The assumption
being that must be expensive or you would not have turned on the feature.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRevert "Merge branch 'en/rename-directory-detection'"
Junio C Hamano [Wed, 11 Apr 2018 09:07:11 +0000 (18:07 +0900)] 
Revert "Merge branch 'en/rename-directory-detection'"

This reverts commit e4bb62fa1eeee689744b413e29a50b4d1dae6886, reversing
changes made to 468165c1d8a442994a825f3684528361727cd8c0.

The topic appears to inflict severe regression in renaming merges,
even though the promise of it was that it would improve them.

We do not yet know which exact change in the topic was wrong, but in
the meantime, let's play it safe and revert it out of 'master'
before real Git-using projects are harmed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: fix incorrect buffer size when printing version number
Ben Peart [Tue, 10 Apr 2018 18:43:43 +0000 (18:43 +0000)] 
fsmonitor: fix incorrect buffer size when printing version number

This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version.  It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>