Граф коммитов

36417 Коммитов

Автор SHA1 Сообщение Дата
Jeff King 173fd1a1a4 get_importer: use run-command's internal argv_array
This saves a few lines and lets us avoid having to clean up
the memory manually when the command finishes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:11 -07:00
Jeff King 2aeae40a75 get_exporter: use argv_array
This simplifies the code and avoids a fixed array size that
we might accidentally overflow. It also prevents a leak
after finish_command is run, by using the argv_array that
run-command manages for us.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:11 -07:00
Jeff King e0ab2ac6c5 get_helper: use run-command's internal argv_array
The get_helper functions dynamically allocates an
argv_array, feeds it to start_command, and then returns. We
then have to later clean up the memory manually after
calling finish_command. We can make this simpler by just
using run-command's internal argv_array, which handles
cleanup for us.

This also prevents a memory leak in the case that
transport_take_over is used, in which case we free the child
in finish_connect, which does not manually free the array.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:11 -07:00
Jeff King 1823bea10f git_connect: use argv_array
This avoids magic numbers when we allocate fixed-size argv
arrays, and makes it more obvious that we are not
overflowing.

It is also the first step to fixing a memory leak. When
git_connect returns a child_process struct, the argv array
in the struct is dynamically allocated, but the individual
strings are not (they are either owned elsewhere, or are
freed). Later, in finish_connect, we free the array but
leave the strings alone.

This works for the child_process created by git_connect, but
if we use transport_take_over, we may also end up with a
child_process created by transport-helper's get_helper.
In that case, the strings are freshly allocated, and we
would want to free them.  However, we have no idea in
finish_connect which type we have.

By consistently using run-command's internal argv-array, we
do not have to worry about this issue at all; finish_command
takes care of it for us, and we can drop our manual free
entirely.

Note that this actually makes the get_helper leak slightly
worse; now we are leaking both the strings and the array.
But when we adjust it in a future patch, that leak will go
away entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:10 -07:00
Jeff King 5eb7f7ead8 run_column_filter: use argv_array
We currently set up the argv array by hand in a fixed-size
stack-local array. Using an argv array is more readable, as
it handles buffer allocation us (not to mention makes it
obvious we do not overflow the array).

However, there's a more subtle benefit, too. We leave the
function having run start_command (with the child_process
in a static global), and then later run finish_command from
another function. That means when we run finish_command,
neither column_process.argv nor the memory it points to is
valid any longer.

Most of the time finish_command does not bother looking at
argv, but it may if it encounters an error (e.g., waitpid
failure or signal death). This is unusual, which is why
nobody has noticed. But by using run-command's built-in
argv_array, the memory ownership is handled for us
automatically.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:10 -07:00
Jeff King c460c0ecdc run-command: store an optional argv_array
All child_process structs need to point to an argv. For
flexibility, we do not mandate the use of a dynamic
argv_array. However, because the child_process does not own
the memory, this can make memory management with a
separate argv_array difficult.

For example, if a function calls start_command but not
finish_command, the argv memory must persist. The code needs
to arrange to clean up the argv_array separately after
finish_command runs. As a result, some of our code in this
situation just leaks the memory.

To help such cases, this patch adds a built-in argv_array to
the child_process, which gets cleaned up automatically (both
in finish_command and when start_command fails).  Callers
may use it if they choose, but can continue to use the raw
argv if they wish.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-15 09:49:09 -07:00
Junio C Hamano 6308767f0b Merge branch 'fc/prompt-zsh-read-from-file'
* fc/prompt-zsh-read-from-file:
  contrib: completion: fix 'eread()' namespace
2014-05-13 11:53:14 -07:00
Felipe Contreras 66ab301c16 contrib: completion: fix 'eread()' namespace
Otherwise it might collide with a function of the same name in the
user's environment.

Suggested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-13 11:52:51 -07:00
Junio C Hamano 998f84075a Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: Updated Bulgarian translation of git (1307t0f921u)
2014-05-12 10:12:05 -07:00
Alexander Shopov 1c3c8410ef l10n: Updated Bulgarian translation of git (1307t0f921u)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2014-05-11 17:09:01 +03:00
Junio C Hamano b28aeab4ec Git 2.0-rc3 2014-05-09 11:23:55 -07:00
Junio C Hamano 7234af6e7b Sync with 1.9.3 2014-05-09 11:00:48 -07:00
Junio C Hamano eea591373e Git 1.9.3
The third maintenance release for Git 1.9; contains all the fixes
that are scheduled to appear in Git 2.0 since 1.9.2.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-09 10:59:07 -07:00
Junio C Hamano d30acb71ca Sync with maint
* maint:
  shell doc: remove stray "+" in example
  Start preparing for 1.9.3
