]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 years agoremote: convert query_refspecs to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:12 +0000 (15:58 -0700)] 
remote: convert query_refspecs to take a struct refspec

Convert 'query_refspecs()' to take a 'struct refspec' as a parameter instead
of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert apply_refspecs to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:11 +0000 (15:58 -0700)] 
remote: convert apply_refspecs to take a struct refspec

Convert 'apply_refspecs()' to take a 'struct refspec' as a parameter instead
of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert get_stale_heads to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:10 +0000 (15:58 -0700)] 
remote: convert get_stale_heads to take a struct refspec

Convert 'get_stale_heads()' to take a 'struct refspec' as a parameter instead
of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: convert prune_refs to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:09 +0000 (15:58 -0700)] 
fetch: convert prune_refs to take a struct refspec

Convert 'prune_refs()' to take a 'struct refspec' as a parameter instead
of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: convert get_ref_map to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:08 +0000 (15:58 -0700)] 
fetch: convert get_ref_map to take a struct refspec

Convert 'get_ref_map()' to take a 'struct refspec' as a parameter
instead of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: convert do_fetch to take a struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:07 +0000 (15:58 -0700)] 
fetch: convert do_fetch to take a struct refspec

Convert 'do_fetch()' to take a 'struct refspec' as a parameter instead
of a list of 'struct refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: remove the deprecated functions
Brandon Williams [Wed, 16 May 2018 22:58:06 +0000 (15:58 -0700)] 
refspec: remove the deprecated functions

Now that there are no callers of 'parse_push_refspec()',
'parse_fetch_refspec()', and 'free_refspec()', remove these
functions.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: convert refmap to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:05 +0000 (15:58 -0700)] 
fetch: convert refmap to use struct refspec

Convert the refmap in builtin/fetch.c to be stored in a
'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: convert fetch_one to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:04 +0000 (15:58 -0700)] 
fetch: convert fetch_one to use struct refspec

Convert 'fetch_one()' to use 'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotransport-helper: convert to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:03 +0000 (15:58 -0700)] 
transport-helper: convert to use struct refspec

Convert the refspecs in transport-helper.c to be stored in a
'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: remove add_prune_tags_to_fetch_refspec
Brandon Williams [Wed, 16 May 2018 22:58:02 +0000 (15:58 -0700)] 
remote: remove add_prune_tags_to_fetch_refspec

Remove 'add_prune_tags_to_fetch_refspec()' function and instead have the
only caller directly add the tag refspec using 'refspec_append()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert fetch refspecs to struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:01 +0000 (15:58 -0700)] 
remote: convert fetch refspecs to struct refspec

Convert the set of fetch refspecs stored in 'struct remote' to use
'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert push refspecs to struct refspec
Brandon Williams [Wed, 16 May 2018 22:58:00 +0000 (15:58 -0700)] 
remote: convert push refspecs to struct refspec

Convert the set of push refspecs stored in 'struct remote' to use
'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-export: convert to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:59 +0000 (15:57 -0700)] 
fast-export: convert to use struct refspec

Convert fast-export to use 'struct refspec' instead of using a list of
refspec_item's.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoclone: convert cmd_clone to use refspec_item_init
Brandon Williams [Wed, 16 May 2018 22:57:58 +0000 (15:57 -0700)] 
clone: convert cmd_clone to use refspec_item_init

Convert 'cmd_clone()' to use 'refspec_item_init()' instead of relying on
the old 'parse_fetch_refspec()' to initialize a single refspec item.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert match_push_refs to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:57 +0000 (15:57 -0700)] 
remote: convert match_push_refs to use struct refspec

Convert 'match_push_refs()' to use struct refspec.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert check_push_refs to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:56 +0000 (15:57 -0700)] 
remote: convert check_push_refs to use struct refspec

Convert 'check_push_refs()' to use 'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotransport: convert transport_push to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:55 +0000 (15:57 -0700)] 
transport: convert transport_push to use struct refspec

Convert the logic in 'transport_push()' which calculates a list of
ref-prefixes to use 'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopull: convert get_tracking_branch to use refspec_item_init
Brandon Williams [Wed, 16 May 2018 22:57:54 +0000 (15:57 -0700)] 
pull: convert get_tracking_branch to use refspec_item_init

