1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 02:26:11 +02:00
Commit Graph

49834 Commits

Author SHA1 Message Date
Brandon Williams ed10cb952d serve: introduce git-serve
Introduce git-serve, the base server for protocol version 2.

Protocol version 2 is intended to be a replacement for Git's current
wire protocol.  The intention is that it will be a simpler, less
wasteful protocol which can evolve over time.

Protocol version 2 improves upon version 1 by eliminating the initial
ref advertisement.  In its place a server will export a list of
capabilities and commands which it supports in a capability
advertisement.  A client can then request that a particular command be
executed by providing a number of capabilities and command specific
parameters.  At the completion of a command, a client can request that
another command be executed or can terminate the connection by sending a
flush packet.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-15 12:01:08 -07:00
Brandon Williams 74e7002961 test-pkt-line: introduce a packet-line test helper
Introduce a packet-line test helper which can either pack or unpack an
input stream into packet-lines and writes out the result to stdout.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:07 -07:00
Brandon Williams 8f6982b4e1 protocol: introduce enum protocol_version value protocol_v2
Introduce protocol_v2, a new value for 'enum protocol_version'.
Subsequent patches will fill in the implementation of protocol_v2.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:07 -07:00
Brandon Williams 432e956510 transport: store protocol version
Once protocol_v2 is introduced requesting a fetch or a push will need to
be handled differently depending on the protocol version.  Store the
protocol version the server is speaking in 'struct git_transport_data'
and use it to determine what to do in the case of a fetch or a push.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams ad6ac1244f connect: discover protocol version outside of get_remote_heads
In order to prepare for the addition of protocol_v2 push the protocol
version discovery outside of 'get_remote_heads()'.  This will allow for
keeping the logic for processing the reference advertisement for
protocol_v1 and protocol_v0 separate from the logic for protocol_v2.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams 7e3e479b90 connect: convert get_remote_heads to use struct packet_reader
In order to allow for better control flow when protocol_v2 is introduced
convert 'get_remote_heads()' to use 'struct packet_reader' to read
packet lines.  This enables a client to be able to peek the first line
of a server's response (without consuming it) in order to determine the
protocol version its speaking and then passing control to the
appropriate handler.

This is needed because the initial response from a server speaking
protocol_v0 includes the first ref, while subsequent protocol versions
respond with a version line.  We want to be able to read this first line
without consuming the first ref sent in the protocol_v0 case so that the
protocol version the server is speaking can be determined outside of
'get_remote_heads()' in a future patch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams 635365eb2f transport: use get_refs_via_connect to get refs
Remove code duplication and use the existing 'get_refs_via_connect()'
function to retrieve a remote's heads in 'fetch_refs_via_pack()' and
'git_transport_push()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams ae2948f30c upload-pack: factor out processing lines
Factor out the logic for processing shallow, deepen, deepen_since, and
deepen_not lines into their own functions to simplify the
'receive_needs()' function in addition to making it easier to reuse some
of this logic when implementing protocol_v2.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams a3d6b53e92 upload-pack: convert to a builtin
In order to allow for code sharing with the server-side of fetch in
protocol-v2 convert upload-pack to be a builtin.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams a4cfd41c7b pkt-line: add delim packet support
One of the design goals of protocol-v2 is to improve the semantics of
flush packets.  Currently in protocol-v1, flush packets are used both to
indicate a break in a list of packet lines as well as an indication that
one side has finished speaking.  This makes it particularly difficult
to implement proxies as a proxy would need to completely understand git
protocol instead of simply looking for a flush packet.

To do this, introduce the special deliminator packet '0001'.  A delim
packet can then be used as a deliminator between lists of packet lines
while flush packets can be reserved to indicate the end of a response.

Documentation for how this packet will be used in protocol v2 will
included in a future patch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams 77dabc14c4 pkt-line: allow peeking a packet line without consuming it
Sometimes it is advantageous to be able to peek the next packet line
without consuming it (e.g. to be able to determine the protocol version
a server is speaking).  In order to do that introduce 'struct
packet_reader' which is an abstraction around the normal packet reading
logic.  This enables a caller to be able to peek a single line at a time
using 'packet_reader_peek()' and having a caller consume a line by
calling 'packet_reader_read()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:06 -07:00
Brandon Williams 2153d478b7 pkt-line: introduce packet_read_with_status
The current pkt-line API encodes the status of a pkt-line read in the
length of the read content.  An error is indicated with '-1', a flush
with '0' (which can be confusing since a return value of '0' can also
indicate an empty pkt-line), and a positive integer for the length of
the read content otherwise.  This doesn't leave much room for allowing
the addition of additional special packets in the future.

