Commit graph

10117 commits

Author SHA1 Message Date
Brandon Williams b0db704652 pathspec: allow querying for attributes
The pathspec mechanism is extended via the new
":(attr:eol=input)pattern/to/match" syntax to filter paths so that it
requires paths to not just match the given pattern but also have the
specified attrs attached for them to be chosen.

Based on a patch by Stefan Beller <sbeller@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-13 15:28:54 -07:00
Junio C Hamano d6db3f2165 Third batch after 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-12 23:24:14 -07:00
Junio C Hamano ff3898649b Merge branch 'ah/doc-ls-files-quotepath'
Documentation for "git ls-files" did not refer to core.quotePath

* ah/doc-ls-files-quotepath:
  Documentation: improve description for core.quotePath
2017-03-12 23:21:37 -07:00
Nguyễn Thái Ngọc Duy 3efd0bedc6 config: add conditional include
Sometimes a set of repositories want to share configuration settings
among themselves that are distinct from other such sets of repositories.
A user may work on two projects, each of which have multiple
repositories, and use one user.email for one project while using another
for the other.

Setting $GIT_DIR/.config works, but if the penalty of forgetting to
update $GIT_DIR/.config is high (especially when you end up cloning
often), it may not be the best way to go. Having the settings in
~/.gitconfig, which would work for just one set of repositories, would
not well in such a situation. Having separate ${HOME}s may add more
problems than it solves.

Extend the include.path mechanism that lets a config file include
another config file, so that the inclusion can be done only when some
conditions hold. Then ~/.gitconfig can say "include config-project-A
only when working on project-A" for each project A the user works on.

In this patch, the only supported grouping is based on $GIT_DIR (in
absolute path), so you would need to group repositories by directory, or
something like that to take advantage of it.

We already have include.path for unconditional includes. This patch goes
with includeIf.<condition>.path to make it clearer that a condition is
required. The new config has the same backward compatibility approach as
include.path: older git versions that don't understand includeIf will
simply ignore them.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-11 19:56:16 -08:00
Nguyễn Thái Ngọc Duy 1050e9874b config.txt: reflow the second include.path paragraph
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-11 19:49:43 -08:00
Nguyễn Thái Ngọc Duy df0233be96 config.txt: clarify multiple key values in include.path
The phrasing in this paragraph may give an impression that you can only
use it once. Rephrase it a bit.

Helped-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-11 19:49:30 -08:00
Junio C Hamano 625568cd88 Second batch after 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-10 13:25:21 -08:00
Junio C Hamano 44c3f09fa5 Merge branch 'tg/stash-push'
"git stash save" takes a pathspec so that the local changes can be
stashed away only partially.

* tg/stash-push:
  stash: allow pathspecs in the no verb form
  stash: use stash_push for no verb form
  stash: teach 'push' (and 'create_stash') to honor pathspec
  stash: refactor stash_create
  stash: add test for the create command line arguments
  stash: introduce push verb
2017-03-10 13:24:24 -08:00
Junio C Hamano ae900ebd71 Merge branch 'sb/submodule-init-url-selection'
When "git submodule init" decides that the submodule in the working
tree is its upstream, it now gives a warning as it is not a very
common setup.

* sb/submodule-init-url-selection:
  submodule init: warn about falling back to a local path
2017-03-10 13:24:24 -08:00
Junio C Hamano 9664cef1eb Merge branch 'ps/docs-diffcore'
Doc update.

* ps/docs-diffcore:
  docs/diffcore: unquote "Complete Rewrites" in headers
  docs/diffcore: fix grammar in diffcore-rename header
2017-03-10 13:24:24 -08:00
Stefan Beller bf0231c661 rev-parse: add --show-superproject-working-tree
In some situations it is useful to know if the given repository
is a submodule of another repository.

Add the flag --show-superproject-working-tree to git-rev-parse
to make it easy to find out if there is a superproject. When no
superproject exists, the output will be empty.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-08 15:52:03 -08:00
Christian Couder b46013950a Documentation/git-update-index: explain splitIndex.*
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-06 12:09:28 -08:00
Christian Couder b2dd1c5c34 Documentation/config: add splitIndex.sharedIndexExpire
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-06 12:09:28 -08:00
Devin J. Pohly a582a82d24 filter-branch: fix --prune-empty on parentless commits
Previously, the git_commit_non_empty_tree function would always pass any
commit with no parents to git-commit-tree, regardless of whether the
tree was nonempty.  The new commit would then be recorded in the
filter-branch revision map, and subsequent commits which leave the tree
untouched would be correctly filtered.