Convert 'get_tracking_branch()' to use 'refspec_item_init()' instead of
the old 'parse_fetch_refspec()' function.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule--helper: convert push_check to use struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:53 +0000 (15:57 -0700)] 
submodule--helper: convert push_check to use struct refspec

Convert 'push_check()' to use 'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: convert valid_fetch_refspec to use parse_refspec
Brandon Williams [Wed, 16 May 2018 22:57:52 +0000 (15:57 -0700)] 
refspec: convert valid_fetch_refspec to use parse_refspec

Convert 'valid_fetch_refspec()' to use the new 'parse_refspec()'
function to only parse a single refspec and eliminate an allocation.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: introduce struct refspec
Brandon Williams [Wed, 16 May 2018 22:57:51 +0000 (15:57 -0700)] 
refspec: introduce struct refspec

Introduce 'struct refspec', an abstraction around a collection of
'struct refspec_item's much like how 'struct pathspec' holds a
collection of 'struct pathspec_item's.

A refspec struct also contains an array of the original refspec strings
which will be used to facilitate the migration to using this new
abstraction throughout the code base.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: factor out parsing a single refspec
Brandon Williams [Wed, 16 May 2018 22:57:50 +0000 (15:57 -0700)] 
refspec: factor out parsing a single refspec

Factor out the logic which parses a single refspec into its own
function.  This makes it easier to reuse this logic in a future patch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: rename struct refspec to struct refspec_item
Brandon Williams [Wed, 16 May 2018 22:57:49 +0000 (15:57 -0700)] 
refspec: rename struct refspec to struct refspec_item

In preparation for introducing an abstraction around a collection of
refspecs (much like how a 'struct pathspec' is a collection of 'struct
pathspec_item's) rename the existing 'struct refspec' to 'struct
refspec_item'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefspec: move refspec parsing logic into its own file
Brandon Williams [Wed, 16 May 2018 22:57:48 +0000 (15:57 -0700)] 
refspec: move refspec parsing logic into its own file

In preparation for performing a refactor on refspec related code, move
the refspec parsing logic into its own file.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe fifth batch for 2.18
Junio C Hamano [Tue, 8 May 2018 06:50:30 +0000 (15:50 +0900)] 
The fifth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ma/http-walker-no-partial'
Junio C Hamano [Tue, 8 May 2018 06:59:35 +0000 (15:59 +0900)] 
Merge branch 'ma/http-walker-no-partial'

"git http-fetch" (deprecated) had an optional and experimental
"feature" to fetch only commits and/or trees, which nobody used.
This has been removed.

* ma/http-walker-no-partial:
  walker: drop fields of `struct walker` which are always 1
  http-fetch: make `-a` standard behaviour

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

* js/runtime-prefix:
  Avoid multiple PREFIX definitions
  git_setup_gettext: plug memory leak
  gettext: avoid initialization if the locale dir is not present

6 years agoMerge branch 'js/colored-push-errors'
Junio C Hamano [Tue, 8 May 2018 06:59:34 +0000 (15:59 +0900)] 
Merge branch 'js/colored-push-errors'

Error messages from "git push" can be painted for more visibility.

* js/colored-push-errors:
  config: document the settings to colorize push errors/hints
  push: test to verify that push errors are colored
  push: colorize errors
  color: introduce support for colorizing stderr

6 years agoMerge branch 'jc/parseopt-expiry-errors'
Junio C Hamano [Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)] 
Merge branch 'jc/parseopt-expiry-errors'

"git gc --prune=nonsense" spent long time repacking and then
silently failed when underlying "git prune --expire=nonsense"
failed to parse its command line.  This has been corrected.

* jc/parseopt-expiry-errors:
  parseopt: handle malformed --expire arguments more nicely
  gc: do not upcase error message shown with die()

6 years agoMerge branch 'ma/fast-export-skip-merge-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)] 
Merge branch 'ma/fast-export-skip-merge-fix'

"git fast-export" had a regression in v2.15.0 era where it skipped
some merge commits in certain cases, which has been corrected.

* ma/fast-export-skip-merge-fix:
  fast-export: fix regression skipping some merge-commits

