Commit Graph

29255 Commits

Author SHA1 Message Date
Jeff King
d50c387163 do not send client agent unless server does first
Commit ff5effdf taught both clients and servers of the git protocol
to send an "agent" capability that just advertises their version for
statistics and debugging purposes.  The protocol-capabilities.txt
document however indicates that the client's advertisement is
actually a response, and should never include capabilities not
mentioned in the server's advertisement.

Adding the unconditional advertisement in the server programs was
OK, then, but the clients broke the protocol.  The server
implementation of git-core itself does not care, but at least one
does: the Google Code git server (or any server using Dulwich), will
hang up with an internal error upon seeing an unknown capability.

Instead, each client must record whether we saw an agent string from
the server, and respond with its agent only if the server mentioned
it first.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-10 12:35:13 -07:00
Jeff King
ca8e127c9b send-pack: fix capability-sending logic
If we have capabilities to send to the server, we send the
regular "want" line followed by a NUL, then the
capabilities; otherwise, we do not even send the NUL.

However, when checking whether we want to send the "quiet"
capability, we check args->quiet, which is wrong. That flag
only tells us whether the client side wanted to be quiet,
not whether the server supports it (originally, in c207e34f,
it meant both; however, that was later split into two flags
by 01fdc21f).

We still check the right flag when actually printing
"quiet", so this could only have two effects:

  1. We might send the trailing NUL when we do not otherwise
     need to. In theory, an antique pre-capability
     implementation of git might choke on this (since the
     client is instructed never to respond with capabilities
     that the server has not first advertised).

  2. We might also want to send the quiet flag if the
     args->progress flag is false, but this code path would
     not trigger in that instance.

In practice, it almost certainly never matters. The
report-status capability dates back to 2005. Any real-world
server is going to advertise that, and we will always
respond with at least that capability.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-10 12:26:42 -07:00
Jeff King
ff5effdf45 include agent identifier in capability string
Instead of having the client advertise a particular version
number in the git protocol, we have managed extensions and
backwards compatibility by having clients and servers
advertise capabilities that they support. This is far more
robust than having each side consult a table of
known versions, and provides sufficient information for the
protocol interaction to complete.

However, it does not allow servers to keep statistics on
which client versions are being used. This information is
not necessary to complete the network request (the
capabilities provide enough information for that), but it
may be helpful to conduct a general survey of client
versions in use.

We already send the client version in the user-agent header
for http requests; adding it here allows us to gather
similar statistics for non-http requests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-03 13:03:34 -07:00
Jeff King
745c7c8e62 http: get default user-agent from git_user_agent
This means we will respect the GIT_USER_AGENT build-time
configuration and run-time environment variable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-03 13:11:54 -07:00
Jeff King
42dcbb738b version: add git_user_agent function
This is basically a fancy way of saying "git/$GIT_VERSION",
except that it is overridable at build-time and through the
environment. Which means that people who don't want to
advertise their git version (for privacy or security
reasons) can tweak it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-03 13:11:52 -07:00
Jeff King
816fb46be6 move git_version_string into version.c
The global git_version_string currently lives in git.c, but
doesn't have anything to do with the git wrapper. Let's move
it into its own file, where it will be more appropriate to
build more version-related functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-03 13:11:34 -07:00
Junio C Hamano
5498c5f052 Update draft release notes to 1.7.11
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-01 13:29:48 -07:00
Junio C Hamano
3ba4663420 Merge branch 'ef/maint-rebase-error-message'
By Erik Faye-Lund
* ef/maint-rebase-error-message:
  rebase: report invalid commit correctly
2012-06-01 13:28:25 -07:00
Junio C Hamano
264d5a717b Merge branch 'nh/empty-rebase'
* nh/empty-rebase:
  cherry-pick: regression fix for empty commits
2012-06-01 13:28:19 -07:00
Junio C Hamano
4336b53c66 Merge branch 'vr/rebase-autosquash-does-not-imply-i'
"git rebase -p" used to pay attention to rebase.autosquash which was
wrong.  "git rebase -p -i" should, but "git rebase -p" by itself
should not.