2014-05-08 11:59:51 -07:00
Jonathan Nieder e28dcdce13 shell doc: remove stray "+" in example
The git-shell(1) manpage says

	EXAMPLE
	       To disable interactive logins, displaying a greeting
		instead:

		+

		   $ chsh -s /usr/bin/git-shell
		   $ mkdir $HOME/git-shell-commands
[...]

The stray "+" has been there ever since the example was added in
v1.8.3-rc0~210^2 (shell: new no-interactive-login command to print a
custom message, 2013-03-09).  The "+" sign between paragraphs is
needed in asciidoc to attach extra paragraphs to a list item but here
it is not needed and ends up rendered as a literal "+".  Remove it.

A quick search with "grep -e '<p>+' /usr/share/doc/git/html/*.html"
doesn't find any other instances of this problem.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-08 10:26:26 -07:00
Junio C Hamano 2b141241bf Merge git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: Fix a couple of typos in the Swedish translation
2014-05-08 10:25:37 -07:00
Junio C Hamano 86ae051274 Start preparing for 1.9.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-08 10:05:22 -07:00
Junio C Hamano bd51339355 Merge branch 'cl/p4-use-diff-tree' into maint
"git p4" dealing with changes in binary files were broken by a
change in 1.9 release.

* cl/p4-use-diff-tree:
  git-p4: format-patch to diff-tree change breaks binary patches
2014-05-08 10:01:32 -07:00
Junio C Hamano 6eca9c0e87 Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint
The shell prompt script (in contrib/), when using the PROMPT_COMMAND
interface, used an unsafe construct when showing the branch name in
$PS1.

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't put unsanitized branch names in $PS1
2014-05-08 10:01:18 -07:00
Junio C Hamano e79fcfcd3f Merge branch 'km/avoid-non-function-return-in-rebase' into maint
"git rebase" used a POSIX shell construct FreeBSD /bin/sh does not
work well with.

* km/avoid-non-function-return-in-rebase:
  Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD"
  rebase: avoid non-function use of "return" on FreeBSD
2014-05-08 10:01:06 -07:00
Junio C Hamano e230cd861b Merge branch 'tb/unicode-6.3-zero-width' into maint
Some more Unicode codepoints defined in Unicode 6.3 as having zero
width have been taught to our display column counting logic.

* tb/unicode-6.3-zero-width:
  utf8.c: partially update to version 6.3
2014-05-08 10:00:45 -07:00
Junio C Hamano 16fefdc3eb Merge branch 'km/avoid-bs-in-shell-glob' into maint
Some tests used shell constructs that did not work well on FreeBSD

* km/avoid-bs-in-shell-glob:
  test: fix t5560 on FreeBSD
2014-05-08 10:00:36 -07:00
Junio C Hamano 73edc54e90 Merge branch 'km/avoid-cp-a' into maint
Some tests used shell constructs that did not work well on FreeBSD

* km/avoid-cp-a:
  test: fix t7001 cp to use POSIX options
2014-05-08 09:59:41 -07:00
Junio C Hamano 1dc51c663c Update draft release notes for 2.0
Describe one last minute one-liner fix for regression introduced in
1.9, and fix a grave mischaracterization on a recent remote-hg/bzr
change, pointed out by Felipe.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-07 15:51:17 -07:00
Junio C Hamano ccfa587787 Merge branch 'cl/p4-use-diff-tree'
Fixes a regression in 1.9.0 with an obviously correct single-liner.

* cl/p4-use-diff-tree:
  git-p4: format-patch to diff-tree change breaks binary patches