To solve this introduce 'packet_read_with_status()' which reads a packet
and returns the status of the read encoded as an 'enum packet_status'
type.  This allows for easily identifying between special and normal
packets as well as errors.  It also enables easily adding a new special
packet in the future.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-14 14:15:05 -07:00
Junio C Hamano 1eaabe34fc Git 2.16-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-28 14:12:06 -08:00
Junio C Hamano 556de1a8e3 Merge branch 'sb/describe-blob'
"git describe" was taught to dig trees deeper to find a
<commit-ish>:<path> that refers to a given blob object.

* sb/describe-blob:
  builtin/describe.c: describe a blob
  builtin/describe.c: factor out describe_commit
  builtin/describe.c: print debug statements earlier
  builtin/describe.c: rename `oid` to avoid variable shadowing
  revision.h: introduce blob/tree walking in order of the commits
  list-objects.c: factor out traverse_trees_and_blobs
  t6120: fix typo in test name
2017-12-28 14:08:50 -08:00
Junio C Hamano 0433d533f1 Merge branch 'hi/merge-verify-sig-config'
"git merge" learned to pay attention to merge.verifySignatures
configuration variable and pretend as if '--verify-signatures'
option was given from the command line.

* hi/merge-verify-sig-config:
  t5573, t7612: clean up after unexpected success of 'pull' and 'merge'
  t: add tests for pull --verify-signatures
  merge: add config option for verifySignatures
2017-12-28 14:08:50 -08:00
Junio C Hamano fc4a226bf6 Merge branch 'ws/curl-http-proxy-over-https'
Git has been taught to support an https:// URL used for http.proxy
when using recent versions of libcurl.

* ws/curl-http-proxy-over-https:
  http: support CURLPROXY_HTTPS
2017-12-28 14:08:50 -08:00
Junio C Hamano f53edaf2d5 Merge branch 'ks/doc-previous-checkout'
Doc update.

* ks/doc-previous-checkout:
  Doc/check-ref-format: clarify information about @{-N} syntax
2017-12-28 14:08:50 -08:00
Junio C Hamano 594672d237 Merge branch 'ks/rebase-error-messages'
Error messages from "git rebase" have been somewhat cleaned up.

* ks/rebase-error-messages:
  rebase: rebasing can also be done when HEAD is detached
  rebase: distinguish user input by quoting it
  rebase: consistently use branch_name variable
2017-12-28 14:08:49 -08:00
Junio C Hamano 593fdcc06a Merge branch 'sr/http-sslverify-config-doc'
Docfix.

* sr/http-sslverify-config-doc:
  config: document default value of http.sslVerify
2017-12-28 14:08:49 -08:00
Junio C Hamano 9368a3d08e Merge branch 'nm/imap-send-quote-server-folder-name'
"git imap-send" did not correctly quote the folder name when
making a request to the server, which has been corrected.

* nm/imap-send-quote-server-folder-name:
  imap-send: URI encode server folder
2017-12-28 14:08:48 -08:00
Junio C Hamano 8e777af273 Merge branch 'bp/fsmonitor'
Test fix.

* bp/fsmonitor:
  p7519: improve check for prerequisite WATCHMAN
2017-12-28 14:08:48 -08:00
Junio C Hamano f40e83d685 Merge branch 'jh/partial-clone-doc'
* jh/partial-clone-doc:
  partial-clone: design doc
2017-12-28 14:08:47 -08:00
Junio C Hamano 2546de27c3 Merge branch 'jt/transport-hide-vtable'
Code clean-up.

* jt/transport-hide-vtable:
  transport: make transport vtable more private
  clone, fetch: remove redundant transport check
2017-12-28 14:08:47 -08:00
Junio C Hamano 58d1772c85 Merge branch 'js/enhanced-version-info'
"git version --build-options" learned to report the host CPU and
the exact commit object name the binary was built from.

* js/enhanced-version-info:
  version --build-options: report commit, too, if possible
  version --build-options: also report host CPU
2017-12-28 14:08:47 -08:00
Junio C Hamano deeb2fce08 Merge branch 'tz/lib-git-svn-svnserve-tests'
* tz/lib-git-svn-svnserve-tests:
  t/lib-git-svn.sh: improve svnserve tests with parallel make test
  t/lib-git-svn: cleanup inconsistent tab/space usage