By Vincent van Ravesteijn
* vr/rebase-autosquash-does-not-imply-i:
  Do not autosquash in case of an implied interactive rebase
2012-06-01 13:28:01 -07:00
Junio C Hamano
7a824d3c46 Merge branch 'mm/levenstein-penalize-deletion-less'
"git tags" used to suggest "git stage" which was nonsense; it should
have favored "git tag".  Tweak the cost of deletion to correct it.

By Matthieu Moy
* mm/levenstein-penalize-deletion-less:
  Reduce cost of deletion in levenstein distance (4 -> 3)
2012-06-01 13:27:48 -07:00
Junio C Hamano
21e077fd46 Merge branch 'jl/submodule-report-new-path-once'
"git submodule init" used to report "registered for path ..."  even
for submodules that were registered earlier.

By Jens Lehmann
* jl/submodule-report-new-path-once:
  submodules: print "registered for path" message only once
2012-06-01 13:26:46 -07:00
Junio C Hamano
2c4888efbc Sync with maint 2012-06-01 13:26:16 -07:00
Junio C Hamano
6a6d72b199 Start preparing for 1.7.10.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-01 13:23:11 -07:00
Junio C Hamano
0626fae6af Merge branch 'ef/http-o-depends-on-gvf' into maint
A minor compilation fix.

By Erik Faye-Lund
* ef/http-o-depends-on-gvf:
  Makefile: add missing GIT-VERSION-FILE dependency
2012-06-01 13:22:44 -07:00
Junio C Hamano
f344333cd4 Merge git://github.com/git-l10n/git-po
By Jiang Xin (4) and others
via Jiang Xin
* git://github.com/git-l10n/git-po:
  l10n: Set nplurals of zh_CN.po from 1 to 2
  l10n: zh_CN.po: translate 323 new messages
  l10n: zh.CN.po: update by msgmerge git.pot
  First release translation for Vietnamese
  Init translation for Vietnamese
  l10n: New it.po file with 504 translations
  Update Swedish translation (728t0f0u)
  l10n: Update git.pot (41 new messages)
2012-06-01 13:21:37 -07:00
Junio C Hamano
2147cb2762 Merge branch 'rs/maint-grep-F' into maint
"git grep -e '$pattern'", unlike the case where the patterns are read from
a file, did not treat individual lines in the given pattern argument as
separate regular expressions as it should.

By René Scharfe
* rs/maint-grep-F:
  grep: stop leaking line strings with -f
  grep: support newline separated pattern list
  grep: factor out do_append_grep_pat()
  grep: factor out create_grep_pat()
2012-06-01 13:01:41 -07:00
Junio C Hamano
e2d484c47a Merge branch 'jk/ident-split-fix' into maint
An author/committer name that is a single character was mishandled as an
invalid name by mistake.

By Jeff King
* jk/ident-split-fix:
  fix off-by-one error in split_ident_line
2012-06-01 13:01:36 -07:00
Junio C Hamano
6c227410b5 Merge branch 'jk/pretty-commit-header-incomplete-line' into maint
By Jeff King
* jk/pretty-commit-header-incomplete-line:
  avoid segfault when reading header of malformed commits
2012-06-01 13:01:33 -07:00
Junio C Hamano
92ddfaadc2 Merge branch 'jk/format-person-part-buffer-limit' into maint
By Jeff King
* jk/format-person-part-buffer-limit:
  pretty: avoid buffer overflow in format_person_part
2012-06-01 12:59:58 -07:00
Junio C Hamano
63cdf160f3 Merge branch 'ap/checkout-no-progress-for-non-tty' into maint
"git checkout" gave progress display even when the standard error
stream was not connected to the tty, which made little sense.

By Avery Pennarun
* ap/checkout-no-progress-for-non-tty:
  checkout: no progress messages if !isatty(2).