With this change, parentless commits with an empty tree are correctly
pruned, and an empty file is recorded in the revision map, signifying
that it was rewritten to "no commits."  This works naturally with the
parent mapping for subsequent commits.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-03 12:43:37 -08:00
Andreas Heiduk 860cd699c2 Documentation: improve description for core.quotePath
Linking the description for pathname quoting to the configuration
variable "core.quotePath" removes inconstistent and incomplete
sections while also giving two hints how to deal with it: Either with
"-c core.quotePath=false" or with "-z".

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-02 11:40:51 -08:00
Christian Couder e77cf4ee65 Documentation/config: add splitIndex.maxPercentChange
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-01 13:24:22 -08:00
Christian Couder 13c0e4c478 Documentation/git-update-index: talk about core.splitIndex config var
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-01 13:24:22 -08:00
Christian Couder 66f9e7a6e8 Documentation/config: add information for core.splitIndex
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-01 13:24:21 -08:00
Thomas Gummerer 9e140909f6 stash: allow pathspecs in the no verb form
Now that stash_push is used in the no verb form of stash, allow
specifying the command line for this form as well.  Always use -- to
disambiguate pathspecs from other non-option arguments.

Also make git stash -p an alias for git stash push -p.  This allows
users to use git stash -p <pathspec>.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 14:21:10 -08:00
Thomas Gummerer 1ada5020b3 stash: use stash_push for no verb form
Now that we have stash_push, which accepts pathspec arguments, use
it instead of stash_save in git stash without any additional verbs.

