Commit graph

40826 commits

Author SHA1 Message Date
Jeff King c1fd080917 fsck: use strbuf to generate alternate directories
When fsck-ing alternates, we make a copy of the alternate
directory in a fixed PATH_MAX buffer. We memcpy directly,
without any check whether we are overflowing the buffer.
This is OK if PATH_MAX is a true representation of the
maximum path on the system, because any path here will have
already been vetted by the alternates subsystem. But that is
not true on every system, so we should be more careful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King af49c6d091 add reentrant variants of sha1_to_hex and find_unique_abbrev
The sha1_to_hex and find_unique_abbrev functions always
write into reusable static buffers. There are a few problems
with this:

  - future calls overwrite our result. This is especially
    annoying with find_unique_abbrev, which does not have a
    ring of buffers, so you cannot even printf() a result
    that has two abbreviated sha1s.

  - if you want to put the result into another buffer, we
    often strcpy, which looks suspicious when auditing for
    overflows.

This patch introduces sha1_to_hex_r and find_unique_abbrev_r,
which write into a user-provided buffer. Of course this is
just punting on the overflow-auditing, as the buffer
obviously needs to be GIT_SHA1_HEXSZ + 1 bytes. But it is
much easier to audit, since that is a well-known size.

We retain the non-reentrant forms, which just become thin
wrappers around the reentrant ones. This patch also adds a
strbuf variant of find_unique_abbrev, which will be handy in
later patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King 399ad553ce strbuf: make strbuf_complete_line more generic
The strbuf_complete_line function makes sure that a buffer
ends in a newline. But we may want to do this for any
character (e.g., "/" on the end of a path). Let's factor out
a generic version, and keep strbuf_complete_line as a thin
wrapper.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King bb3788cebb add git_path_buf helper function
If you have a function that uses git_path a lot, but would
prefer to avoid the static buffers, it's useful to keep a
single scratch buffer locally and reuse it for each call.
You used to be able to do this with git_snpath:

  char buf[PATH_MAX];

  foo(git_snpath(buf, sizeof(buf), "foo"));
  bar(git_snpath(buf, sizeof(buf), "bar"));

but since 1a83c24, git_snpath has been replaced with
strbuf_git_path. This is good, because it removes the
arbitrary PATH_MAX limit. But using strbuf_git_path is more
awkward for two reasons:

  1. It adds to the buffer, rather than replacing it. This
     is consistent with other strbuf functions, but makes
     reuse of a single buffer more tedious.

  2. It doesn't return the buffer, so you can't format
     as part of a function's arguments.

The new git_path_buf solves both of these, so you can use it
like:

  struct strbuf buf = STRBUF_INIT;

  foo(git_path_buf(&buf, "foo"));
  bar(git_path_buf(&buf, "bar"));

  strbuf_release(&buf);

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King 7b03c89ebd add xsnprintf helper function
There are a number of places in the code where we call
sprintf(), with the assumption that the output will fit into
the buffer. In many cases this is true (e.g., formatting a
number into a large buffer), but it is hard to tell
immediately from looking at the code. It would be nice if we
had some run-time check to make sure that our assumption is
correct (and to communicate to readers of the code that we
are not blindly calling sprintf, but have actually thought
about this case).

This patch introduces xsnprintf, which behaves just like
snprintf, except that it dies whenever the output is
truncated. This acts as a sort of assert() for these cases,
which can help find places where the assumption is violated
(as opposed to truncating and proceeding, which may just
silently give a wrong answer).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King fbe85e73ce fsck: don't fsck alternates for connectivity-only check
Commit 02976bf (fsck: introduce `git fsck --connectivity-only`,
2015-06-22) recently gave fsck an option to perform only a
subset of the checks, by skipping the fsck_object_dir()
call. However, it does so only for the local object
directory, and we still do expensive checks on any alternate
repos. We should skip them in this case, too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King 108332c7a0 archive-tar: fix minor indentation violation
This looks like a simple omission from 8539070 (archive-tar:
unindent write_tar_entry by one level, 2012-05-03).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King d270d7b7a2 mailsplit: fix FILE* leak in split_maildir
If we encounter an error while splitting a maildir, we exit
the function early, leaking the open filehandle. This isn't
a big deal, since we exit the program soon after, but it's
easy enough to be careful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Jeff King 7cd17e8057 show-branch: avoid segfault with --reflog of unborn branch
When no branch is given to the "--reflog" option, we resolve
HEAD to get the default branch. However, if HEAD points to
an unborn branch, resolve_ref returns NULL, and we later
segfault trying to access it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-25 10:18:18 -07:00
Junio C Hamano 8d530c4d64 Git 2.6-rc3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-21 13:26:13 -07:00
Junio C Hamano 74a844a555 Merge branch 'rj/mailmap-ramsay'
* rj/mailmap-ramsay:
  mailmap: update my entry with new email address