2012-06-01 12:59:51 -07:00
Junio C Hamano
9c136bfb48 Merge branch 'maint' of git://github.com/git-l10n/git-po into maint
By Peter Krefting
via Peter Krefting
* 'maint' of git://github.com/git-l10n/git-po:
  Update Swedish translation (728t0f0u)
2012-06-01 12:50:41 -07:00
Jiang Xin
f50b565a0f i18n: apply: split to fix a partial i18n message
The 4th arg of "new mode (%o) of %s does not match old mode (%o)%s%s"
is blank string or string " of ". Even mark the string " of " for a
complete i18n, this message is still hard to translate right.

Split it into two slight different messages would make l10n teams happy.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-01 07:43:10 -07:00
Jiang Xin
5ae481e0ad l10n: Set nplurals of zh_CN.po from 1 to 2
In most cases, plural-forms are unnecessary for Chinese. For example,
"apple" and "apples" are the same in Chinese, they are both translated
as "苹果". While there are exceptions, e.g., the plural form of "he",
"she" and "it" is "they" in English. In Chinese, "他(he)", "她(she)",
and "它(it)" have plural forms too, they are "他们", "她们", and "它们".

But what makes 'nplurals=1' hard to work right for Chinese is:

    #: bundle.c:192
    #, c-format
    msgid "The bundle requires this ref"
    msgid_plural "The bundle requires these %d refs"

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2012-06-01 17:43:38 +08:00
Jiang Xin
81809b9984 l10n: zh_CN.po: translate 323 new messages
Update Simplified Chinese translation for 134 fuzzy, 189 new messages
from Git v1.7.10.2-548-g9de96.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Zhuang Ya <zhuangya@me.com>
2012-06-01 17:42:18 +08:00
Erik Faye-Lund
38475f972c Makefile: add missing GIT-VERSION-FILE dependency
In 20fc9bc (Set HTTP user agent to git/GIT_VERSION, 2006-04-04),
http.o started recording GIT_VERSION, but http.o wasn't added
to the list of files that depends on GIT-VERSION-FILE.

Fix this, so mofications to GIT-VERSION-FILE will result in an
updated user-agent string.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-31 12:42:53 -07:00
Jiang Xin
8ada95983c l10n: zh.CN.po: update by msgmerge git.pot
Update of zh_CN.po: 134 fuzzy translations, 189 untranslated messages.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2012-05-31 16:34:51 +08:00
Tran Ngoc Quan
db484bad10 First release translation for Vietnamese
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2012-05-31 12:31:05 +08:00
Tran Ngoc Quan
774cfe0c52 Init translation for Vietnamese
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2012-05-31 12:31:05 +08:00
Erik Faye-Lund
9180feafbc rebase: report invalid commit correctly
In 9765b6a (rebase: align variable content, 2011-02-06), the code
to error out was moved up one level. Unfortunately, one reference
to a function parameter wasn't rewritten as it should, leading to
the wrong parameter being errored on.

This error was propagated by 71786f5 (rebase: factor out reference
parsing, 2011-02-06) and merged in 78c6e0f (Merge branch
'mz/rebase', 2011-04-28).

Correct this by reporting $onto_name istead.

Reported-By: Manuela Hutter <manuelah@opera.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-30 11:59:08 -07:00
Jeff King
b2478aa085 INSTALL: update asciidoc recommendation
Since commit 6cf378f (docs: stop using asciidoc no-inline-literal),
we no longer support asciidoc versions less than 8.4.1,
which introduced inline literals. Note this in the INSTALL
document.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-30 09:07:04 -07:00
Marco Paolone
9d1c2255dc l10n: New it.po file with 504 translations
Signed-off-by: Marco Paolone <marcopaolone@gmail.com>
2012-05-30 13:30:24 +02:00
Junio C Hamano
ac2b0e8fb7 cherry-pick: regression fix for empty commits
The earlier "--keep-redundant-commit" series broke "cherry-pick"
that is given a commit whose change is already in the current
history. Such a cherry-pick would result in an empty change, and
should stop with an error, telling the user that conflict resolution
may have made the result empty (which is exactly what is happening),
but we silently dropped the change on the floor without any message
nor non-zero exit code.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 17:14:41 -07:00
Jens Lehmann
c1c259e225 submodules: print "registered for path" message only once
Since 2cd9de3e (submodule add: always initialize .git/config entry) the
message "Submodule '\$name' (\$url) registered for path '\$sm_path'" is
printed every time cmd_init() is called, e.g. each time "git submodule
update" is used with the --init option.

