Commit graph

51902 commits

Author SHA1 Message Date
Junio C Hamano e47dbece39 Merge branch 'ma/unpack-trees-free-msgs'
Leak plugging.

* ma/unpack-trees-free-msgs:
  unpack_trees_options: free messages when done
  argv-array: return the pushed string from argv_push*()
  merge-recursive: provide pair of `unpack_trees_{start,finish}()`
  merge: setup `opts` later in `checkout_fast_forward()`
2018-05-30 21:51:29 +09:00
Junio C Hamano 9472b13201 Merge branch 'bc/hash-independent-tests'
Many tests hardcode the raw object names, which would change once
we migrate away from SHA-1.  While some of them must test against
exact object names, most of them do not have to use hardcoded
constants in the test.  The latter kind of tests have been updated
to test the moral equivalent of the original without hardcoding the
actual object names.

* bc/hash-independent-tests: (28 commits)
  t5300: abstract away SHA-1-specific constants
  t4208: abstract away SHA-1-specific constants
  t4045: abstract away SHA-1-specific constants
  t4042: abstract away SHA-1-specific constants
  t4205: sort log output in a hash-independent way
  t/lib-diff-alternative: abstract away SHA-1-specific constants
  t4030: abstract away SHA-1-specific constants
  t4029: abstract away SHA-1-specific constants
  t4029: fix test indentation
  t4022: abstract away SHA-1-specific constants
  t4020: abstract away SHA-1-specific constants
  t4014: abstract away SHA-1-specific constants
  t4008: abstract away SHA-1-specific constants
  t4007: abstract away SHA-1-specific constants
  t3905: abstract away SHA-1-specific constants
  t3702: abstract away SHA-1-specific constants
  t3103: abstract away SHA-1-specific constants
  t2203: abstract away SHA-1-specific constants
  t: skip pack tests if not using SHA-1
  t4044: skip test if not using SHA-1
  ...
2018-05-30 21:51:28 +09:00
Junio C Hamano d89f1248aa Merge branch 'ma/regex-no-regfree-after-comp-fail'
We used to call regfree() after regcomp() failed in some codepaths,
which have been corrected.

* ma/regex-no-regfree-after-comp-fail:
  regex: do not call `regfree()` if compilation fails
2018-05-30 21:51:28 +09:00
Junio C Hamano 3f384aaac4 Merge branch 'ma/config-store-data-clear'
Leak plugging.

* ma/config-store-data-clear:
  config: let `config_store_data_clear()` handle `key`
  config: let `config_store_data_clear()` handle `value_regex`
  config: free resources of `struct config_store_data`
2018-05-30 21:51:28 +09:00
Junio C Hamano 7c3d15fe31 Merge branch 'jk/snprintf-truncation'
Avoid unchecked snprintf() to make future code auditing easier.

* jk/snprintf-truncation:
  fmt_with_err: add a comment that truncation is OK
  shorten_unambiguous_ref: use xsnprintf
  fsmonitor: use internal argv_array of struct child_process
  log_write_email_headers: use strbufs
  http: use strbufs instead of fixed buffers
2018-05-30 21:51:28 +09:00
Junio C Hamano b2fd659294 Merge branch 'jk/config-blob-sans-repo'
Error codepath fix.

* jk/config-blob-sans-repo:
  config: die when --blob is used outside a repository
2018-05-30 21:51:27 +09:00
Junio C Hamano 0821b73063 Merge branch 'sb/submodule-merge-in-merge-recursive'
By code restructuring of submodule merge in merge-recursive,
informational messages from the codepath are now given using the
same mechanism as other output, and honor the merge.verbosity
configuration.  The code also learned to give a few new messages
when a submodule three-way merge resolves cleanly when one side
records a descendant of the commit chosen by the other side.

* sb/submodule-merge-in-merge-recursive:
  merge-recursive: give notice when submodule commit gets fast-forwarded
  merge-recursive: i18n submodule merge output and respect verbosity
  submodule.c: move submodule merging to merge-recursive.c