2015-09-21 12:58:35 -07:00
Junio C Hamano b6bd2d0964 Merge branch 'bn/send-email-smtp-auth-error-message-fix'
Fix a minor regression brought in to "git send-email" by a recent
addition of the "--smtp-auth" option.

* bn/send-email-smtp-auth-error-message-fix:
  send-email: fix uninitialized var warning for $smtp_auth
2015-09-21 12:27:15 -07:00
Junio C Hamano e646ab9cf8 l10n-2.6.0-rnd2 plus de
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV/uXYAAoJEMek6Rt1RHooODkQAJwYmAUkk9AB2i/pj1zoiS+Q
 uQO1mSvPQmK09ZWm5pqXH9EGzCprBmeRwXuGOZfoibRVRgoXmpmsjBTfMdkeCqJR
 8FEbez2NMUc0purnQc9gRUurQMPWVIPwZ8kRSi1fbFeW60VqXDL2uYku0NbG5MCv
 QxTHA39uMT2uK/SLqubs7yODMJvb4V/bh6oncYQp3bGAPpNQgpaYjkVkgNukeETG
 MbYjbYMOcwAMm9OYhWY3TO+yDkj5FShOxQP4tOCPtLVHtXHboJEO/tiphj+jGrL+
 cpZih9k2l7Q2gYHWv3C76uJ1tNXJkATOnJZkL1OZN5tyBk12DCPbP6qrtHpp9eHE
 kNDBfxn7sWUv7150Ek+pfQkwrNODEqsYOw277D9Ny0dtHeyy/s5TNbLpRAd0WnB1
 0VstwL4ONi7aRDuh0Xu1gfQdvp4uJ7tAu3yZolR4lup9Z+s/S4eWyPavEYrz7D6a
 /md4+vmN9aA/VEuuG3y3vKhvUp3LBkm52vDCQhFQzr3DI3oMtdM+HNEgbvyIgjO+
 IHFSpPa4vYiNRHuCWXgp1j2IJqGg8hjNrEW1cbbxQOjy99lKlSu+aVjePdR1as8H
 5Rdj7MH+WwhCl45p4jm1R8ofOsKk7U0CfrcBU9GqJOpZtrl0H09V8T+EWm1wXj4B
 FIQP5nyKliUTJZpG4hW4
 =2+Ps
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.6.0-rnd2+de' of git://github.com/git-l10n/git-po

l10n-2.6.0-rnd2 plus de

* tag 'l10n-2.6.0-rnd2+de' of git://github.com/git-l10n/git-po: (25 commits)
  l10n: de.po: better language for one string
  l10n: de.po: translate 2 messages
  l10n: Update and review Vietnamese translation (2440t)
  l10n: fr.po v2.6.0 round 2 (2440t)
  l10n: zh_CN: for git v2.6.0 l10n round 2
  l10n: ca.po: update translation
  l10n: git.pot: v2.6.0 round 2 (3 improvements)
  l10n: de.po: translate 123 new messages
  l10n: fr.po v2.6.0 round 1 (2441t)
  l10n: sv.po: Update Swedish translation (2441t0f0u)
  l10n: zh_CN: for git v2.6.0 l10n round 1
  l10n: Updated Vietnamese translation (2441t)
  l10n: git.pot: v2.6.0 round 1 (123 new, 41 removed)
  l10n: zh_CN: Update Git Glossary: "commit message"
  l10n: zh_CN: Update Git Glossary: pickaxe
  l10n: zh_CN: Update Git Glossary: fork
  l10n: zh_CN: Update Git Glossary: tag
  l10n: zh_CN: Update Git Glossary: "dumb", "smart"
  l10n: zh_CN: Update Git Glossary: SHA-1
  l10n: zh_CN: Add Surrounding Spaces
  ...