6 years agoMerge branch 'tz/doc-git-urls-reference'
Junio C Hamano [Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)] 
Merge branch 'tz/doc-git-urls-reference'

Doc fix.

* tz/doc-git-urls-reference:
  doc/clone: update caption for GIT URLS cross-reference

6 years agoMerge branch 'tg/demote-stash-save-in-completion'
Junio C Hamano [Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)] 
Merge branch 'tg/demote-stash-save-in-completion'

The command line completion (in contrib/) has been taught that "git
stash save" has been deprecated ("git stash push" is the preferred
spelling in the new world) and does not offer it as a possible
completion candidate when "git stash push" can be.

* tg/demote-stash-save-in-completion:
  completion: make stash -p and alias for stash push -p
  completion: stop showing 'save' for stash by default

6 years agoMerge branch 'sa/send-email-dedup-some-headers'
Junio C Hamano [Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)] 
Merge branch 'sa/send-email-dedup-some-headers'

When fed input that already has In-Reply-To: and/or References:
headers and told to add the same information, "git send-email"
added these headers separately, instead of appending to an existing
one, which is a violation of the RFC.  This has been corrected.

* sa/send-email-dedup-some-headers:
  send-email: avoid duplicate In-Reply-To/References

6 years agoMerge branch 'nd/submodule-status-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)] 
Merge branch 'nd/submodule-status-fix'

"git submodule status" did not check the symbolic revision name it
computed for the submodule HEAD is not the NULL, and threw it at
printf routines, which has been corrected.

* nd/submodule-status-fix:
  submodule--helper: don't print null in 'submodule status'

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

During a "rebase -i" session, the code could give older timestamp
to commits created by later "pick" than an earlier "reword", which
has been corrected.

* js/ident-date-fix:
  sequencer: reset the committer date before commits

6 years agoMerge branch 'bt/gpg-interface'
Junio C Hamano [Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)] 
Merge branch 'bt/gpg-interface'

What is queued here is only the obviously correct and
uncontroversial code clean-up part, which is an earlier 7 patches,
of a larger series.

The remainder that is not queued introduces a few configuration
variables to deal with e-signature backends with different
signature format.

* bt/gpg-interface:
  gpg-interface: find the last gpg signature line
  gpg-interface: extract gpg line matching helper
  gpg-interface: fix const-correctness of "eol" pointer
  gpg-interface: use size_t for signature buffer size
  gpg-interface: modernize function declarations
  gpg-interface: handle bool user.signingkey
  t7004: fix mistaken tag name

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

"git ls-remote" learned an option to allow sorting its output based
on the refnames being shown.

* hn/sort-ls-remote:
  ls-remote: create '--sort' option

6 years agoMerge branch 'ab/git-svn-get-record-typofix'
Junio C Hamano [Tue, 8 May 2018 06:59:28 +0000 (15:59 +0900)] 
Merge branch 'ab/git-svn-get-record-typofix'

"git svn" had a minor thinko/typo which has been fixed.

* ab/git-svn-get-record-typofix:
  git-svn: avoid warning on undef readline()

6 years agoMerge branch 'tb/config-default'
Junio C Hamano [Tue, 8 May 2018 06:59:27 +0000 (15:59 +0900)] 
Merge branch 'tb/config-default'

"git config --get" learned the "--default" option, to help the
calling script.  Building on top of the tb/config-type topic, the
"git config" learns "--type=color" type.  Taken together, you can
do things like "git config --get foo.color --default blue" and get
the ANSI color sequence for the color given to foo.color variable,
or "blue" if the variable does not exist.

* tb/config-default:
  builtin/config: introduce `color` type specifier
  config.c: introduce 'git_config_color' to parse ANSI colors
  builtin/config: introduce `--default`

6 years agoMerge branch 'tb/config-type'
Junio C Hamano [Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)] 
Merge branch 'tb/config-type'

The "git config" command uses separate options e.g. "--int",
"--bool", etc. to specify what type the caller wants the value to
be interpreted as.  A new "--type=<typename>" option has been
introduced, which would make it cleaner to define new types.

* tb/config-type:
  builtin/config.c: support `--type=<type>` as preferred alias for `--<type>`
  builtin/config.c: treat type specifiers singularly