2017-12-28 14:08:46 -08:00
Junio C Hamano 63dd544897 Merge branch 'ew/svn-crlf'
"git svn" has been updated to strip CRs in the commit messages, as
recent versions of Subversion rejects them.

* ew/svn-crlf:
  git-svn: convert CRLF to LF in commit message to SVN
2017-12-28 14:08:46 -08:00
Junio C Hamano f427b94985 Merge branch 'cc/skip-to-optional-val'
Introduce a helper to simplify code to parse a common pattern that
expects either "--key" or "--key=<something>".

* cc/skip-to-optional-val:
  t4045: reindent to make helpers readable
  diff: add tests for --relative without optional prefix value
  diff: use skip_to_optional_arg_default() in parsing --relative
  diff: use skip_to_optional_arg_default()
  diff: use skip_to_optional_arg()
  index-pack: use skip_to_optional_arg()
  git-compat-util: introduce skip_to_optional_arg()
2017-12-28 14:08:46 -08:00
Junio C Hamano 5abbdbbd9b Merge branch 'ra/prompt-eread-fix'
Update the shell prompt script (in contrib/) to strip trailing CR
from strings read from various "state" files.

* ra/prompt-eread-fix:
  git-prompt: fix reading files with windows line endings
  git-prompt: make __git_eread intended use explicit
2017-12-28 14:08:45 -08:00
Junio C Hamano 1f24cad852 Merge branch 'bw/path-doc'
Doc updates.

* bw/path-doc:
  path: document path functions
2017-12-28 14:08:45 -08:00
Junio C Hamano 29533fb168 RelNotes: the eleventh batch
Hopefully the last one before -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-27 11:20:27 -08:00
Junio C Hamano dc8fb4dd7e Merge branch 'rb/quick-install-doc'
The build procedure now allows not just the repositories but also
the refs to be used to take pre-formatted manpages and html
documents to install.

* rb/quick-install-doc:
  install-doc-quick: allow specifying what ref to install
2017-12-27 11:16:30 -08:00
Junio C Hamano d22114ac24 Merge branch 'jt/transport-no-more-rsync'
Code clean-up.

* jt/transport-no-more-rsync:
  transport: remove unused "push" in vtable
2017-12-27 11:16:30 -08:00
Junio C Hamano f62b471d21 Merge branch 'sg/travis-fixes'
Assorted updates for TravisCI integration.

* sg/travis-fixes:
  travis-ci: use 'set -x' in 'ci/*' scripts for extra tracing output
  travis-ci: set GIT_TEST_HTTPD in 'ci/lib-travisci.sh'
  travis-ci: move setting environment variables to 'ci/lib-travisci.sh'
  travis-ci: introduce a $jobname variable for 'ci/*' scripts
2017-12-27 11:16:30 -08:00
Junio C Hamano 06358125b8 Merge branch 'sb/test-helper-excludes'
Simplify the ignore rules for t/helper directory.

* sb/test-helper-excludes:
  t/helper: ignore everything but sources
2017-12-27 11:16:29 -08:00
Junio C Hamano 6bd396be0f Merge branch 'ot/pretty'
Code clean-up.

* ot/pretty:
  format: create docs for pretty.h
  format: create pretty.h file
2017-12-27 11:16:29 -08:00
Junio C Hamano 00c4d2b6bc Merge branch 'bw/submodule-sans-cache-compat'
Code clean-up.

* bw/submodule-sans-cache-compat:
  submodule: convert get_next_submodule to not rely on the_index
  submodule: used correct index in is_staging_gitmodules_ok
  submodule: convert stage_updated_gitmodules to take a struct index_state
2017-12-27 11:16:28 -08:00
Junio C Hamano 237aa99cd2 Merge branch 'es/clone-shared-worktree'
"git clone --shared" to borrow from a (secondary) worktree did not
work, even though "git clone --local" did.  Both are now accepted.

* es/clone-shared-worktree:
  clone: support 'clone --shared' from a worktree
2017-12-27 11:16:28 -08:00
Junio C Hamano e2e2bf2450 Merge branch 'tb/delimit-pretty-trailers-args-with-comma'
Doc updates.

* tb/delimit-pretty-trailers-args-with-comma:
  docs/pretty-formats: mention commas in %(trailers) syntax
2017-12-27 11:16:27 -08:00
Junio C Hamano 54b1335ae3 Merge branch 'rs/fmt-merge-msg-leakfix'
Leakfix.