2015-09-21 10:54:07 -07:00
Brian Norris 904f6e7c15 send-email: fix uninitialized var warning for $smtp_auth
On the latest version of git-send-email, I see this error just before
running SMTP auth (I didn't provide any --smtp-auth= parameter):

  Use of uninitialized value $smtp_auth in pattern match (m//) at \
  /home/briannorris/git/git/git-send-email.perl line 1139.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-21 10:51:19 -07:00
Phillip Sz 18a21c1956 l10n: de.po: better language for one string
Just one string I think we could translate better.

Signed-off-by: Phillip Sz <phillip.szelat@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-09-20 18:49:09 +02:00
Ralf Thielow 2e0f3663f5 l10n: de.po: translate 2 messages
Translate 2 messages came from git.pot update in e447091
(l10n: git.pot: v2.6.0 round 2 (3 improvements)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>
2015-09-20 18:49:09 +02:00
Tran Ngoc Quan 5fc31c1f81 l10n: Update and review Vietnamese translation (2440t)
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2015-09-21 00:44:47 +08:00
Jean-Noel Avila 84486b1ebe l10n: fr.po v2.6.0 round 2 (2440t)
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2015-09-21 00:44:47 +08:00
Jiang Xin 03ea3327da l10n: zh_CN: for git v2.6.0 l10n round 2
Update 2 translations (2440t0f0u) for git v2.6.0-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-09-21 00:44:47 +08:00
Alex Henrie 3ffa1ab2c8 l10n: ca.po: update translation
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2015-09-21 00:44:47 +08:00
Jiang Xin 80d1b4817a l10n: git.pot: v2.6.0 round 2 (3 improvements)
Introduce three i18n improvements from the following commits:

* tag, update-ref: improve description of option "create-reflog"
* pull: don't mark values for option "rebase" for translation
* show-ref: place angle brackets around variables in usage string

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-09-21 00:44:46 +08:00
Jiang Xin 070d1084ba Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 123 new messages
  l10n: fr.po v2.6.0 round 1 (2441t)
  l10n: sv.po: Update Swedish translation (2441t0f0u)
  l10n: zh_CN: for git v2.6.0 l10n round 1
  l10n: Updated Vietnamese translation (2441t)
  l10n: git.pot: v2.6.0 round 1 (123 new, 41 removed)
  l10n: zh_CN: Update Git Glossary: "commit message"
  l10n: zh_CN: Update Git Glossary: pickaxe
  l10n: zh_CN: Update Git Glossary: fork
  l10n: zh_CN: Update Git Glossary: tag
  l10n: zh_CN: Update Git Glossary: "dumb", "smart"
  l10n: zh_CN: Update Git Glossary: SHA-1
  l10n: zh_CN: Add Surrounding Spaces
  l10n: zh_CN: Add translations for Git glossary
  l10n: TEAMS: stash inactive zh_CN team members
  l10n: zh_CN: Update Translation of "tag"
  l10n: zh_CN: Unify Translation of "packfile"
  l10n: zh_CN: Update Translation: "tag object"

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-09-21 00:44:07 +08:00
Ralf Thielow e6e86ed4c4 l10n: de.po: translate 123 new messages
Translate 123 new messages came from git.pot update in df0617b
(l10n: git.pot: v2.6.0 round 1 (123 new, 41 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
2015-09-21 00:35:49 +08:00
Jean-Noel Avila 7a43c952de l10n: fr.po v2.6.0 round 1 (2441t)
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2015-09-21 00:35:42 +08:00
Junio C Hamano 0e5767991b Update RelNotes to 2.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-17 12:33:24 -07:00
Junio C Hamano 4d8002429f Sync with 2.5.3
* maint:
  Git 2.5.3
2015-09-17 12:29:49 -07:00
Junio C Hamano a2654356d4 Merge branch 'po/doc-branch-desc'
The branch descriptions that are set with "git branch --edit-description"
option were used in many places but they weren't clearly documented.

* po/doc-branch-desc:
  doc: show usage of branch description
2015-09-17 12:29:03 -07:00
Junio C Hamano 8d45eefe3e Merge branch 'et/win32-poll-timeout'
* et/win32-poll-timeout:
  poll: honor the timeout on Win32
2015-09-17 12:29:02 -07:00
Junio C Hamano 1c1fee746e Merge branch 'as/config-doc-markup-fix'
* as/config-doc-markup-fix:
  Documentation/config: fix formatting for branch.*.rebase and pull.rebase
2015-09-17 12:29:01 -07:00
Junio C Hamano ee6ad5f4d5 Git 2.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-17 12:16:17 -07:00
Junio C Hamano 8833ccd7d0 Merge branch 'dt/untracked-subdir' into maint
The experimental untracked-cache feature were buggy when paths with
a few levels of subdirectories are involved.

* dt/untracked-subdir:
  untracked cache: fix entry invalidation
  untracked-cache: fix subdirectory handling
  t7063: use --force-untracked-cache to speed up a bit
  untracked-cache: support sparse checkout
2015-09-17 12:12:29 -07:00
Junio C Hamano d6579d9436 Merge branch 'br/svn-doc-include-paths-config' into maint
* br/svn-doc-include-paths-config:
  git-svn doc: mention "svn-remote.<name>.include-paths"
2015-09-17 12:11:46 -07:00
Junio C Hamano cfc3e0ee4a Merge branch 'ah/submodule-typofix-in-error' into maint
Error string fix.

* ah/submodule-typofix-in-error:
  git-submodule: remove extraneous space from error message
2015-09-17 12:11:08 -07:00
Junio C Hamano 02dad2673b Merge branch 'js/maint-am-skip-performance-regression' into maint
* js/maint-am-skip-performance-regression:
  am --skip/--abort: merge HEAD/ORIG_HEAD tree into index
2015-09-17 12:03:02 -07:00
Ramsay Jones dafc047369 mailmap: update my entry with new email address
My 'demon' email address is no longer functional since, after 16+
years with demon, I have had to change my ISP. :(

Also, take the opportunity to remove my middle name, which I only
use on official documents (or in the GECOS field when creating a
user account on unix).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-16 09:08:48 -07:00
Junio C Hamano f4d9753a89 Update RelNotes to 2.6 to describe leftover bits since -rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-14 15:00:41 -07:00
Junio C Hamano cf2094ca63 Merge branch 'js/maint-am-skip-performance-regression'
Recent versions of scripted "git am" has a performance regression in
"git am --skip" codepath, which no longer exists in the built-in
version on the 'master' front.  Fix the regression in the last
scripted version that appear in 2.5.x maintenance track and older.

* js/maint-am-skip-performance-regression:
  am --skip/--abort: merge HEAD/ORIG_HEAD tree into index
2015-09-14 14:59:13 -07:00
Junio C Hamano b8367d1f01 Merge branch 'ah/show-ref-usage-string'
Both "git show-ref -h" and "git show-ref --help" illustrated that the
"--exclude-existing" option makes the command read list of refs
from its standard input.  Change only the "show-ref -h" output to
have a pair of "<>" around the placeholder that designate an input
file, i.e. "git show-ref --exclude-existing < <ref-list>".

* ah/show-ref-usage-string:
  show-ref: place angle brackets around variables in usage string
2015-09-14 14:59:06 -07:00
Junio C Hamano a9400b01df Merge branch 'sg/help-group'
* sg/help-group:
  Makefile: use SHELL_PATH when running generate-cmdlist.sh
2015-09-14 14:59:05 -07:00
Junio C Hamano 153ec926b6 Merge branch 'rt/help-strings-fix'
* rt/help-strings-fix:
  tag, update-ref: improve description of option "create-reflog"
  pull: don't mark values for option "rebase" for translation
2015-09-14 14:59:04 -07:00
Junio C Hamano 45733fa93f Git 2.6-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-14 13:17:56 -07:00
Edward Thomson ef8b53e78c poll: honor the timeout on Win32
Ensure that when passing a pipe, the gnulib poll replacement will not
return 0 before the timeout has passed.

Not obeying the timeout (and merely returning 0) causes pathological
behavior when preparing a packfile for a repository and taking a
long time to do so.  If poll were to return 0 immediately, this would
cause keep-alives to get sent as quickly as possible until the packfile
was created.  Such deviance from the standard would cause megabytes (or
more) of keep-alive packets to be sent.

GetTickCount is used as it is efficient, stable and monotonically
increasing.  (Neither GetSystemTime nor QueryPerformanceCounter have
all three of these properties.)

Signed-off-by: Edward Thomson <ethomson@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-14 12:53:48 -07:00
Philip Oakley 561d2b7934 doc: show usage of branch description
The branch description will be included in 'git format-patch
--cover-letter' and in 'git pull-request' emails. It can also
be used in the automatic merge message. Tell the reader.

While here, clarify that the description may be a multi-line
explanation of the purpose of the branch's patch series.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-14 12:50:33 -07:00
Junio C Hamano 3f26fe7644 Merge git://ozlabs.org/~paulus/gitk
* git://ozlabs.org/~paulus/gitk:
  gitk: Accelerators for the main menu
  gitk: Adjust the menu line numbers to compensate for the new entry
  gitk: Add a "Copy commit summary" command
  gitk: Update Bulgarian translation (307t)
  gitk: Update .po files
  gitk: Update Bulgarian translation (304t)
  gitk: Use translated version of "Command line" in getcommitlines
  gitk: Make it easier to go quickly to a specific commit
  gitk: Show the current view's name in the window title
  gitk: Add mouse right-click options to copy path and branch name
  gitk: Remove mc parameter from proc show_error
  gitk: Fix error when changing colors after closing "List references" window
  gitk: Replace catch {unset foo} with unset -nocomplain foo
  gitk: Rearrange window title to be more conventional
  gitk: sv.po: Update Swedish translation (305t0f0u)
  gitk: Fix bad English grammar "Matches none Commit Info"
2015-09-14 11:50:21 -07:00
Junio C Hamano 4be6af6459 Merge branch 'jk/pack-protocol-doc'
Streamline documentation of the pkt-line protocol.

* jk/pack-protocol-doc:
  pack-protocol: clarify LF-handling in PKT-LINE()
2015-09-14 11:46:59 -07:00
Junio C Hamano 971f9ea543 Merge branch 'mp/t7060-diff-index-test'
Fix an old test that was doing the same thing as another one.

* mp/t7060-diff-index-test:
  t7060: actually test "git diff-index --cached -M"
2015-09-14 11:46:31 -07:00
Junio C Hamano e0eeba263c Merge branch 'gb/apply-comment-typofix'
* gb/apply-comment-typofix:
  apply: comment grammar fix
2015-09-14 11:44:44 -07:00
Giuseppe Bilotta d99b4b0de2 gitk: Accelerators for the main menu
This allows fast, keyboard-only usage of the menu (e.g. Alt+V, N to open a
new view).

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-09-13 15:05:24 +10:00
Beat Bolli b6f92a8563 gitk: Adjust the menu line numbers to compensate for the new entry
Commit d835dbb9 ("gitk: Add a "Copy commit summary" command",
2015-08-13) in the upstream gitk repo added a new context menu entry.
Therefore, the line numbers of the entries below the new one need to be
adjusted when their text or state is changed.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-09-13 15:00:30 +10:00
Andreas Schwab d23871079f Documentation/config: fix formatting for branch.*.rebase and pull.rebase
Don't format the second paragraph as a literal block.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-12 18:09:24 -07:00