6 years agoMerge branch 'sg/doc-gc-quote-mismatch-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)] 
Merge branch 'sg/doc-gc-quote-mismatch-fix'

Doc formatting fix.

* sg/doc-gc-quote-mismatch-fix:
  docs/git-gc: fix minor rendering issue

6 years agoMerge branch 'sg/completion-clear-cached'
Junio C Hamano [Tue, 8 May 2018 06:59:25 +0000 (15:59 +0900)] 
Merge branch 'sg/completion-clear-cached'

The completion script (in contrib/) learned to clear cached list of
command line options upon dot-sourcing it again in a more efficient
way.

* sg/completion-clear-cached:
  completion: reduce overhead of clearing cached --options

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 agoAvoid multiple PREFIX definitions
Philip Oakley [Sat, 21 Apr 2018 11:18:42 +0000 (13:18 +0200)] 
Avoid multiple PREFIX definitions

The short and sweet PREFIX can be confused when used in many places.

Rename both usages to better describe their purpose. EXEC_CMD_PREFIX is
used in full to disambiguate it from the nearby GIT_EXEC_PATH.

The PREFIX in sideband.c, while nominally independant of the exec_cmd
PREFIX, does reside within libgit[1], so the definitions would clash
when taken together with a PREFIX given on the command line for use by
exec_cmd.c.

Noticed when compiling Git for Windows using MSVC/Visual Studio [1] which
reports the conflict beteeen the command line definition and the
definition in sideband.c within the libgit project.

[1] the libgit functions are brought into a single sub-project
within the Visual Studio construction script provided in contrib,
and hence uses a single command for both exec_cmd.c and sideband.c.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit_setup_gettext: plug memory leak
Johannes Schindelin [Sat, 21 Apr 2018 11:14:28 +0000 (13:14 +0200)] 
git_setup_gettext: plug memory leak

The system_path() function returns a freshly-allocated string. We need
to release it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogettext: avoid initialization if the locale dir is not present
Johannes Schindelin [Sat, 21 Apr 2018 11:14:08 +0000 (13:14 +0200)] 
gettext: avoid initialization if the locale dir is not present

The runtime of a simple `git.exe version` call on Windows is currently
dominated by the gettext setup, adding a whopping ~150ms to the ~210ms
total.

Given that this cost is added to each and every git.exe invocation goes
through common-main's invocation of git_setup_gettext(), and given that
scripts have to call git.exe dozens, if not hundreds, of times, this is
a substantial performance penalty.

This is particularly pointless when considering that Git for Windows
ships without localization (to keep the installer's size to a bearable
~34MB): all that time setting up gettext is for naught.

To be clear, Git for Windows *needs* to be compiled with localization,
for the following reasons:

- to allow users to copy add-on localization in case they want it, and

- to fix the nasty error message

BUG: your vsnprintf is broken (returned -1)

  by using libgettext's override of vsnprintf() that does not share the
  behavior of msvcrt.dll's version of vsnprintf().

So let's be smart about it and skip setting up gettext if the locale
directory is not even present.

Since localization might be missing for not-yet-supported locales, this
will not break anything.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agowalker: drop fields of `struct walker` which are always 1
Martin Ågren [Sun, 22 Apr 2018 18:12:50 +0000 (20:12 +0200)] 
walker: drop fields of `struct walker` which are always 1

After the previous commit, both users of `struct walker` set `get_tree`,
`get_history` and `get_all` to 1. Drop those fields and simplify the
walker implementation accordingly.

Let's hope that any out-of-tree users will not mind this change. They
should notice that the compilation fails as they try to set these
fields. (If they do not set them, note that `get_http_walker()` leaves
them undefined, so the behavior will have been undefined all the time.)

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agohttp-fetch: make `-a` standard behaviour
Martin Ågren [Sun, 22 Apr 2018 18:12:49 +0000 (20:12 +0200)] 
http-fetch: make `-a` standard behaviour

This is a follow-up to a6c786fce8 (Mark http-fetch without -a as
deprecated, 2011-08-23). For more than six years, we have been warning
when `-a` is not provided, and the documentation has been saying that
`-a` will become the default.