2014-05-07 14:39:29 -07:00
Tolga Ceylan 749b668c7d git-p4: format-patch to diff-tree change breaks binary patches
When applying binary patches a full index is required. format-patch
already handles this, but diff-tree needs '--full-index' argument
to always output full index. When git-p4 runs git-apply to test
the patch, git-apply rejects the patch due to abbreviated blob
object names. This is the error message git-apply emits in this
case:

    error: cannot apply binary patch to '<filename>' without full index line
    error: <filename>: patch does not apply

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-07 10:27:22 -07:00
Peter Krefting 80dad719fb l10n: Fix a couple of typos in the Swedish translation
Thanks-to: Anders Jonsson <anders.jonsson@norsjovallen.se>
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2014-05-07 07:06:37 +01:00
Øyvind A. Holm 1c65d3b9d3 RelNotes/2.0.0: Grammar and typo fixes
Signed-off-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-06 17:05:34 -07:00
Junio C Hamano b4f86a4ce8 Git 2.0-rc2 2014-05-02 13:15:52 -07:00
Junio C Hamano 648d9c1827 Merge branch 'mw/symlinks'
A finishing touch fix to a new change already in 'master'.

* mw/symlinks:
  setup: fix windows path buffer over-stepping
2014-05-02 13:11:03 -07:00
Junio C Hamano 06229a6ee0 Merge branch 'km/git-svn-workaround-older-getopt-long'
* km/git-svn-workaround-older-getopt-long:
  t9117: use --prefix "" instead of --prefix=""
2014-05-02 13:10:58 -07:00
Junio C Hamano f7003da0f4 Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'
* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't put unsanitized branch names in $PS1
2014-05-02 13:10:53 -07:00
Junio C Hamano b809658141 Merge branch 'mk/doc-git-gui-display-untracked'
* mk/doc-git-gui-display-untracked:
  Documentation: git-gui: describe gui.displayuntracked
2014-05-02 13:10:47 -07:00
Junio C Hamano 7e76a2f975 Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
  l10n: de.po: improve hint for autocorrected command execution
  l10n: de.po: translate 45 new messages
  l10n: de.po: correct translation of "completed" after resolving deltas
  l10n: zh_CN.po: translate 46 new messages (2229t0f0u)
  l10n: fr translation for v2.0.0rc0 (2228t)
  l10n: Update Swedish translation (2228t0f0u)
  l10n: vi.po (2228t): Update and minor fix
  l10n: git.pot: v2.0.0 round 1 (45 new, 28 removed)