2018-05-30 21:51:27 +09:00
Junio C Hamano 2305770816 Merge branch 'js/empty-config-section-fix'
Error codepath fix.

* js/empty-config-section-fix:
  config: a user-provided invalid section is not a BUG
2018-05-30 21:51:26 +09:00
Junio C Hamano e12cbeaa62 Merge branch 'bw/ref-prefix-for-configured-refspec'
"git fetch $there $refspec" that talks over protocol v2 can take
advantage of server-side ref filtering; the code has been extended
so that this mechanism triggers also when fetching with configured
refspec.

* bw/ref-prefix-for-configured-refspec: (38 commits)
  fetch: generate ref-prefixes when using a configured refspec
  refspec: consolidate ref-prefix generation logic
  submodule: convert push_unpushed_submodules to take a struct refspec
  remote: convert check_push_refs to take a struct refspec
  remote: convert match_push_refs to take a struct refspec
  http-push: store refspecs in a struct refspec
  transport: remove transport_verify_remote_names
  send-pack: store refspecs in a struct refspec
  transport: convert transport_push to take a struct refspec
  push: convert to use struct refspec
  push: check for errors earlier
  remote: convert match_explicit_refs to take a struct refspec
  remote: convert get_ref_match to take a struct refspec
  remote: convert query_refspecs to take a struct refspec
  remote: convert apply_refspecs to take a struct refspec
  remote: convert get_stale_heads to take a struct refspec
  fetch: convert prune_refs to take a struct refspec
  fetch: convert get_ref_map to take a struct refspec
  fetch: convert do_fetch to take a struct refspec
  refspec: remove the deprecated functions
  ...
2018-05-30 21:51:26 +09:00
Junio C Hamano 6ac5acae2d Merge branch 'sb/grep-die-on-unreadable-index'
Error behaviour of "git grep" when it cannot read the index was
inconsistent with other commands that uses the index, which has
been corrected to error out early.

* sb/grep-die-on-unreadable-index:
  grep: handle corrupt index files early
2018-05-30 21:51:26 +09:00
Junio C Hamano f15a486ca1 The seventh batch for 2.18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-30 14:10:34 +09:00
Junio C Hamano a173dddf44 Merge branch 'sb/submodule-update-try-harder'
"git submodule update" attempts two different kinds of "git fetch"
against the upstream repository to grab a commit bound at the
submodule's path, but it incorrectly gave up if the first kind
(i.e. a normal fetch) failed, making the second "last resort" one
(i.e. fetching an exact commit object by object name) ineffective.
This has been corrected.

* sb/submodule-update-try-harder:
  git-submodule.sh: try harder to fetch a submodule
2018-05-30 14:04:12 +09:00
Junio C Hamano 017b7c52fc Merge branch 'lm/credential-netrc'
Update credential-netrc helper (in contrib/) to allow customizing
the GPG used to decrypt the encrypted .netrc file.

* lm/credential-netrc:
  git-credential-netrc: accept gpg option
  git-credential-netrc: adapt to test framework for git
2018-05-30 14:04:11 +09:00
Junio C Hamano ab48bc0aea Merge branch 'ab/get-short-oid'
When a short hexadecimal string is used to name an object but there
are multiple objects that share the string as the prefix of their
names, the code lists these ambiguous candidates in a help message.
These object names are now sorted according to their types for
easier eyeballing.

* ab/get-short-oid:
  get_short_oid: sort ambiguous objects by type, then SHA-1
  sha1-name.c: move around the collect_ambiguous() function
  git-p4: change "commitish" typo to "committish"
  sha1-array.h: align function arguments
  sha1-name.c: remove stray newline
2018-05-30 14:04:11 +09:00
Junio C Hamano 54db5c0e1e Merge branch 'jt/partial-clone-proto-v2'
Transfer protocol v2 learned to support the partial clone.

* jt/partial-clone-proto-v2:
  {fetch,upload}-pack: support filter in protocol v2
  upload-pack: read config when serving protocol v2
  upload-pack: fix error message typo