It is a bit unclear what "default" means here. There is no such thing as
`http-fetch --no-a`. But according to my searches, no-one has been
asking on the mailing list how they should silence the warning and
prepare for overriding the flipped default. So let's assume that
everybody is happy with `-a`. They should be, since not using it may
break the repo in such a way that Git itself is unable to fix it.

Always behave as if `-a` was given. Since `-a` implies `-c` (get commit
objects) and `-t` (get trees), all three options are now unnecessary.
Document all of these as historical artefacts that have no effect.

Leave no-op code for handling these options in http-fetch.c. The
options-handling is currently rather loose. If someone tightens it, we
will not want these ignored options to accidentally turn into hard
errors.

Since `-a` was the only safe and sane usage and we have been pushing
people towards it for a long time, refrain from warning when it is used
"unnecessarily" now. Similarly, do not add anything scary-looking to the
man-page about how it will be removed in the future. We can always do so
later. (It is not like we are in desperate need of freeing up
one-letter arguments.)

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconfig: document the settings to colorize push errors/hints
Johannes Schindelin [Sat, 21 Apr 2018 10:10:07 +0000 (12:10 +0200)] 
config: document the settings to colorize push errors/hints

Let's make it easier for users to find out how to customize these colors.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopush: test to verify that push errors are colored
Johannes Schindelin [Sat, 21 Apr 2018 10:10:04 +0000 (12:10 +0200)] 
push: test to verify that push errors are colored

This actually only tests whether the push errors/hints are colored if
the respective color.* config settings are `always`, but in the regular
case they default to `auto` (in which case we color the messages when
stderr is connected to an interactive terminal), therefore these tests
should suffice.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopush: colorize errors
Ryan Dammrose [Sat, 21 Apr 2018 10:10:00 +0000 (12:10 +0200)] 
push: colorize errors

This is an attempt to resolve an issue I experience with people that are
new to Git -- especially colleagues in a team setting -- where they miss
that their push to a remote location failed because the failure and
success both return a block of white text.

An example is if I push something to a remote repository and then a
colleague attempts to push to the same remote repository and the push
fails because it requires them to pull first, but they don't notice
because a success and failure both return a block of white text. They
then continue about their business, thinking it has been successfully
pushed.

This patch colorizes the errors and hints (in red and yellow,
respectively) so whenever there is a failure when pushing to a remote
repository that fails, it is more noticeable.

[jes: fixed a couple bugs, added the color.{advice,push,transport}
settings, refactored to use want_color_stderr().]

Signed-off-by: Ryan Dammrose ryandammrose@gmail.com
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocolor: introduce support for colorizing stderr
Johannes Schindelin [Sat, 21 Apr 2018 10:09:57 +0000 (12:09 +0200)] 
color: introduce support for colorizing stderr

So far, we only ever asked whether stdout wants to be colorful. In the
upcoming patches, we will want to make push errors more prominent, which
are printed to stderr, though.

So let's refactor the want_color() function into a want_color_fd()
function (which expects to be called with fd == 1 or fd == 2 for stdout
and stderr, respectively), and then define the macro `want_color()` to
use the want_color_fd() function.

And then also add a macro `want_color_stderr()`, for convenience and
for documentation.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/config: introduce `color` type specifier
Taylor Blau [Tue, 10 Apr 2018 00:18:31 +0000 (17:18 -0700)] 
builtin/config: introduce `color` type specifier

As of this commit, the canonical way to retreive an ANSI-compatible
color escape sequence from a configuration file is with the
`--get-color` action.

This is to allow Git to "fall back" on a default value for the color
should the given section not exist in the specified configuration(s).

With the addition of `--default`, this is no longer needed since:

  $ git config --default red --type=color core.section

will be have exactly as:

  $ git config --get-color core.section red

For consistency, let's introduce `--type=color` and encourage its use
with `--default` together over `--get-color` alone.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconfig.c: introduce 'git_config_color' to parse ANSI colors
Taylor Blau [Tue, 10 Apr 2018 00:18:28 +0000 (17:18 -0700)] 
config.c: introduce 'git_config_color' to parse ANSI colors

In preparation for adding `--type=color` to the `git-config(1)` builtin,
let's introduce a color parsing utility, `git_config_color` in a similar
fashion to `git_config_<type>`.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>