* rs/fmt-merge-msg-leakfix:
  transport-helper: plug strbuf and string_list leaks
2017-12-27 11:16:26 -08:00
Junio C Hamano eacf669cec Merge branch 'jt/decorate-api'
A few structures and variables that are implementation details of
the decorate API have been renamed and then the API got documented
better.

* jt/decorate-api:
  decorate: clean up and document API
2017-12-27 11:16:26 -08:00
Junio C Hamano 6ae18684e1 Merge branch 'jk/cvsimport-quoting'
Typo/Logico fix.

* jk/cvsimport-quoting:
  cvsimport: apply shell-quoting regex globally
2017-12-27 11:16:26 -08:00
Junio C Hamano f7bbca1cae Merge branch 'db/doc-workflows-neuter-the-maintainer'
Docfix.

* db/doc-workflows-neuter-the-maintainer:
  doc: reword gitworkflows.txt for neutrality
2017-12-27 11:16:25 -08:00
Junio C Hamano 0faff988ee Merge branch 'ks/branch-cleanup'
Code clean-up.

* ks/branch-cleanup:
  builtin/branch: strip refs/heads/ using skip_prefix
  branch: update warning message shown when copying a misnamed branch
  branch: group related arguments of create_branch()
  branch: improve documentation and naming of create_branch() parameters
2017-12-27 11:16:25 -08:00
Junio C Hamano a13e45f1e7 Merge branch 'rs/strbuf-read-once-reset-length'
Leakfix.

* rs/strbuf-read-once-reset-length:
  strbuf: release memory on read error in strbuf_read_once()
2017-12-27 11:16:24 -08:00
Junio C Hamano 1f9ce78df0 Merge branch 'rs/fmt-merge-msg-string-leak-fix'
Leakfix.

* rs/fmt-merge-msg-string-leak-fix:
  fmt-merge-msg: avoid leaking strbuf in shortlog()
2017-12-27 11:16:23 -08:00
Junio C Hamano 5c14bd6175 Merge branch 'rs/am-builtin-leakfix'
Leakfix.

* rs/am-builtin-leakfix:
  am: release strbuf after use in split_mail_mbox()
2017-12-27 11:16:23 -08:00
Junio C Hamano e87f9fc9d4 Merge branch 'es/worktree-checkout-hook'
"git worktree add" learned to run the post-checkout hook, just like
"git checkout" does, after the initial checkout.

* es/worktree-checkout-hook:
  worktree: invoke post-checkout hook (unless --no-checkout)
2017-12-27 11:16:21 -08:00
Junio C Hamano 0da2ba4880 Merge branch 'lb/rebase-i-short-command-names'
With a configuration variable rebase.abbreviateCommands set,
"git rebase -i" produces the todo list with a single-letter
command names.

* lb/rebase-i-short-command-names:
  sequencer.c: drop 'const' from function return type
  t3404: add test case for abbreviated commands
  rebase -i: learn to abbreviate command names
  rebase -i -x: add exec commands via the rebase--helper
  rebase -i: update functions to use a flags parameter
  rebase -i: replace reference to sha1 with oid
  rebase -i: refactor transform_todo_ids
  rebase -i: set commit to null in exec commands
  Documentation: use preferred name for the 'todo list' script
  Documentation: move rebase.* configs to new file
2017-12-27 11:16:21 -08:00
Junio C Hamano 720b1764de Merge branch 'tb/check-crlf-for-safe-crlf'
The "safe crlf" check incorrectly triggered for contents that does
not use CRLF as line endings, which has been corrected.

* tb/check-crlf-for-safe-crlf:
  t0027: Adapt the new MIX tests to Windows
  convert: tighten the safe autocrlf handling
2017-12-27 11:16:21 -08:00
Junio C Hamano 61061abba7 Merge branch 'jh/object-filtering'
In preparation for implementing narrow/partial clone, the object
walking machinery has been taught a way to tell it to "filter" some
objects from enumeration.

* jh/object-filtering:
  rev-list: support --no-filter argument
  list-objects-filter-options: support --no-filter
  list-objects-filter-options: fix 'keword' typo in comment
  pack-objects: add list-objects filtering
  rev-list: add list-objects filtering support
  list-objects: filter objects in traverse_commit_list
  oidset: add iterator methods to oidset
  oidmap: add oidmap iterator methods
  dir: allow exclusions from blob in addition to file
2017-12-27 11:16:21 -08:00