2018-05-30 14:04:10 +09:00
Junio C Hamano 42c8ce1c49 Merge branch 'bc/object-id'
Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (42 commits)
  merge-one-file: compute empty blob object ID
  add--interactive: compute the empty tree value
  Update shell scripts to compute empty tree object ID
  sha1_file: only expose empty object constants through git_hash_algo
  dir: use the_hash_algo for empty blob object ID
  sequencer: use the_hash_algo for empty tree object ID
  cache-tree: use is_empty_tree_oid
  sha1_file: convert cached object code to struct object_id
  builtin/reset: convert use of EMPTY_TREE_SHA1_BIN
  builtin/receive-pack: convert one use of EMPTY_TREE_SHA1_HEX
  wt-status: convert two uses of EMPTY_TREE_SHA1_HEX
  submodule: convert several uses of EMPTY_TREE_SHA1_HEX
  sequencer: convert one use of EMPTY_TREE_SHA1_HEX
  merge: convert empty tree constant to the_hash_algo
  builtin/merge: switch tree functions to use object_id
  builtin/am: convert uses of EMPTY_TREE_SHA1_BIN to the_hash_algo
  sha1-file: add functions for hex empty tree and blob OIDs
  builtin/receive-pack: avoid hard-coded constants for push certs
  diff: specify abbreviation size in terms of the_hash_algo
  upload-pack: replace use of several hard-coded constants
  ...
2018-05-30 14:04:10 +09:00
Junio C Hamano 3d24129799 Merge branch 'sb/blame-color'
"git blame" learns to unhighlight uninteresting metadata from the
originating commit on lines that are the same as the previous one,
and also paint lines in different colors depending on the age of
the commit.

* sb/blame-color:
  builtin/blame: add new coloring scheme config
  builtin/blame: highlight recently changed lines
  builtin/blame: dim uninteresting metadata lines
2018-05-30 14:04:09 +09:00
Junio C Hamano 2a98a8794e Merge branch 'cf/submodule-progress-dissociate'
"git submodule update" and "git submodule add" supported the
"--reference" option to borrow objects from a neighbouring local
repository like "git clone" does, but lacked the more recent
invention "--dissociate".  Also "git submodule add" has been taught
to take the "--progress" option.

* cf/submodule-progress-dissociate:
  submodule: add --dissociate option to add/update commands
  submodule: add --progress option to add command
  submodule: clean up substitutions in script
2018-05-30 14:04:09 +09:00
Junio C Hamano 4ce72180ab Merge branch 'sg/complete-paths'
Command line completion (in contrib/) learned to complete pathnames
for various commands better.

* sg/complete-paths:
  t9902-completion: exercise __git_complete_index_file() directly
  completion: don't return with error from __gitcomp_file_direct()
  completion: fill COMPREPLY directly when completing paths
  completion: improve handling quoted paths in 'git ls-files's output
  completion: remove repeated dirnames with 'awk' during path completion
  t9902-completion: ignore COMPREPLY element order in some tests
  completion: use 'awk' to strip trailing path components
  completion: let 'ls-files' and 'diff-index' filter matching paths
  completion: improve handling quoted paths on the command line
  completion: support completing non-ASCII pathnames
  completion: simplify prefix path component handling during path completion
  completion: move __git_complete_index_file() next to its helpers
  t9902-completion: add tests demonstrating issues with quoted pathnames
2018-05-30 14:04:08 +09:00
Junio C Hamano 6105fee3fd Merge branch 'nd/travis-gcc-8'
Developer support.  Use newer GCC on one of the builds done at
TravisCI.org to get more warnings and errors diagnosed.

* nd/travis-gcc-8:
  travis-ci: run gcc-8 on linux-gcc jobs
2018-05-30 14:04:08 +09:00
Junio C Hamano a4eae17c2c Merge branch 'nd/pack-struct-commit'
Memory optimization.

* nd/pack-struct-commit:
  commit.h: rearrange 'index' to shrink struct commit