This was not intended and leads to bogus output which can confuse users
and build systems. Apart from that the $url variable was not set after the
first run which did the actual initialization and only "()" was printed
in subsequent runs where "($url)" was meant to inform the user about the
upstream repo.

Fix that by moving the say command in question into the if block where the
url is initialized, restoring the behavior that was in place before the
2cd9de3e commit. While at it also remove the comment which still describes
the logic used before 2cd9de3e and add a comment about how things work now.

Reported-by: Nicolas Viennot and Sid Nair <nicolas@viennot.com>
Reported-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 13:52:23 -07:00
Junio C Hamano
0680f745ac Merge git://bogomips.org/git-svn
By Jonathan Nieder
via Eric Wong
* git://bogomips.org/git-svn:
  git-svn: make Git::SVN::Fetcher a separate file
  git-svn: rename SVN::Git::* packages to Git::SVN::*
  git-svn: move Git::SVN::Prompt into its own file
2012-05-29 13:47:55 -07:00
Jeff King
f27e7654de t5701: modernize style
This test is pretty old and did not follow some of our more
modern best practices. In particular:

  1. It chdir'd all over the place, leaving later tests to
     deal with the fallout. Do our chdirs in subshells
     instead.

  2. It did not use test_must_fail.

  3. It did not use test_line_count.

  4. It checked for the non-existence of a ref by looking in the
     .git/refs directory (since we pack refs during clone
     these days, this will always be succeed, making the
     test useless).

     Note that one call to "-e .git/refs/..." remains,
     because it is checking for the existence of a symbolic
     ref, not a ref itself.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 13:22:13 -07:00
Junio C Hamano
a8f4933895 Merge branch 'va/git-p4-test'
By Vitor Antunes
* va/git-p4-test:
  git-p4: Clean up branch test cases
  git-p4: Verify detection of "empty" branch creation
  git-p4: Test changelists touching two branches
2012-05-29 13:09:20 -07:00
Junio C Hamano
261ec7d02a Merge branch 'jk/ident-gecos-strbuf'
Fixes quite a lot of brokenness when ident information needs to be taken
from the system and cleans up the code.

By Jeff King
* jk/ident-gecos-strbuf: (22 commits)
  format-patch: do not use bogus email addresses in message ids
  ident: reject bogus email addresses with IDENT_STRICT
  ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
  format-patch: use GIT_COMMITTER_EMAIL in message ids
  ident: let callers omit name with fmt_indent
  ident: refactor NO_DATE flag in fmt_ident
  ident: reword empty ident error message
  format-patch: refactor get_patch_filename
  ident: trim whitespace from default name/email
  ident: use a dynamic strbuf in fmt_ident
  ident: use full dns names to generate email addresses
  ident: report passwd errors with a more friendly message
  drop length limitations on gecos-derived names and emails
  ident: don't write fallback username into git_default_name
  fmt_ident: drop IDENT_WARN_ON_NO_NAME code
  format-patch: use default email for generating message ids
  ident: trim trailing newline from /etc/mailname
  move git_default_* variables to ident.c
  move identity config parsing to ident.c
  fmt-merge-msg: don't use static buffer in record_person
  ...
2012-05-29 13:09:13 -07:00
Junio C Hamano
12d7d15074 Merge branch 'jk/fetch-pack-remove-dups-optim'
The way "fetch-pack" that is given multiple references to fetch tried to
remove duplicates was very inefficient.