2014-04-30 11:01:42 -07:00
Junio C Hamano b2feb64309 Revert the whole "ask curl-config" topic for now
Postpone this a bit during the feature freeze and retry the effort
in the next cycle.
2014-04-30 11:00:15 -07:00
Ralf Thielow 94f94fcbf2 l10n: de.po: improve hint for autocorrected command execution
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-04-29 06:12:31 +02:00
Ralf Thielow 74c17bb84b l10n: de.po: translate 45 new messages
Translate 45 new messages came from git.pot update in 5e078fc
(l10n: git.pot: v2.0.0 round 1 (45 new, 28 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Thomas Rast <tr@thomasrast.ch>
2014-04-29 06:12:25 +02:00
Ralf Thielow 3957310734 l10n: de.po: correct translation of "completed" after resolving deltas
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-04-29 06:11:09 +02:00
Junio C Hamano d8779e1e25 Merge branch 'db/make-with-curl'
It turns out that some platforms do ship without curl-config even
though they build with the hardcoded default -lcurl and rely on it
to work.

* db/make-with-curl:
  Makefile: default to -lcurl when no CURL_CONFIG or CURLDIR
2014-04-28 15:48:12 -07:00
Junio C Hamano 5f11a7aad0 Merge branch 'jk/external-diff-use-argv-array' (early part)
Crash fix for codepath that miscounted the necessary size for an
array when spawning an external diff program.

* 'jk/external-diff-use-argv-array' (early part):
  run_external_diff: use an argv_array for the command line
2014-04-28 15:47:35 -07:00
Dave Borowitz f3f11fa6a5 Makefile: default to -lcurl when no CURL_CONFIG or CURLDIR
The original implementation of CURL_CONFIG support did not match the
original behavior of using -lcurl when CURLDIR was not set. This broke
implementations that were lacking curl-config but did have libcurl
installed along system libraries, such as MSysGit. In other words, the
assumption that curl-config is always installed was incorrect.

Instead, if CURL_CONFIG is empty or returns an empty result (e.g. due
to curl-config being missing), use the old behavior of falling back to
-lcurl.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-28 14:29:14 -07:00
Junio C Hamano 35936f8fc3 Git 2.0-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-25 10:03:41 -07:00
Martin Erik Werner 6127ff63cf setup: fix windows path buffer over-stepping
Fix a buffer over-stepping issue triggered by providing an absolute path
that is similar to the work tree path.

abspath_part_inside_repo() may currently increment the path pointer by
offset_1st_component() + wtlen, which is too much, since
offset_1st_component() is a subset of wtlen.

For the *nix-style prefix '/', this does (by luck) not cause any issues,
since offset_1st_component() is 1 and there will always be a '/' or '\0'
that can "absorb" this.

In the case of DOS-style prefixes though, the offset_1st_component() is
3 and this can potentially over-step the string buffer. For example if

    work_tree = "c:/r"
    path      = "c:/rl"

Then wtlen is 4, and incrementing the path pointer by (3 + 4) would
end up 2 bytes outside a string buffer of length 6.

Similarly if

    work_tree = "c:/r"
    path      = "c:/rl/d/a"

Then (since the loop starts by also incrementing the pointer one step),
this would mean that the function would miss checking if "c:/rl/d" could
be the work_tree, arguably this is unlikely though, since it would only
be possible with symlinks on windows.

Fix this by simply avoiding to increment by offset_1st_component() and
wtlen at the same time.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-24 13:46:13 -07:00
Junio C Hamano 1697bf30df Merge branch 'jk/pack-bitmap'
A last minute (and hopefully the last) fix to avoid coredumps due
to an incorrect pointer arithmetic.

* jk/pack-bitmap:
  ewah_bitmap.c: do not assume size_t and eword_t are the same size
2014-04-24 12:31:51 -07:00
Junio C Hamano d508e4a8e2 Merge branch 'fc/transport-helper-sync-error-fix'
Make sure the marks are not written out when the transport helper
did not finish happily, to avoid leaving a marks file that is out of
sync with the reality.

* fc/transport-helper-sync-error-fix:
  t5801 (remote-helpers): cleanup environment sets
  transport-helper: fix sync issue on crashes
  transport-helper: trivial cleanup
  transport-helper: propagate recvline() error pushing
  remote-helpers: make recvline return an error
  transport-helper: remove barely used xchgline()
2014-04-24 12:31:34 -07:00
Junio C Hamano e42552135a Merge branch 'db/make-with-curl'
Ask curl-config how to link with the curl library, instead of
having only a limited configurability knobs in the Makefile.

* db/make-with-curl:
  Makefile: allow static linking against libcurl
  Makefile: use curl-config to determine curl flags
2014-04-24 12:31:27 -07:00
Kyle J. McKay 7bbc458b44 t9117: use --prefix "" instead of --prefix=""
Versions of Perl's Getopt::Long module before 2.37 do not contain
this fix that first appeared in Getopt::Long version 2.37:

* Bugfix: With gnu_compat, --foo= will no longer trigger "Option
  requires an argument" but return the empty string.

Instead of using --prefix="" use --prefix "" when testing an
explictly empty prefix string in order to work with older versions
of Perl's Getopt::Long module.

Also add a paragraph on this workaround to the documentation of
git-svn itself.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-23 09:42:28 -07:00
Jiang Xin 6c94aba5fa l10n: zh_CN.po: translate 46 new messages (2229t0f0u)
Translations for git v2.0.0-rc0.  Also correct translatioins on relative
date in date.c with help from Brian Gesiak ($gmane/246390).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2014-04-23 13:00:08 +08:00
Jiang Xin 937ca16645 Merge branch 'fr-po' of git://github.com/jnavila/git
* 'fr-po' of git://github.com/jnavila/git:
  l10n: fr translation for v2.0.0rc0 (2228t)
2014-04-23 12:33:47 +08:00
Kyle J. McKay 68f4e1fc6a ewah_bitmap.c: do not assume size_t and eword_t are the same size
When buffer_grow changes the size of the buffer using realloc,
it first computes and saves the rlw pointer's offset into the
buffer using (uint8_t *) math before the realloc but then
restores it using (eword_t *) math.

In order to do this it's necessary to convert the (uint8_t *)
offset into an (eword_t *) offset.  It was doing this by
dividing by the sizeof(size_t).  Unfortunately sizeof(size_t)
is not same as sizeof(eword_t) on all platforms.

This causes illegal memory accesses and other bad things to
happen when attempting to use bitmaps on those platforms.

Fix this by dividing by the sizeof(eword_t) instead which
will always be correct for all platforms.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-22 16:21:16 -07:00