2018-05-30 14:04:08 +09:00
Junio C Hamano 26597cb0cc Merge branch 'ma/create-pseudoref-with-null-old-oid'
"git update-ref A B" is supposed to ensure that ref A does not yet
exist when B is a NULL OID, but this check was not done correctly
for pseudo-refs outside refs/ hierarchy, e.g. MERGE_HEAD.

* ma/create-pseudoref-with-null-old-oid:
  refs: handle zero oid for pseudorefs
  t1400: add tests around adding/deleting pseudorefs
  refs.c: refer to "object ID", not "sha1", in error messages
2018-05-30 14:04:08 +09:00
Junio C Hamano cf315793c1 Merge branch 'jk/unavailable-can-be-missing'
Code clean-up to turn history traversal more robust in a
semi-corrupt repository.

* jk/unavailable-can-be-missing:
  mark_parents_uninteresting(): avoid most allocation
  mark_parents_uninteresting(): replace list with stack
  mark_parents_uninteresting(): drop missing object check
  mark_tree_contents_uninteresting(): drop missing object check
2018-05-30 14:04:08 +09:00
Junio C Hamano 5da4847dcc Merge branch 'bp/status-rename-config'
"git status" learned to honor a new status.renames configuration to
skip rename detection, which could be useful for those who want to
do so without disabling the default rename detection done by the
"git diff" command.

* bp/status-rename-config:
  add status config and command line options for rename detection
2018-05-30 14:04:07 +09:00
Junio C Hamano 50f08db594 Merge branch 'js/use-bug-macro'
Developer support update, by using BUG() macro instead of die() to
mark codepaths that should not happen more clearly.

* js/use-bug-macro:
  BUG_exit_code: fix sparse "symbol not declared" warning
  Convert remaining die*(BUG) messages
  Replace all die("BUG: ...") calls by BUG() ones
  run-command: use BUG() to report bugs, not die()
  test-tool: help verifying BUG() code paths
2018-05-30 14:04:07 +09:00
Junio C Hamano bef896e4ab Merge branch 'rs/no-null-ptr-arith-in-fast-export'
Code clean-up to avoid non-standard-conformant pointer arithmetic.

* rs/no-null-ptr-arith-in-fast-export:
  fast-export: avoid NULL pointer arithmetic
2018-05-30 14:04:06 +09:00
Junio C Hamano 0abb962893 Merge branch 'nd/repo-clear-keep-the-index'
the_repository->index is not a allocated piece of memory but
repo_clear() indiscriminately attempted to free(3) it, which has
been corrected.

* nd/repo-clear-keep-the-index:
  repository: fix free problem with repo_clear(the_repository)
2018-05-30 14:04:05 +09:00
Junio C Hamano 2f76ebc93c Merge branch 'ma/lockfile-cleanup'
Code clean-up to adjust to a more recent lockfile API convention that
allows lockfile instances kept on the stack.

* ma/lockfile-cleanup:
  lock_file: move static locks into functions
  lock_file: make function-local locks non-static
  refs.c: do not die if locking fails in `delete_pseudoref()`
  refs.c: do not die if locking fails in `write_pseudoref()`
  t/helper/test-write-cache: clean up lock-handling
2018-05-30 14:04:05 +09:00
Junio C Hamano 0e7af5f6d1 Merge branch 'sg/t6500-no-redirect-of-stdin'
Test cleanup.

* sg/t6500-no-redirect-of-stdin:
  t6050-replace: don't disable stdin for the whole test script
2018-05-30 14:04:04 +09:00
Junio C Hamano 6e2ba77bda Merge branch 'bp/merge-rename-config'
With merge.renames configuration set to false, the recursive merge
strategy can be told not to spend cycles trying to find renamed
paths and merge them accordingly.

* bp/merge-rename-config:
  merge: pass aggressive when rename detection is turned off
  merge: add merge.renames config setting
  merge: update documentation for {merge,diff}.renameLimit
2018-05-30 14:04:04 +09:00
Junio C Hamano c5aa4bccb5 Merge branch 'js/sequencer-and-root-commits'
The implementation of "git rebase -i --root" has been updated to use
the sequencer machinery more.