By Jeff King
* jk/fetch-pack-remove-dups-optim:
  fetch-pack: sort incoming heads list earlier
  fetch-pack: avoid quadratic loop in filter_refs
  fetch-pack: sort the list of incoming refs
  add sorting infrastructure for list refs
  fetch-pack: avoid quadratic behavior in remove_duplicates
  fetch-pack: sort incoming heads
2012-05-29 13:09:08 -07:00
Junio C Hamano
a7060009e1 Merge branch 'rs/refs-string-slice'
Avoid unnecessary temporary allocations while looking for matching refs
inside refs API.

By René Scharfe (3) and Junio C Hamano (1)
* rs/refs-string-slice:
  refs: do not create ref_entry when searching
  refs: use strings directly in find_containing_dir()
  refs: convert parameter of create_dir_entry() to length-limited string
  refs: convert parameter of search_ref_dir() to length-limited string
2012-05-29 13:09:02 -07:00
Junio C Hamano
4dbfaee0c7 Merge branch 'mh/fetch-pack-constness'
Tighten constness of some local variables in a callchain.

By Michael Haggerty
* mh/fetch-pack-constness:
  cmd_fetch_pack(): respect constness of argv parameter
  cmd_fetch_pack(): combine the loop termination conditions
  cmd_fetch_pack(): handle non-option arguments outside of the loop
  cmd_fetch_pack(): declare dest to be const
2012-05-29 13:08:53 -07:00
Junio C Hamano
38f2b874ff Merge branch 'mh/ref-api-lazy-loose'
The code to lazily read loose refs unnecessarily read the refs in a
subhierarchy by mistake when we free the data for the subhierarchy.

By Michael Haggerty
* mh/ref-api-lazy-loose:
  free_ref_entry(): do not trigger reading of loose refs
2012-05-29 13:08:35 -07:00
Junio C Hamano
32bd3a514b Merge branch 'ng/pack-objects-cleanup'
By Nguyễn Thái Ngọc Duy
* ng/pack-objects-cleanup:
  pack-objects: refactor write_object() into helper functions
  pack-objects, streaming: turn "xx >= big_file_threshold" to ".. > .."
2012-05-29 13:08:30 -07:00
Vincent van Ravesteijn
8a6dae108e Do not autosquash in case of an implied interactive rebase
The option to autosquash is only used in case of an interactive rebase.
When merges are preserved, rebase uses an interactive rebase internally,
but in this case autosquash should still be disabled.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 11:44:14 -07:00
Matthieu Moy
c41494f8c8 Reduce cost of deletion in levenstein distance (4 -> 3)
Before this patch, a character deletion has the same cost as 2 swaps, or
4 additions, so Git prefers suggesting a completely scrambled command
name to removing a character. For example, "git tags" suggests "stage",
but not "tag".

By setting the deletion cost to 3, we keep it higher than swaps or
additions, but prefer 1 deletion to 2 swaps. "git tags" now suggests
"tag" in addition to staged.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 11:12:59 -07:00
Vitor Antunes
5d5c556ac4 git-p4: Clean up branch test cases
Correct submit description in one test and remove not required commands
from another.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 10:46:00 -07:00
Vitor Antunes
ad71f6617e git-p4: Verify detection of "empty" branch creation
Current implementation of new branch parent detection works on the
principle that the new branch is a complete integration, with no
changes, of the original files.
This test shows this deficiency in the particular case when the new
branch is created from a subset of the original files.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 10:46:00 -07:00
Vitor Antunes
9e826dfd57 git-p4: Test changelists touching two branches
It is possible to modify two different branches in P4 in a single
changelist. git-p4 correctly detects this and commits the relevant
changes to the different branches separately. This test proves that and
avoid future regressions in this behavior.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29 10:45:59 -07:00
Jiang Xin
6f3c0ef937 Merge branch 'maint'
By Peter Krefting
via Peter Krefting
* maint:
  Update Swedish translation (728t0f0u)
2012-05-29 16:48:05 +08:00
Peter Krefting
3f0812f68d Update Swedish translation (728t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2012-05-29 09:28:34 +01:00