Commit graph

46137 commits

Author SHA1 Message Date
Jiang Xin 28159ae592 Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (3139t0f0u)
2017-02-22 00:06:44 +08:00
Junio C Hamano 80ba04ed9b Merge branch 'svn-escape-backslash' of git://bogomips.org/git-svn
* 'svn-escape-backslash' of git://bogomips.org/git-svn:
  git-svn: escape backslashes in refnames
2017-02-20 22:01:59 -08:00
Peter Krefting 806f2769e4 l10n: sv.po: Update Swedish translation (3139t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2017-02-20 19:40:11 +01:00
Ralf Thielow af4cf7ed8b l10n: de.po: translate 241 messages
Translate 241 messages came from git.pot update in 673bfad09
(l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)) and a4d94835a
(l10n: git.pot: v2.12.0 round 2 (2 new)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>
2017-02-20 18:40:36 +01:00
Jiang Xin c24512527c Merge branch 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko
* 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko:
  l10n: ko.po: Update Korean translation
2017-02-19 22:08:05 +08:00
Jiang Xin 7cbeff01b8 Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po (3139t): Updated 2 new messages for rc1
2017-02-19 22:04:41 +08:00
Changwoo Ryu 7d6d957c53 l10n: ko.po: Update Korean translation
Signed-off-by: Changwoo Ryu <cwryu@debian.org>
2017-02-19 19:35:37 +09:00
Tran Ngoc Quan 5271df1d56 l10n: vi.po (3139t): Updated 2 new messages for rc1
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2017-02-18 07:18:54 +07: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
Jean-Noel Avila 3d5f390525 l10n: fr.po: v2.12.0 round 2 3139t
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2017-02-18 00:12:26 +01:00
Jeff King 7e8c9355b7 tempfile: set errno to a known value before calling ferror()
In close_tempfile(), we return an error if ferror()
indicated a previous failure, or if fclose() failed. In the
latter case, errno is set and it is useful for callers to
report it.

However, if _only_ ferror() triggers, then the value of
errno is based on whatever syscall happened to last fail,
which may not be related to our filehandle at all. A caller
cannot tell the difference between the two cases, and may
use "die_errno()" or similar to report a nonsense errno value.

One solution would be to actually pass back separate return
values for the two cases, so a caller can write a more
appropriate message for each case. But that makes the
interface clunky.

Instead, let's just set errno to the generic EIO in this case.
That's not as descriptive as we'd like, but at least it's
predictable. So it's better than the status quo in all cases
but one: when the last syscall really did involve a failure
on our filehandle, we'll be wiping that out. But that's a
fragile thing for us to rely on.

In any case, we'll let the errno result from fclose() take
precedence over our value, as we know that's recent and
accurate (and many I/O errors will persist through the
fclose anyway).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-17 14:40:29 -08:00
Junio C Hamano 20769079d2 Git 2.12-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-17 14:00:19 -08:00
Jiang Xin a4d94835af l10n: git.pot: v2.12.0 round 2 (2 new)
Generate po/git.pot from v2.12.0-rc1 for git v2.12.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2017-02-18 01:00:54 +08:00
Jiang Xin 53f7473403 Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: vi.po: Updated Vietnamese translation (3137t)
  l10n: update Catalan translation
  l10n: sv.po: Update Swedish translation (3137t0f0u)
  l10n: fr.po: v2.11-rc0 first round
  l10n: ko.po: Update Korean translation
  l10n: fr.po: Fix a typo in the French translation
  l10n: fr.po: Remove gender specific adjectives
  l10n: fr.po: Fix typos
  l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
  l10n: bg:  Updated Bulgarian translation (2913t+0f+0u)
  l10n: fixes to Catalan translation
  l10n: zh_CN: review for git v2.11.0 l10n
  l10n: New Catalan translation maintainer
2017-02-18 00:59:51 +08:00
Jiang Xin 84b3ceb1fb Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po: Updated Vietnamese translation (3137t)
2017-02-18 00:54:49 +08:00
Jiang Xin 8b22a8e876 Merge branch 'master' of https://github.com/Softcatala/git-po
* 'master' of https://github.com/Softcatala/git-po:
  l10n: update Catalan translation
2017-02-18 00:49:06 +08:00
Tran Ngoc Quan a1da87b72c l10n: vi.po: Updated Vietnamese translation (3137t)
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2017-02-17 13:52:11 +07: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 c5b22b819d Merge branch 'jk/tempfile-ferror-fclose-confusion'
Code clean-up.

* jk/tempfile-ferror-fclose-confusion:
  tempfile: avoid "ferror | fclose" trick
2017-02-16 14:45:15 -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
Junio C Hamano e048a257bf Merge branch 'js/mingw-isatty'
A hotfix for a topic already in 'master'.

* js/mingw-isatty:
  mingw: make stderr unbuffered again
2017-02-16 14:45:13 -08:00
Junio C Hamano 1e00c41fd6 Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'
Code clean-up.

* rs/strbuf-cleanup-in-rmdir-recursively:
  rm: reuse strbuf for all remove_dir_recursively() calls, again
2017-02-16 14:45:13 -08:00
Junio C Hamano a3b3c9c916 Merge branch 'rs/ls-files-partial-optim'
"ls-files" run with pathspec has been micro-optimized to avoid
having to memmove(3) unnecessary bytes.

* rs/ls-files-partial-optim:
  ls-files: move only kept cache entries in prune_cache()
  ls-files: pass prefix length explicitly to prune_cache()
2017-02-16 14:45:13 -08:00
Junio C Hamano 0078a75985 Merge branch 'rs/cocci-check-free-only-null'
A new coccinelle rule that catches a check of !pointer before the
pointer is free(3)d, which most likely is a bug.

* rs/cocci-check-free-only-null:
  cocci: detect useless free(3) calls
2017-02-16 14:45:13 -08:00
Junio C Hamano 5a98255dec Merge branch 'ls/p4-path-encoding'
When "git p4" imports changelist that removes paths, it failed to
convert pathnames when the p4 used encoding different from the one
used on the Git side.  This has been corrected.

* ls/p4-path-encoding:
  git-p4: fix git-p4.pathEncoding for removed files
2017-02-16 14:45:12 -08:00
Jeff King 0838cbc22f tempfile: avoid "ferror | fclose" trick
The current code wants to record an error condition from
either ferror() or fclose(), but makes sure that we always
call both functions. So it can't use logical-OR "||", which
would short-circuit when ferror() is true. Instead, it uses
bitwise-OR "|" to evaluate both functions and set one or
more bits in the "err" flag if they reported a failure.

Unlike logical-OR, though, bitwise-OR does not introduce a
sequence point, and the order of evaluation for its operands
is unspecified. So a compiler would be free to generate code
which calls fclose() first, and then ferror() on the
now-freed filehandle.

There's no indication that this has happened in practice,
but let's write it out in a way that follows the standard.

Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 14:15:55 -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
Maxim Moseychuk 2cfa83574c bisect_next_all: convert xsnprintf to xstrfmt
Git can't run bisect between 2048+ commits if use russian
translation, because the translated string is too long for the fixed
buffer it uses (this can be reproduced "LANG=ru_RU.UTF8 git bisect
start v4.9 v4.8" on linux sources).

Use xstrfmt() to format the message string to sufficiently sized
buffer instead to fix this.

Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 11:28:17 -08:00
Maxim Moseychuk fbd09439c0 stop_progress_msg: convert xsnprintf to xstrfmt
Simplify code by replacing buffer allocation with a call to xstrfmt().

Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 11:28:02 -08:00
Jordi Mas 2f61b3a335 l10n: update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2017-02-16 05:10:04 +01: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
Jeff King d3cc5f4c44 show-branch: use skip_prefix to drop magic numbers
We make several starts_with() calls, only to advance
pointers. This is exactly what skip_prefix() is for, which
lets us avoid manually-counted magic numbers.

Helped-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-15 13:50:31 -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 3f4ccb5a57 Merge branch 'cw/completion'
More command line completion (in contrib/) for recent additions.

* cw/completion:
  completion: recognize more long-options
  completion: teach remote subcommands to complete options
  completion: teach replace to complete options
  completion: teach ls-remote to complete options
  completion: improve bash completion for git-add
  completion: add subcommand completion for rerere
  completion: teach submodule subcommands to complete options
2017-02-15 12:54:19 -08:00
Junio C Hamano cbf1860d73 Merge branch 'rs/swap'
Code clean-up.

* rs/swap:
  graph: use SWAP macro
  diff: use SWAP macro
  use SWAP macro
  apply: use SWAP macro
  add SWAP macro
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
Jeff King 131f3c96d2 grep: treat revs the same for --untracked as for --no-index
git-grep has always disallowed grepping in a tree (as
opposed to the working directory) with both --untracked
and --no-index. But we traditionally did so by first
collecting the revs, and then complaining when any were
provided.

The --no-index option recently learned to detect revs
much earlier. This has two user-visible effects:

  - we don't bother to resolve revision names at all. So
    when there's a rev/path ambiguity, we always choose to
    treat it as a path.

  - likewise, when you do specify a revision without "--",
    the error you get is "no such path" and not "--untracked
    cannot be used with revs".

The rationale for doing this with --no-index is that it is
meant to be used outside a repository, and so parsing revs
at all does not make sense.

This patch gives --untracked the same treatment. While it
_is_ meant to be used in a repository, it is explicitly
about grepping the non-repository contents. Telling the user
"we found a rev, but you are not allowed to use revs" is
not really helpful compared to "we treated your argument as
a path, and could not find it".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 13:59:25 -08:00
Jonathan Nieder 4b0c3c7735 remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
To push from or fetch to the current repository, remote helpers need
to know what repository that is.  Accordingly, Git sets the GIT_DIR
environment variable to the path to the current repository when
invoking remote helpers.

There is a special case it does not handle: "git ls-remote" and "git
archive --remote" can be run to inspect a remote repository without
being run from any local repository.  GIT_DIR is not useful in this
scenario:

- if we are not in a repository, we don't need to set GIT_DIR to
  override an existing GIT_DIR value from the environment.  If GIT_DIR
  is present then we would be in a repository if it were valid and
  would have called die() if it weren't.

- not setting GIT_DIR may cause a helper to do the usual discovery
  walk to find the repository.  But we know we're not in one, or we
  would have found it ourselves.  So in the worst case it may expend
  a little extra effort to try to find a repository and fail (for
  example, remote-curl would do this to try to find repository-level
  configuration).

So leave GIT_DIR unset in this case.  This makes GIT_DIR easier to
understand for remote helper authors and makes transport code less of
a special case for repository discovery.

Noticed using b1ef400e (setup_git_env: avoid blind fall-back to
".git", 2016-10-20) from 'next':

 $ cd /tmp
 $ git ls-remote https://kernel.googlesource.com/pub/scm/git/git
 fatal: BUG: setup_git_env called without repository

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 13:14:00 -08:00
Jeff King 4539c218c3 remote: avoid reading $GIT_DIR config in non-repo
The "git ls-remote" command can be run outside of a
repository, but needs to look up configured remotes. The
config code is smart enough to handle this case itself, but
we also check the historical "branches" and "remotes" paths
in $GIT_DIR. The git_path() function causes us to blindly
look at ".git/remotes", even if we know we aren't in a git
repository.

For now, this is just an unlikely bug (you probably don't
have such a file if you're not in a repository), but it will
become more obvious once we merge b1ef400ee (setup_git_env:
avoid blind fall-back to ".git", 2016-10-20):

  [now]
  $ git ls-remote
  fatal: No remote configured to list refs from.

  [with b1ef400ee]
  $ git ls-remote
  fatal: BUG: setup_git_env called without repository

We can fix this by skipping these sources entirely when
we're outside of a repository.

The test is a little more complex than the demonstration
above. Rather than detect the correct behavior by parsing
the error message, we can actually set up a case where the
remote name we give is a valid repository, but b1ef400ee
would cause us to die in the configuration step.

This test doesn't fail now, but it future-proofs us for the
b1ef400ee change.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 13:13:59 -08:00
Jeff King d9e557a320 show-branch: store resolved head in heap buffer
We resolve HEAD and copy the result to a fixed-size buffer
with memcpy, never checking that it actually fits. This bug
dates back to 8098a178b (Add git-symbolic-ref, 2005-09-30).
Before that we used readlink(), which took a maximum buffer
size.

We can fix this by using resolve_refdup(), which duplicates
the buffer on the heap. That also lets us just check
for a NULL pointer to see if we have resolved HEAD, and
drop the extra head_p variable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 11:28:53 -08:00
Jeff King e6a7c75298 show-branch: drop head_len variable
We copy the result of resolving HEAD into a buffer and keep
track of its length.  But we never actually use the length
for anything besides the copy. Let's stop passing it around.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 11:28:05 -08:00
Jeff King 73fc7b6b9b grep: do not diagnose misspelt revs with --no-index
If we are using --no-index, then our arguments cannot be
revs in the first place. Not only is it pointless to
diagnose them, but if we are not in a repository, we should
not be trying to resolve any names.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 11:26:37 -08:00