* js/sequencer-and-root-commits:
  rebase --rebase-merges: root commits can be cousins, too
  rebase --rebase-merges: a "merge" into a new root is a fast-forward
  sequencer: allow introducing new root commits
  rebase -i --root: let the sequencer handle even the initial part
  sequencer: learn about the special "fake root commit" handling
  sequencer: extract helper to update active_cache_tree
2018-05-30 14:04:04 +09:00
Junio C Hamano 89be19d708 Merge branch 'dd/send-email-reedit'
"git send-email" can sometimes offer confirmation dialog "Send this
email?" with choices 'Yes', 'No', 'Quit', and 'All'.  A new action
'Edit' has been added to this dialog's choice.

* dd/send-email-reedit:
  git-send-email: allow re-editing of message
2018-05-30 14:04:03 +09:00
Robert P. J. Day 44f560fc16 init: fix grammar in "templates not found" msg
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-30 13:32:40 +09:00
brian m. carlson 5971b0836e sequencer: ensure labels that are object IDs are rewritten
When writing the todo script for --rebase-merges, we try to find a label
for certain commits.  If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.

However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID.  Instead, check for the length being
equivalent to that of a hex object ID.  Use the_hash_algo so this code
works regardless of the hash size.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-30 13:32:16 +09:00
Christian Couder 5340d47107 t990X: use '.git/objects' as 'deep inside .git' path
Tests t9902-completion.sh and t9903-bash-prompt.sh each have tests
that check what happens when we are "in the '.git' directory" and
when we are "deep inside the '.git' directory".

To test the case when we are "deep inside the '.git' directory" the
test scripts used to perform a `cd .git/refs/heads`.

As there are plans to implement other ref storage systems, let's
use '.git/objects' instead of '.git/refs/heads' as the "deep inside
the '.git' directory" path.

This makes it clear to readers that these tests do not depend on
which ref backend is used.

The internals of the loose refs backend are still tested in
t1400-update-ref.sh.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-30 12:55:53 +09:00
Junio C Hamano 7913f53b56 Sync with Git 2.17.1
* maint: (25 commits)
  Git 2.17.1
  Git 2.16.4
  Git 2.15.2
  Git 2.14.4
  Git 2.13.7
  fsck: complain when .gitmodules is a symlink
  index-pack: check .gitmodules files with --strict
  unpack-objects: call fsck_finish() after fscking objects
  fsck: call fsck_finish() after fscking objects
  fsck: check .gitmodules content
  fsck: handle promisor objects in .gitmodules check
  fsck: detect gitmodules files
  fsck: actually fsck blob data
  fsck: simplify ".git" check
  index-pack: make fsck error message more specific
  verify_path: disallow symlinks in .gitmodules
  update-index: stat updated files earlier
  verify_dotfile: mention case-insensitivity in comment
  verify_path: drop clever fallthrough
  skip_prefix: add case-insensitive variant
  ...
2018-05-29 17:10:05 +09:00
Nguyễn Thái Ngọc Duy f22f682695 completion: complete general config vars in two steps
There are 581 config variables as of now when you do "git config
<tab>" which can fill up a few screens and is not very helpful when
you have to look through columns of text to find what you want.

This patch instead shows you only first level when you do

    git config <tab>

There are 78 items, which use up 8 rows in my screen. Compared to
screens of text, it's pretty good. Once you have chosen you first
level, e.g. color:

    git config color.<tab>

will show you all color.*