Previously we allowed git stash -- -message, which is no longer allowed
after this patch.  Messages starting with a hyphen was allowed since
3c2eb80f, ("stash: simplify defaulting to "save" and reject unknown
options").  However it was never the intent to allow that, but rather it
was allowed accidentally.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 14:21:10 -08:00
Thomas Gummerer df6bba0937 stash: teach 'push' (and 'create_stash') to honor pathspec
While working on a repository, it's often helpful to stash the changes
of a single or multiple files, and leave others alone.  Unfortunately
git currently offers no such option.  git stash -p can be used to work
around this, but it's often impractical when there are a lot of changes
over multiple files.

Allow 'git stash push' to take pathspec to specify which paths to stash.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 14:21:05 -08:00
Stefan Beller d1b3b81aab submodule init: warn about falling back to a local path
When a submodule is initialized, the config variable 'submodule.<name>.url'
is set depending on the value of the same variable in the .gitmodules
file. When the URL indicates to be relative, then the url is computed
relative to its default remote. The default remote cannot be determined
accurately in all cases, such that it falls back to 'origin'.

The 'origin' remote may not exist, though. In that case we give up looking
for a suitable remote and we'll just assume it to be a local relative path.

This can be confusing to users as there is a lot of guessing involved,
which is not obvious to the user.

So in the corner case of assuming a local autoritative truth, warn the
user to lessen the confusion.

This behavior was introduced in 4d6893200 (submodule add: allow relative
repository path even when no url is set, 2011-06-06), which shared the
code with submodule-init and then ported to C in 3604242f08 (submodule:
port init from shell to C, 2016-04-15).

In case of submodule-add, this behavior makes sense in some use cases[1],
however for submodule-init there does not seem to be an immediate obvious
use case to fall back to a local submodule. However there might be, so
warn instead of die here.

While adding the warning, also clarify the behavior of relative URLs in
the documentation.

[1] e.g. http://stackoverflow.com/questions/8721984/git-ignore-files-for-public-repository-but-not-for-private
"store a secret locally in a submodule, with no intention to publish it"

Reported-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 13:46:22 -08:00
Patrick Steinhardt b803ae4427 docs/diffcore: unquote "Complete Rewrites" in headers
The gitdiffcore documentation quotes the term "Complete Rewrites" in
headers for no real gain. This would make sense if the term could be
easily confused if not properly grouped together. But actually, the term
is quite obvious and thus does not really need any quoting, especially
regarding that it is not used anywhere else.

But more importanly, this brings up a bug when rendering man pages: when
trying to render quotes inside of a section header, we end up with
quotes which have been misaligned to the end of line. E.g.

    diffcore-break: For Splitting Up Complete Rewrites
    --------------------------------------------------

renders as

    DIFFCORE-BREAK: FOR SPLITTING UP  COMPLETE REWRITES""

, which is obviously wrong. While this is fixable for the man pages by
using double-quotes (e.g. ""COMPLETE REWRITES""), this again breaks it
for our generated HTML pages.

So fix the issue by simply dropping quotes inside of section headers,
which is currently only done for the term "Complete Rewrites".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 11:34:38 -08:00
Patrick Steinhardt 1aa38199af docs/diffcore: fix grammar in diffcore-rename header
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-28 11:34:36 -08:00
Junio C Hamano 3bc53220cb First batch after 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-27 14:04:24 -08:00
Junio C Hamano c96bc189b5 Merge branch 'dt/gc-ignore-old-gc-logs'
A "gc.log" file left by a backgrounded "gc --auto" disables further
automatic gc; it has been taught to run at least once a day (by
default) by ignoring a stale "gc.log" file that is too old.

* dt/gc-ignore-old-gc-logs:
  gc: ignore old gc.log files
2017-02-27 13:57:15 -08:00
Junio C Hamano be6ab596a8 Merge branch 'sf/putty-w-args'
The command line options for ssh invocation needs to be tweaked for
some implementations of SSH (e.g. PuTTY plink wants "-P <port>"
while OpenSSH wants "-p <port>" to specify port to connect to), and
the variant was guessed when GIT_SSH environment variable is used
to specify it.  The logic to guess now applies to the command
specified by the newer GIT_SSH_COMMAND and also core.sshcommand
configuration variable, and comes with an escape hatch for users to
deal with misdetected cases.

* sf/putty-w-args:
  connect.c: stop conflating ssh command names and overrides
  connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
  git_connect(): factor out SSH variant handling
  connect: rename tortoiseplink and putty variables
  connect: handle putty/plink also in GIT_SSH_COMMAND
2017-02-27 13:57:15 -08:00
Junio C Hamano a04855bae8 Merge branch 'bw/attr'
The gitattributes machinery is being taught to work better in a
multi-threaded environment.

* bw/attr: (27 commits)
  attr: reformat git_attr_set_direction() function
  attr: push the bare repo check into read_attr()
  attr: store attribute stack in attr_check structure
  attr: tighten const correctness with git_attr and match_attr
  attr: remove maybe-real, maybe-macro from git_attr
  attr: eliminate global check_all_attr array
  attr: use hashmap for attribute dictionary
  attr: change validity check for attribute names to use positive logic
  attr: pass struct attr_check to collect_some_attrs
  attr: retire git_check_attrs() API
  attr: convert git_check_attrs() callers to use the new API
  attr: convert git_all_attrs() to use "struct attr_check"
  attr: (re)introduce git_check_attr() and struct attr_check
  attr: rename function and struct related to checking attributes
  attr.c: outline the future plans by heavily commenting
  Documentation: fix a typo
  attr.c: add push_stack() helper
  attr: support quoting pathname patterns in C style
  attr.c: plug small leak in parse_attr_line()
  attr.c: tighten constness around "git_attr" structure
  ...
2017-02-27 13:57:14 -08:00
Junio C Hamano fdeb89fdeb Merge branch 'sg/completion'
Clean-up and updates to command line completion (in contrib/).

* sg/completion: (22 commits)
  completion: restore removed line continuating backslash
  completion: cache the path to the repository
  completion: extract repository discovery from __gitdir()
  completion: don't guard git executions with __gitdir()
  completion: consolidate silencing errors from git commands
  completion: don't use __gitdir() for git commands
  completion: respect 'git -C <path>'
  rev-parse: add '--absolute-git-dir' option
  completion: fix completion after 'git -C <path>'
  completion: don't offer commands when 'git --opt' needs an argument
  completion: list short refs from a remote given as a URL
  completion: don't list 'HEAD' when trying refs completion outside of a repo
  completion: list refs from remote when remote's name matches a directory
  completion: respect 'git --git-dir=<path>' when listing remote refs
  completion: fix most spots not respecting 'git --git-dir=<path>'
  completion: ensure that the repository path given on the command line exists
  completion tests: add tests for the __git_refs() helper function
  completion tests: check __gitdir()'s output in the error cases
  completion tests: consolidate getting path of current working directory
  completion tests: make the $cur variable local to the test helper functions
  ...
2017-02-27 13:57:14 -08:00
Junio C Hamano 015fba3834 Merge branch 'lt/pathspec-negative'
The "negative" pathspec feature was somewhat more cumbersome to use
than necessary in that its short-hand used "!" which needed to be
escaped from shells, and it required "exclude from what?" specified.

* lt/pathspec-negative:
  pathspec: don't error out on all-exclusionary pathspec patterns
  pathspec magic: add '^' as alias for '!'
2017-02-27 13:57:13 -08:00
Junio C Hamano 93e8cd8b6e Merge branch 'kn/ref-filter-branch-list'
The code to list branches in "git branch" has been consolidated
with the more generic ref-filter API.

* kn/ref-filter-branch-list: (21 commits)
  ref-filter: resurrect "strip" as a synonym to "lstrip"
  branch: implement '--format' option
  branch: use ref-filter printing APIs
  branch, tag: use porcelain output
  ref-filter: allow porcelain to translate messages in the output
  ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
  ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
  ref-filter: Do not abruptly die when using the 'lstrip=<N>' option
  ref-filter: rename the 'strip' option to 'lstrip'
  ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
  ref-filter: introduce refname_atom_parser()
  ref-filter: introduce refname_atom_parser_internal()
  ref-filter: make "%(symref)" atom work with the ':short' modifier
  ref-filter: add support for %(upstream:track,nobracket)
  ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
  ref-filter: introduce format_ref_array_item()
  ref-filter: move get_head_description() from branch.c
  ref-filter: modify "%(objectname:short)" to take length
  ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
  ref-filter: include reference to 'used_atom' within 'atom_value'
  ...
2017-02-27 13:57:13 -08:00
Junio C Hamano a411726930 Merge branch 'ps/urlmatch-wildcard'
The <url> part in "http.<url>.<variable>" configuration variable
can now be spelled with '*' that serves as wildcard.
E.g. "http.https://*.example.com.proxy" can be used to specify the
proxy used for https://a.example.com, https://b.example.com, etc.,
i.e. any host in the example.com domain.

* ps/urlmatch-wildcard:
  urlmatch: allow globbing for the URL host part
  urlmatch: include host in urlmatch ranking
  urlmatch: split host and port fields in `struct url_info`
  urlmatch: enable normalization of URLs with globs
  mailmap: add Patrick Steinhardt's work address
2017-02-27 13:57:12 -08:00
Junio C Hamano 1b324988ac Merge branch 'jk/describe-omit-some-refs'
"git describe" and "git name-rev" have been taught to take more
than one refname patterns to restrict the set of refs to base their
naming output on, and also learned to take negative patterns to
name refs not to be used for naming via their "--exclude" option.

* jk/describe-omit-some-refs:
  describe: teach describe negative pattern matches
  describe: teach --match to accept multiple patterns
  name-rev: add support to exclude refs by pattern match
  name-rev: extend --refs to accept multiple patterns
  doc: add documentation for OPT_STRING_LIST
2017-02-27 13:57:11 -08:00
Junio C Hamano e7e07d5a4f Git 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-24 10:49:58 -08:00
Junio C Hamano cca4f20eda Merge branch 'ps/doc-gc-aggressive-depth-update'
Doc update.

* ps/doc-gc-aggressive-depth-update:
  docs/git-gc: fix default value for `--aggressiveDepth`
2017-02-24 10:48:10 -08:00
Junio C Hamano dc9ded4802 Merge branch 'bc/worktree-doc-fix-detached'
Doc update.

* bc/worktree-doc-fix-detached:
  Documentation: correctly spell git worktree --detach
2017-02-24 10:48:10 -08:00
Junio C Hamano c6788b1f45 Merge branch 'dr/doc-check-ref-format-normalize'
Doc update.

* dr/doc-check-ref-format-normalize:
  git-check-ref-format: clarify documentation for --normalize
2017-02-24 10:48:09 -08:00
Junio C Hamano eccf97c386 Merge branch 'gp/document-dotfiles-in-templates-are-not-copied'
Doc update.

* gp/document-dotfiles-in-templates-are-not-copied:
  init: document dotfiles exclusion on template copy
2017-02-24 10:48:09 -08:00
Junio C Hamano af4027f2de Merge branch 'bc/blame-doc-fix'
Doc update.

* bc/blame-doc-fix:
  Documentation: use brackets for optional arguments
2017-02-24 10:48:08 -08:00
Patrick Steinhardt 7e82388024 docs/git-gc: fix default value for --aggressiveDepth
In commit 07e7dbf0d (gc: default aggressive depth to 50, 2016-08-11),
the default aggressive depth of git-gc has been changed to 50. While
git-config(1) has been updated to represent the new default value,
git-gc(1) still mentions the old value. This patch fixes it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-24 09:59:12 -08:00
brian m. carlson 2b35a9f4c7 Documentation: use brackets for optional arguments
The documentation for git blame used vertical bars for optional
arguments to -M and -C, which is unusual and potentially confusing.
Since most man pages use brackets for optional items, and that's
consistent with how we document the same options for git diff and
friends, use brackets here, too.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-22 10:22:15 -08:00
brian m. carlson 9993a7c5f1 Documentation: correctly spell git worktree --detach
The option is “--detach”, but we accidentally spelled it “--detached” at
one point in the man page.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Reported-by: Casey Rodarmor <casey@rodarmor.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-22 10:08:38 -08:00
Damien Regad 115a40add6 git-check-ref-format: clarify documentation for --normalize
Use of 'iff' may be confusing to people not familiar with this term.

Improving the --normalize option's documentation to remove the use of
'iff', and clearly describe what happens when the condition is not met.

Signed-off-by: Damien Regad <dregad@mantisbt.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-21 13:02:42 -08:00
Thomas Gummerer f5727e26e4 stash: introduce push verb
Introduce a new git stash push verb in addition to git stash save.  The
push verb is used to transition from the current command line arguments
to a more conventional way, in which the message is given as an argument
to the -m option.

This allows us to have pathspecs at the end of the command line
arguments like other Git commands do, so that the user can say which
subset of paths to stash (and leave others behind).

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-19 23:47:41 -08:00
Grégoire Paris 133f0a299d init: document dotfiles exclusion on template copy
Not just . and .., but any path that begins with dot is not copied
when copying the template directory to a new repository.  You can
customize the template directory, copying some dotfiles might make
sense, but it's actually a good thing not to, because you would not
want to have your git directory copied in every git directory that
is created should you decide to put your template directory under
version control, for example.  Plus, it might be used as a feature
by people who would want to exclude some files.

Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-17 15:57:21 -08:00
Junio C Hamano 076c05393a Hopefully the final batch of mini-topics before the final
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 14:46:35 -08:00
Junio C Hamano 62fef5c564 Merge branch 'dp/submodule-doc-markup-fix'
Doc fix.

* dp/submodule-doc-markup-fix:
  config.txt: fix formatting of submodule.alternateErrorStrategy section
2017-02-16 14:45:15 -08:00
Junio C Hamano 1f73ff0802 Merge branch 'jk/reset-to-break-a-commit-doc-updated'
Doc update.

* jk/reset-to-break-a-commit-doc-updated:
  reset: add an example of how to split a commit into two
2017-02-16 14:45:14 -08:00
Junio C Hamano bf5f119189 Merge branch 'jk/reset-to-break-a-commit-doc'
Doc update.

* jk/reset-to-break-a-commit-doc:
  Revert "reset: add an example of how to split a commit into two"
2017-02-16 14:45:14 -08:00
David Pursehouse 8ab9740d9f config.txt: fix formatting of submodule.alternateErrorStrategy section
Add missing `::` after the title.

Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 13:46:20 -08:00
Jacob Keller f94baa4d93 reset: add an example of how to split a commit into two
It is often useful to break a commit into multiple parts that are more
logical separations. This can be tricky to learn how to do without the
brute-force method if re-writing code or commit messages from scratch.

Add a section to the git-reset documentation which shows an example
process for how to use git add -p and git commit -c HEAD@{1} to
interactively break a commit apart and re-use the original commit
message as a starting point when making the new commit message.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 13:38:02 -08:00
Junio C Hamano ae86372fcd Revert "reset: add an example of how to split a commit into two"
This reverts commit 7326451bedaa67d29afe02184b166e28d9393c91; a
better rewrite will be queued separately.
2017-02-16 13:35:50 -08:00
Junio C Hamano d09b692797 A bit more for -rc2 2017-02-15 14:58:25 -08:00
Junio C Hamano 57f7345b50 Merge branch 'tg/stash-doc-cleanup'
The documentation explained what "git stash" does to the working
tree (after stashing away the local changes) in terms of "reset
--hard", which was exposing an unnecessary implementation detail.

* tg/stash-doc-cleanup:
  Documentation/stash: remove mention of git reset --hard
2017-02-15 14:56:41 -08:00
Junio C Hamano 3e23116d1f Merge branch 'jk/doc-submodule-markup-fix'
Doc markup fix.

* jk/doc-submodule-markup-fix:
  docs/git-submodule: fix unbalanced quote
2017-02-15 14:56:40 -08:00
Junio C Hamano 8c00b7e583 Merge branch 'jk/doc-remote-helpers-markup-fix'
Doc markup fix.

* jk/doc-remote-helpers-markup-fix:
  docs/gitremote-helpers: fix unbalanced quotes
2017-02-15 14:56:40 -08:00
Junio C Hamano 153a33f98c Merge branch 'sb/doc-unify-bottom'
Doc clean-up.

* sb/doc-unify-bottom:
  Documentation: unify bottom "part of git suite" lines
2017-02-15 12:54:20 -08:00
Junio C Hamano ca3c2b85d1 Merge branch 'sb/push-options-via-transport'
The push-options given via the "--push-options" option were not
passed through to external remote helpers such as "smart HTTP" that
are invoked via the transport helper.

* sb/push-options-via-transport:
  push options: pass push options to the transport helper
2017-02-15 12:54:19 -08:00
Junio C Hamano 2f4e87d777 Merge branch 'sb/submodule-doc'
Doc updates.

* sb/submodule-doc:
  submodule update documentation: don't repeat ourselves
  submodule documentation: add options to the subcommand
2017-02-15 12:54:18 -08:00
David Turner a831c06a2b gc: ignore old gc.log files
A server can end up in a state where there are lots of unreferenced
loose objects (say, because many users are doing a bunch of rebasing
and pushing their rebased branches).  Running "git gc --auto" in
this state would cause a gc.log file to be created, preventing
future auto gcs, causing pack files to pile up.  Since many git
operations are O(n) in the number of pack files, this would lead to
poor performance.

Git should never get itself into a state where it refuses to do any
maintenance, just because at some point some piece of the maintenance
didn't make progress.

Teach Git to ignore gc.log files which are older than (by default)
one day old, which can be tweaked via the gc.logExpiry configuration
variable.  That way, these pack files will get cleaned up, if
necessary, at least once per day.  And operators who find a need for
more-frequent gcs can adjust gc.logExpiry to meet their needs.

There is also some cleanup: a successful manual gc, or a
warning-free auto gc with an old log file, will remove any old
gc.log files.

It might still happen that manual intervention is required
(e.g. because the repo is corrupt), but at the very least it won't
be because Git is too dumb to try again.

Signed-off-by: David Turner <dturner@twosigma.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 15:19:11 -08:00
Thomas Gummerer 20a7e06172 Documentation/stash: remove mention of git reset --hard
Don't mention git reset --hard in the documentation for git stash save.
It's an implementation detail that doesn't matter to the end user and
thus shouldn't be exposed to them.  In addition it's not quite true for
git stash -p, and will not be true when a filename argument to limit the
stash to a few files is introduced.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 14:20:38 -08:00
Jeff King e91461b332 docs/git-submodule: fix unbalanced quote
The documentation gives an example of the submodule foreach
command that uses both backticks and single-quotes. We stick
the whole thing inside "+" markers to make it monospace, but
the inside punctuation still needs escaping. We handle the
backticks with "{backtick}", and use backslash-escaping for
the single-quotes.

But we missed the escaping on the second quote. Fortunately,
asciidoc renders this unbalanced quote as we want (showing
the quote), but asciidoctor does not. We could fix it by
adding the missing backslash.

However, let's take a step back. Even when rendered
correctly, it's hard to read a long command stuck into the
middle of a paragraph, and the important punctuation is hard
to notice. Let's instead bump it into its own single-line
code block. That makes both the source and the rendered
result more readable, and as a bonus we don't have to worry
about quoting at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 14:05:40 -08:00
Jeff King 2aaf37b62c docs/gitremote-helpers: fix unbalanced quotes
Each of these options is missing the closing single-quote on
the option name. This understandably confuses asciidoc,
which ends up rendering a stray quote, like:

  option cloning {'true|false}

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 12:55:36 -08:00
Linus Torvalds 859b7f1d0e pathspec: don't error out on all-exclusionary pathspec patterns
Instead of erroring out and telling the user that they should add a
positive pattern that covers everything else, just _do_ that.

For commands where we honor the current cwd by default (ie grep, ls-files
etc), we make that default positive pathspec be the current working
directory.  And for commands that default to the whole project (ie diff,
log, etc), the default positive pathspec is the whole project.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-10 13:19:40 -08:00
Linus Torvalds 42ebeb9d07 pathspec magic: add '^' as alias for '!'
The choice of '!' for a negative pathspec ends up not only not matching
what we do for revisions, it's also a horrible character for shell
expansion since it needs quoting.

So add '^' as an alternative alias for an excluding pathspec entry.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-10 13:19:10 -08:00
Junio C Hamano 5588dbffbd Git 2.12-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-10 12:54:23 -08:00
Junio C Hamano 653078bbdd Merge branch 'nd/rev-list-all-includes-HEAD-doc'
Doc update.

* nd/rev-list-all-includes-HEAD-doc:
  rev-list-options.txt: update --all about HEAD
2017-02-10 12:52:27 -08:00
Junio C Hamano 0ffe1c9c5f Merge branch 'dl/difftool-doc-no-gui-option'
Doc update.

* dl/difftool-doc-no-gui-option:
  Document the --no-gui option in difftool
2017-02-10 12:52:26 -08:00
Junio C Hamano 5c40e9ce81 Merge branch 'jk/reset-to-break-a-commit-doc'
A minor doc update.

* jk/reset-to-break-a-commit-doc:
  reset: add an example of how to split a commit into two
2017-02-10 12:52:24 -08:00
Junio C Hamano 8e7c1f3240 Merge branch 'bw/push-submodule-only'
Add missing documentation update to a recent topic.

* bw/push-submodule-only:
  completion: add completion for --recurse-submodules=only
  doc: add doc for git-push --recurse-submodules=only
2017-02-10 12:52:23 -08:00
Stefan Beller 941b9c5270 Documentation: unify bottom "part of git suite" lines
We currently have 168 man pages that mention they are part of Git, you
can check yourself easily via:
  $ git grep "Part of the linkgit:git\[1\] suite" |wc -l
  168
However some have a trailing period, i.e.
  $ git grep "Part of the linkgit:git\[1\] suite." |wc -l
  8

Unify the bottom line in all man pages to not end with a period.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-09 15:14:01 -08:00
Stefan Beller 438fc68462 push options: pass push options to the transport helper
When using non-builtin protocols relying on a transport helper
(such as http), push options are not propagated to the helper.

The user could ask for push options and a push would seemingly succeed,
but the push options would never be transported to the server,
misleading the users expectation.

Fix this by propagating the push options to the transport helper.

This is only addressing the first issue of
   (1) the helper protocol does not propagate push-option
   (2) the http helper is not prepared to handle push-option

Once we fix (2), the http transport helper can make use of push options
as well, but that happens as a follow up. (1) is a bug fix, whereas (2)
is a feature, which is why we only do (1) here.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-08 15:45:01 -08:00
Nguyễn Thái Ngọc Duy 209df269a6 rev-list-options.txt: update --all about HEAD
This is the document patch for f0298cf1c6 (revision walker: include a
detached HEAD in --all - 2009-01-16).

Even though that commit is about detached HEAD, as Jeff pointed out,
always adding HEAD in that case may have subtle differences with
--source or --exclude. So the document mentions nothing about the
detached-ness.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-08 13:37:32 -08:00
Denton Liu 56c2da57fe Document the --no-gui option in difftool
Prior to this, the `--no-gui` option was not documented in the manpage.
This commit introduces this into the manpage

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-08 13:30:28 -08:00
Junio C Hamano 44a6b6ce17 ref-filter: resurrect "strip" as a synonym to "lstrip"
We forgot that "strip" was introduced at 0571979bd6 ("tag: do not
show ambiguous tag names as "tags/foo"", 2016-01-25) as part of Git
2.8 (and 2.7.1) when we started calling this "lstrip" to make it
easier to explain the new "rstrip" operation.

We shouldn't have renamed the existing one; "lstrip" should have
been a new synonym that means the same thing as "strip".  Scripts
in the wild are surely using the original form already.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-07 11:50:34 -08:00
Jacob Keller 7326451bed reset: add an example of how to split a commit into two
It is often useful to break a commit into multiple parts that are more
logical separations. This can be tricky to learn how to do without the
brute-force method if re-writing code or commit messages from scratch.

Add a section to the git-reset documentation which shows an example
process for how to use git add -p and git commit -c HEAD@{1} to
interactively break a commit apart and re-use the original commit
message as a starting point when making the new commit message.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-03 22:31:47 -08:00
SZEDER Gábor a2f5a87626 rev-parse: add '--absolute-git-dir' option
The output of 'git rev-parse --git-dir' can be either a relative or an
absolute path, depending on whether the current working directory is
at the top of the worktree or the .git directory or not, or how the
path to the repository is specified via the '--git-dir=<path>' option
or the $GIT_DIR environment variable.  And if that output is a
relative path, then it is relative to the directory where any 'git
-C <path>' options might have led us.

This doesn't matter at all for regular scripts, because the git
wrapper automatically takes care of changing directories according to
the '-C <path>' options, and the scripts can then simply follow any
path returned by 'git rev-parse --git-dir', even if it's a relative
path.

Our Bash completion script, however, is unique in that it must run
directly in the user's interactive shell environment.  This means that
it's not executed through the git wrapper and would have to take care
of any '-C <path> options on its own, and it can't just change
directories as it pleases.  Consequently, adding support for taking
any '-C <path>' options on the command line into account during
completion turned out to be considerably more difficult, error prone
and required more subshells and git processes when it had to cope with
a relative path to the .git directory.

Help this rather special use case and teach 'git rev-parse' a new
'--absolute-git-dir' option which always outputs a canonicalized
absolute path to the .git directory, regardless of whether the path is
discovered automatically or is specified via $GIT_DIR or 'git
--git-dir=<path>'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-03 22:18:41 -08:00
Junio C Hamano 6e3a7b3398 Git 2.12-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-03 11:29:52 -08:00
Junio C Hamano fafca0f72a Merge branch 'cw/log-updates-for-all-refs-really'
The "core.logAllRefUpdates" that used to be boolean has been
enhanced to take 'always' as well, to record ref updates to refs
other than the ones that are expected to be updated (i.e. branches,
remote-tracking branches and notes).

* cw/log-updates-for-all-refs-really:
  doc: add note about ignoring '--no-create-reflog'
  update-ref: add test cases for bare repository
  refs: add option core.logAllRefUpdates = always
  config: add markup to core.logAllRefUpdates doc
2017-02-03 11:25:19 -08:00
Junio C Hamano 8a8f121049 Sync with v2.11.1
* maint:
  Git 2.11.1
2017-02-02 13:43:19 -08:00
Junio C Hamano 289ec4d9ba Ninth batch for 2.12; almost ready for -rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-02 13:43:10 -08:00
Junio C Hamano 85279e8649 Merge branch 'nd/log-graph-configurable-colors'
Some people feel the default set of colors used by "git log --graph"
rather limiting.  A mechanism to customize the set of colors has
been introduced.

* nd/log-graph-configurable-colors:
  document behavior of empty color name
  color_parse_mem: allow empty color spec
  log --graph: customize the graph lines with config log.graphColors
  color.c: trim leading spaces in color_parse_mem()
  color.c: fix color_parse_mem() with value_len == 0
2017-02-02 13:36:58 -08:00
Junio C Hamano a77fe4a976 Merge branch 'bc/use-asciidoctor-opt'
Asciidoctor, an alternative reimplementation of AsciiDoc, still
needs some changes to work with documents meant to be formatted
with AsciiDoc.  "make USE_ASCIIDOCTOR=YesPlease" to use it out of
the box to document our pages is getting closer to reality.

* bc/use-asciidoctor-opt:
  Documentation: implement linkgit macro for Asciidoctor
  Makefile: add a knob to enable the use of Asciidoctor
  Documentation: move dblatex arguments into variable
  Documentation: add XSLT to fix DocBook for Texinfo
  Documentation: sort sources for gitman.texi
  Documentation: remove unneeded argument in cat-texi.perl
  Documentation: modernize cat-texi.perl
  Documentation: fix warning in cat-texi.perl
2017-02-02 13:36:57 -08:00
Junio C Hamano d3a0172a82 Merge branch 'cw/doc-sign-off'
Doc update.

* cw/doc-sign-off:
  doc: clarify distinction between sign-off and pgp-signing
2017-02-02 13:36:55 -08:00
Junio C Hamano 9dec2c652f Merge branch 'js/retire-relink'
Cruft removal.

* js/retire-relink:
  relink: really remove the command
  relink: retire the command
2017-02-02 13:36:54 -08:00
Junio C Hamano 3b9e3c2ced Git 2.11.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-02 13:21:27 -08:00
Jeff King 512aba261a document behavior of empty color name
Commit 55cccf4bb (color_parse_mem: allow empty color spec,
2017-02-01) clearly defined the behavior of an empty color
config variable. Let's document that, and give a hint about
why it might be useful.

It's important not to say that it makes the item uncolored,
because it doesn't. It just sets no attributes, which means
that any previous attributes continue to take effect.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-02 12:23:16 -08:00
Cornelius Weig 67c70bd930 doc: add note about ignoring '--no-create-reflog'
The commands git-branch and git-tag accept the '--create-reflog'
option, and create reflog even when core.logallrefupdates
configuration is explicitly set not to.

On the other hand, the negated form '--no-create-reflog' is accepted
as a valid option but has no effect (other than overriding an
earlier '--create-reflog' on the command line). This silent noop may
puzzle users.  To communicate that this is a known limitation, add a
short note in the manuals for git-branch and git-tag.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 15:53:40 -08:00
Cornelius Weig 9c24c8741e doc: add doc for git-push --recurse-submodules=only
Add documentation for the `--recurse-submodules=only` option of
git-push. The feature was added in commit 225e8bf (add option to
push only submodules).

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 15:16:49 -08:00
Junio C Hamano 1295c21524 attr: retire git_check_attrs() API
Since nobody uses the old API, make it file-scope static, and update
the documentation to describe the new API.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 13:46:52 -08:00
Stefan Beller faa4e8ceb5 Documentation: fix a typo
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 13:46:52 -08:00
Nguyễn Thái Ngọc Duy 860a74d9d9 attr: support quoting pathname patterns in C style
Full pattern must be quoted. So 'pat"t"ern attr' will give exactly
'pat"t"ern', not 'pattern'. Also clarify that leading whitespaces are
not part of the pattern and document comment syntax.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 13:46:52 -08:00
Patrick Steinhardt a272b9e70a urlmatch: allow globbing for the URL host part
The URL matching function computes for two URLs whether they match not.
The match is performed by splitting up the URL into different parts and
then doing an exact comparison with the to-be-matched URL.

The main user of `urlmatch` is the configuration subsystem. It allows to
set certain configurations based on the URL which is being connected to
via keys like `http.<url>.*`. A common use case for this is to set
proxies for only some remotes which match the given URL. Unfortunately,
having exact matches for all parts of the URL can become quite tedious
in some setups. Imagine for example a corporate network where there are
dozens or even hundreds of subdomains, which would have to be configured
individually.

Allow users to write an asterisk '*' in place of any 'host' or
'subdomain' label as part of the host name.  For example,
"http.https://*.example.com.proxy" sets "http.proxy" for all direct
subdomains of "https://example.com", e.g. "https://foo.example.com", but
not "https://foo.bar.example.com".

Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 13:22:50 -08:00
Segev Finer dd33e07766 connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
This environment variable and configuration value allow to
override the autodetection of plink/tortoiseplink in case that
Git gets it wrong.

[jes: wrapped overly-long lines, factored out and changed
get_ssh_variant() to handle_ssh_variant() to accomodate the
change from the putty/tortoiseplink variables to
port_option/needs_batch, adjusted the documentation, free()d
value obtained from the config.]

Signed-off-by: Segev Finer <segev208@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-01 10:57:53 -08:00
Junio C Hamano 8f60064c1f Sync with maint
* maint:
  Ready for 2.11.1
2017-01-31 13:34:59 -08:00
Junio C Hamano b32fe956d0 Ready for 2.11.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-31 13:34:48 -08:00
Junio C Hamano 1ac2ec6dd8 Merge branch 'sb/in-core-index-doc' into maint
Documentation and in-code comments updates.

* sb/in-core-index-doc:
  documentation: retire unfinished documentation
  cache.h: document add_[file_]to_index
  cache.h: document remove_index_entry_at
  cache.h: document index_name_pos
2017-01-31 13:32:11 -08:00
Junio C Hamano 63f1bb8109 Merge branch 'jk/coding-guidelines-update' into maint
Developer doc update.

* jk/coding-guidelines-update:
  CodingGuidelines: clarify multi-line brace style
2017-01-31 13:32:11 -08:00
Junio C Hamano 2ae2362473 Merge branch 'ad/bisect-terms' into maint
Documentation fix.

* ad/bisect-terms:
  Documentation/bisect: improve on (bad|new) and (good|bad)
2017-01-31 13:32:10 -08:00
Junio C Hamano 46ab222616 Merge branch 'jc/abbrev-autoscale-config' into maint
Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.

* jc/abbrev-autoscale-config:
  config.abbrev: document the new default that auto-scales
2017-01-31 13:32:06 -08:00