Commit graph

45938 commits

Author SHA1 Message Date
Jeff King ba47a3088f replace snprintf with odb_pack_name()
In several places we write the name of the pack filename
into a fixed-size buffer using snprintf(), but do not check
the return value.  As a result, a very long object directory
could cause us to quietly truncate the pack filename
(potentially leading to a corrupted repository, as a newly
written packfile could be missing its .pack extension).

We can use odb_pack_name() to do this with a strbuf (and
shorten the code, as well).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-16 11:26:18 -07:00
Jeff King eaeefc3276 odb_pack_keep(): stop generating keepfile name
The odb_pack_keep() function generates the name of a .keep
file and opens it. This has two problems:

  1. It requires a fixed-size buffer to create the filename
     and doesn't notice when the result is truncated.

  2. Of the two callers, one sometimes wants to open a
     filename it already has, which makes things awkward (it
     has to do so manually, and skips the leading-directory
     creation).

Instead, let's have odb_pack_keep() just open the file.
Generating the name isn't hard, and a future patch will
switch callers over to odb_pack_name() anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-16 11:17:00 -07:00
Jeff King 1cec8c634f sha1_file.c: make pack-name helper globally accessible
We provide sha1_pack_name() and sha1_pack_index_name(), but
the more generic form (which takes its own strbuf and an
arbitrary extension) is only used to implement the other
two.  Let's make it available, but clean up a few things:

  1. Name it odb_pack_name(), as the original
     sha1_get_pack_name() is long but not all that
     descriptive.

  2. Switch the strbuf argument to the beginning, so that it
     matches similar path-building functions like
     git_path_buf().

  3. Clean up the out-dated docstring and move it to the
     public declaration.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-16 11:05:17 -07:00
Jeff King 82c9d6614b move odb_* declarations out of git-compat-util.h
These functions were originally conceived as wrapper
functions similar to xmkstemp(). They were later moved by
463db9b10 (wrapper: move odb_* to environment.c,
2010-11-06). The more appropriate place for a declaration is
in cache.h.

While we're at it, let's add some basic docstrings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-16 11:04:34 -07: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 c0588fd61a Merge branch 'rt/align-add-i-help-text'
Doc update.

* rt/align-add-i-help-text:
  git add -i: replace \t with blanks in the help message
2017-02-24 10:48:08 -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
Junio C Hamano cc24d7d21f l10n-2.12.0-rnd2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYsF4RAAoJEMek6Rt1RHooFwkQALB/E6QRCe/mi627DeKo5Rrs
 m0AHWf2BVfUX5KtKvrDO3gHz3K8ytf32McY6SOeywlQISIJzqy5ndAHMKgpjXDws
 fPD4QtByTNEiaSMiDibKEVu+18q+YS/NFLagh4BNT31fcrSEcIj2Taq+k8r5hg0N
 1Kv24vKjevVMRGpCIxFkut6xj8v849NlY06H2hbs+DHSAqBn6M6lc3DlpDIguORE
 E0Q099YBBY1yyso91UF+lkJOdnTDcOw7QOejWLO66O8CL9P8e8Kx+UpepAz7Xp5V
 WcGv1CyPupEWClYM1gixMvmcDF4JMEfTZ6BhoRATMTE4ojB+XtxWSXV2pWQWBjhT
 44C80xdMYTdYhHUhH4rpgFdjxBufWIjHULqa0hNIF/4sPN+Y0EwgiVitmuKWd8kx
 Yd3hLJdy4975HwwmD7QhviuLVTcJxNa1ZI43+JvMG9ZbTpgX6HFPfns6c64DElwi
 shTrIKoTIjEAxL9ukiLwniiEJYAcHgaxPLMOqDPmka2pdBIWdZhBECD43hVTXcEH
 yCeJJ88A/GanAADBH1EoctJTTZGdBaPj7R4QbjzF0XGI3RCwmVc5XnBe0LxZgXi8
 NMIZ9gSZg/MlY8JLrBd4zbXpM15Lhdo5o7vrChkmZFmSkaecNPmYHLm7ACembih9
 0LSPbgkKjdBK/F+dOOuB
 =SZGw
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.12.0-rnd2

* tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
  l10n: zh_CN: for git v2.12.0 l10n round 2
  l10n: Update Catalan translation
  l10n: pt_PT: update Portuguese tranlation
  l10n: sv.po: Update Swedish translation (3139t0f0u)
  l10n: de.po: translate 241 messages
  l10n: ko.po: Update Korean translation
  l10n: vi.po (3139t): Updated 2 new messages for rc1
  l10n: fr.po: v2.12.0 round 2 3139t
  l10n: git.pot: v2.12.0 round 2 (2 new)
  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
  ...
2017-02-24 09:55:41 -08:00
Jiang Xin 1a79b2f179 l10n: zh_CN: for git v2.12.0 l10n round 2
Translate 241 messages (3139t0f0u) for git v2.12.0-rc1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2017-02-25 00:19:14 +08:00
Jordi Mas a14eee8f4d l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2017-02-25 00:14:55 +08:00
Vasco Almeida e06cdf12d3 l10n: pt_PT: update Portuguese tranlation
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
2017-02-23 16:14:55 -01:00
Ralf Thielow e519eccdf4 git add -i: replace \t with blanks in the help message
Within the help message of 'git add -i', the 'diff' command uses one
tab character and blanks to create the space between the name and the
description while the others use blanks only.  So if the tab size is
not at 4 characters, this description will not be in range.
Replace the tab character with blanks.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-22 12:51:00 -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
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
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