This is not a new idea. branch.* and remote.* completion already does
this for second and third levels. For those variables, you'll need to
<tab> three times to get full variable name.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:29 +09:00
Nguyễn Thái Ngọc Duy 09c4ba410b log-tree: allow to customize 'grafted' color
Commit 76f5df305b (log: decorate grafted commits with "grafted" -
2011-08-18) lets us decorate grafted commits but I forgot about the
color.decorate.* config.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:29 +09:00
Nguyễn Thái Ngọc Duy bea2125928 completion: support case-insensitive config vars
Config variables are case-insensitive but this case/esac construct is
case-sensitive by default. For bash v4, it'll be easy. For platforms
that are stuck with older versions, we need an external command, but
that is not that critical. And where this additional overhead matters
the most is Windows, but luckily Git for Windows ships with Bash v4.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:29 +09:00
Nguyễn Thái Ngọc Duy f45db831c1 completion: keep other config var completion in camelCase
The last patch makes "git config <tab>" shows camelCase names because
that's what's in the source: config.txt. There are still a couple
manual var completion in this code. Let's make them follow the naming
convention as well.

In theory we could automate this part too because we have the
information. But let's stick to one step at a time and leave this for
later.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy e17ca92637 completion: drop the hard coded list of config vars
The new help option --config-for-completion is a machine friendlier
version of --config where all the placeholders and wildcards are
dropped, leaving only the good, completable prefixes for
git-completion.bash to consume.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy 431bb23a27 am: move advice.amWorkDir parsing back to advice.c
The only benefit from this move (apart from cleaner code) is that
advice.amWorkDir should now show up in `git help --config`. There
should be no regression since advice config is always read by the
git_default_config().

While at there, use advise() like other code. We now get "hint: "
prefix and the output is stderr instead of stdout (which is also the
reason for the test update because stderr is checked in a following
test and the extra advice can fail it).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy fb6fbffbda advice: keep config name in camelCase in advice_config[]
For parsing, we don't really need this because the main config parser
will lowercase everything so we can do exact matching. But this array
now is also used for printing in `git help --config`. Keep camelCase
so we have a nice printout.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy a4a9cc19a2 fsck: produce camelCase config key names
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy 3ac68a93fd help: add --config to list all available config
Sometimes it helps to list all available config vars so the user can
search for something they want. The config man page can also be used
but it's harder to search if you want to focus on the variable name,
for example.

This is not the best way to collect the available config since it's
not precise. Ideally we should have a centralized list of config in C
code (pretty much like 'struct option'), but that's a lot more work.
This will do for now.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy a46baac61e fsck: factor out msg_id_info[] lazy initialization code
This array will be used by some other function than parse_msg_id() in
the following commit. Factor out this prep code so it could be called
from that one.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy fa151dc54d grep: keep all colors in an array
This is more inline with how we handle color slots in other code. It
also allows us to get the list of configurable color slots later.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Nguyễn Thái Ngọc Duy a73b3680c4 Add and use generic name->id mapping code for color slot parsing
Instead of hard coding the name-to-id mapping in C code, keep it in an
array and use a common function to do the parsing. This reduces code
and also allows us to list all possible color slots later.

This starts using C99 designated initializers more for convenience
(the first designated initializers have been introduced in builtin/clean.c
for some time without complaints)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 14:51:28 +09:00
Junio C Hamano 17b3e51505 Merge branch 'nd/command-list' into nd/complete-config-vars
* nd/command-list:
  completion: allow to customize the completable command list
  completion: add and use --list-cmds=alias
  completion: add and use --list-cmds=nohelpers
  Move declaration for alias.c to alias.h
  completion: reduce completable command list
  completion: let git provide the completable command list
  command-list.txt: documentation and guide line
  help: use command-list.txt for the source of guides
  help: add "-a --verbose" to list all commands with synopsis
  git: support --list-cmds=list-<category>
  completion: implement and use --list-cmds=main,others
  git --list-cmds: collect command list in a string_list
  git.c: convert --list-* to --list-cmds=*
  Remove common-cmds.h
  help: use command-list.h for common command list
  generate-cmds.sh: export all commands to command-list.h
  generate-cmds.sh: factor out synopsis extract code
2018-05-29 14:51:14 +09:00
Nguyễn Thái Ngọc Duy cff5dc09ed apply: add --intent-to-add
Similar to 'git reset -N', this option makes 'git apply' automatically
mark new files as intent-to-add so they are visible in the following
'git diff' command and could also be committed with 'git commit -a'.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-29 12:42:30 +09:00