Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Apr 27, 2011
  1. @gitster

    Merge branch 'jk/maint-upload-pack-shallow'

    gitster authored
    * jk/maint-upload-pack-shallow:
      upload-pack: start pack-objects before async rev-list
Commits on Apr 6, 2011
  1. @peff @gitster

    upload-pack: start pack-objects before async rev-list

    peff authored gitster committed
    In a pthread-enabled version of upload-pack, there's a race condition
    that can cause a deadlock on the fflush(NULL) we call from run-command.
    
    What happens is this:
    
      1. Upload-pack is informed we are doing a shallow clone.
    
      2. We call start_async() to spawn a thread that will generate rev-list
         results to feed to pack-objects. It gets a file descriptor to a
         pipe which will eventually hook to pack-objects.
    
      3. The rev-list thread uses fdopen to create a new output stream
         around the fd we gave it, called pack_pipe.
    
      4. The thread writes results to pack_pipe. Outside of our control,
         libc is doing locking on the stream. We keep writing until the OS
         pipe buffer is full, and then we block in write(), still holding
         the lock.
    
      5. The main thread now uses start_command to spawn pack-objects.
         Before forking, it calls fflush(NULL) to flush every stdio output
         buffer. It blocks trying to get the lock on pack_pipe.
    
    And we have a deadlock. The thread will block until somebody starts
    reading from the pipe. But nobody will read from the pipe until we
    finish flushing to the pipe.
    
    To fix this, we swap the start order: we start the
    pack-objects reader first, and then the rev-list writer
    after. Thus the problematic fflush(NULL) happens before we
    even open the new file descriptor (and even if it didn't,
    flushing should no longer block, as the reader at the end of
    the pipe is now active).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 29, 2011
  1. @gitster

    Merge branches 'sp/maint-fetch-pack-stop-early' and 'sp/maint-upload-…

    gitster authored
    …pack-stop-early'
    
    * sp/maint-fetch-pack-stop-early:
      enable "no-done" extension only when fetching over smart-http
    
    * sp/maint-upload-pack-stop-early:
      enable "no-done" extension only when serving over smart-http
  2. @gitster

    Revert two "no-done" reverts

    gitster authored
    Last night I had to make these two emergency reverts, but now we have a
    better understanding of which part of the topic was broken, let's get rid
    of the revert to fix it correctly.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    enable "no-done" extension only when serving over smart-http

    gitster authored
    Do not advertise no-done capability when upload-pack is not serving over
    smart-http, as there is no way for this server to know when it should stop
    reading in-flight data from the client, even though it is necessary to
    drain all the in-flight data in order to unblock the client.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Acked-by: Shawn O. Pearce <spearce@spearce.org>
  4. @gitster

    Revert "upload-pack: Implement no-done capability"

    gitster authored
    This reverts 3e63b21 (upload-pack: Implement no-done capability,
    2011-03-14).  Together with 761ecf0 (fetch-pack: Implement no-done
    capability, 2011-03-14) it seems to make the fetch-pack process out of
    sync and makes it keep talking long after upload-pack stopped listening to
    it, terminating the process with SIGPIPE.
Commits on Mar 23, 2011
  1. @gitster

    Merge branch 'sp/maint-upload-pack-stop-early'

    gitster authored
    * sp/maint-upload-pack-stop-early:
      upload-pack: Implement no-done capability
      upload-pack: More aggressively send 'ACK %s ready'
Commits on Mar 15, 2011
  1. @spearce @gitster

    upload-pack: Implement no-done capability

    spearce authored gitster committed
    If the client requests both multi_ack_detailed and no-done then
    upload-pack is free to immediately send a PACK following its first
    'ACK %s ready' message.  The upload-pack response actually winds
    up being:
    
      ACK %s common
      ... (maybe more) ...
      ACK %s ready
      NAK
      ACK %s
      PACK.... the pack stream ....
    
    For smart HTTP connections this saves one HTTP RPC, reducing
    the overall latency for a trivial fetch.  For git:// and ssh://
    a no-done option slightly reduces latency by removing one
    server->client->server round-trip at the end of the common
    ancestor negotiation.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @spearce @gitster

    upload-pack: More aggressively send 'ACK %s ready'

    spearce authored gitster committed
    If a client is merely following the remote (and has not made any
    new commits itself), all "have %s" lines sent by the client will be
    common to the server.  As all lines are common upload-pack never
    calls ok_to_give_up() and does not compute if it has a good cut
    point in the commit graph.
    
    Without this computation the following client is going to send all
    tagged commits, as these were determined to be COMMON_REF during the
    initial advertisement, but the client does not parse their history
    to transitively pass the COMMON flag and empty its queue of commits.
    
    For git.git with 339 commit tags, it takes clients 11 rounds of
    negotation to fully send all tagged commits and exhaust its queue
    of things to send as common.  This is pretty slow for a client that
    has not done any local development activity.
    
    Force computing ok_to_give_up() and send "ACK %s ready" at the end
    of the current round if this round only contained common objects
    and ok_to_give_up() was therefore not called.  This may allow the
    client to break early, avoiding transmission of the COMMON_REFs.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 8, 2011
  1. @peff @gitster

    add packet tracing debug code

    peff authored gitster committed
    This shows a trace of all packets coming in or out of a given
    program. This can help with debugging object negotiation or
    other protocol issues.
    
    To keep the code changes simple, we operate at the lowest
    level, meaning we don't necessarily understand what's in the
    packets. The one exception is a packet starting with "PACK",
    which causes us to skip that packet and turn off tracing
    (since the gigantic pack data will not be interesting to
    read, at least not in the trace format).
    
    We show both written and read packets. In the local case,
    this may mean you will see packets twice (written by the
    sender and read by the receiver). However, for cases where
    the other end is remote, this allows you to see the full
    conversation.
    
    Packet tracing can be enabled with GIT_TRACE_PACKET=<foo>,
    where <foo> takes the same arguments as GIT_TRACE.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 29, 2010
  1. @gitster

    commit: Add commit_list prefix in two function names.

    Thiago Farina authored gitster committed
    Add commit_list prefix to insert_by_date function and to sort_by_date,
    so it's clear that these functions refer to commit_list structure.
    
    Signed-off-by: Thiago Farina <tfransosi@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 8, 2010
  1. @gitster

    Use angles for placeholders consistently

    Štěpán Němec authored gitster committed
    Signed-off-by: Štěpán Němec <stepnem@gmail.com>
    Acked-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 30, 2010
  1. @gitster

    object.h: Add OBJECT_ARRAY_INIT macro and make use of it.

    Thiago Farina authored gitster committed
    Signed-off-by: Thiago Farina <tfransosi@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 2, 2010
  1. @newren @gitster

    upload-pack: Improve error message when bad ref requested

    newren authored gitster committed
    When printing an error message saying a ref was requested that we do not
    have, only print that ref, rather than the ref and everything sent to us
    on the same packet line (e.g. protocol support specifications).
    
    Signed-off-by: Elijah Newren <newren@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 28, 2010
  1. @pclouds @gitster

    upload-pack: remove unused "create_full_pack" code in do_rev_list

    pclouds authored gitster committed
    A bit of history in chronological order, the newest at bottom:
    
    - 80ccaa7 (upload-pack: Move the revision walker into a separate function.)
       do_rev_list was introduced with create_full_pack argument
    
    - 21edd3f (upload-pack: Run rev-list in an asynchronous function.)
       do_rev_list was now called by start_async, create_full_pack was
       passed by rev_list.data
    
    - f0cea83 (Shift object enumeration out of upload-pack)
       rev_list.data was now zero permanently. Creating full pack was
       done by passing --all to pack-objects
    
    - ae6a560 (run-command: support custom fd-set in async)
       rev_list.data = 0 was found out redudant and got rid of.
    
    Get rid of the code as well, for less headache while reading do_rev_list.
    
    [jc: noticed by Elijah Newren]
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 6, 2010
  1. @kusma @gitster

    run-command: support custom fd-set in async

    kusma authored gitster committed
    This patch adds the possibility to supply a set of non-0 file
    descriptors for async process communication instead of the
    default-created pipe.
    
    Additionally, we now support bi-directional communiction with the
    async procedure, by giving the async function both read and write
    file descriptors.
    
    To retain compatiblity and similar "API feel" with start_command,
    we require start_async callers to set .out = -1 to get a readable
    file descriptor.  If either of .in or .out is 0, we supply no file
    descriptor to the async process.
    
    [sp: Note: Erik started this patch, and a huge bulk of it is
         his work.  All bugs were introduced later by Shawn.]
    
    Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 11, 2009
  1. @gitster

    Sync with 1.6.5.6

    gitster authored
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 10, 2009
  1. @gitster

    Remove post-upload-hook

    gitster authored
    This hook runs after "git fetch" in the repository the objects are
    fetched from as the user who fetched, and has security implications.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 3, 2009
  1. @gitster

    Merge branch 'np/maint-sideband-favor-status' into maint

    gitster authored
    * np/maint-sideband-favor-status:
      give priority to progress messages
Commits on Nov 21, 2009
  1. @gitster

    Merge branch 'sp/smart-http'

    gitster authored
    * sp/smart-http: (37 commits)
      http-backend: Let gcc check the format of more printf-type functions.
      http-backend: Fix access beyond end of string.
      http-backend: Fix bad treatment of uintmax_t in Content-Length
      t5551-http-fetch: Work around broken Accept header in libcurl
      t5551-http-fetch: Work around some libcurl versions
      http-backend: Protect GIT_PROJECT_ROOT from /../ requests
      Git-aware CGI to provide dumb HTTP transport
      http-backend: Test configuration options
      http-backend: Use http.getanyfile to disable dumb HTTP serving
      test smart http fetch and push
      http tests: use /dumb/ URL prefix
      set httpd port before sourcing lib-httpd
      t5540-http-push: remove redundant fetches
      Smart HTTP fetch: gzip requests
      Smart fetch over HTTP: client side
      Smart push over HTTP: client side
      Discover refs via smart HTTP server when available
      http-backend: more explict LocationMatch
      http-backend: add example for gitweb on same URL
      http-backend: use mod_alias instead of mod_rewrite
      ...
    
    Conflicts:
    	.gitignore
    	remote-curl.c
Commits on Nov 18, 2009
  1. @gitster

    Merge branch 'np/maint-sideband-favor-status'

    gitster authored
    * np/maint-sideband-favor-status:
      give priority to progress messages
Commits on Nov 13, 2009
  1. @npitre @gitster

    give priority to progress messages

    npitre authored gitster committed
    In theory it is possible for sideband channel #2 to be delayed if
    pack data is quick to come up for sideband channel #1.  And because
    data for channel #2 is read only 128 bytes at a time while pack data
    is read 8192 bytes at a time, it is possible for many pack blocks to
    be sent to the client before the progress message fifo is emptied,
    making the situation even worse.  This would result in totally garbled
    progress display on the client's console as local progress gets mixed
    with partial remote progress lines.
    
    Let's prevent such situations by giving transmission priority to
    progress messages over pack data at all times.
    
    Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 5, 2009
  1. @spearce @gitster

    Add stateless RPC options to upload-pack, receive-pack

    spearce authored gitster committed
    When --stateless-rpc is passed as a command line parameter to
    upload-pack or receive-pack the programs now assume they may
    perform only a single read-write cycle with stdin and stdout.
    This fits with the HTTP POST request processing model where a
    program may read the request, write a response, and must exit.
    
    When --advertise-refs is passed as a command line parameter only
    the initial ref advertisement is output, and the program exits
    immediately.  This fits with the HTTP GET request model, where
    no request content is received but a response must be produced.
    
    HTTP headers and/or environment are not processed here, but
    instead are assumed to be handled by the program invoking
    either service backend.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 31, 2009
  1. @spearce @gitster

    Add multi_ack_detailed capability to fetch-pack/upload-pack

    spearce authored gitster committed
    When multi_ack_detailed is enabled the ACK continue messages returned
    by the remote upload-pack are broken out to describe the different
    states within the peer.  This permits the client to better understand
    the server's in-memory state.
    
    The fetch-pack/upload-pack protocol now looks like:
    
    NAK
    ---------------------------------
      Always sent in response to "done" if there was no common base
      selected from the "have" lines (or no have lines were sent).
    
      * no multi_ack or multi_ack_detailed:
    
        Sent when the client has sent a pkt-line flush ("0000") and
        the server has not yet found a common base object.
    
      * either multi_ack or multi_ack_detailed:
    
        Always sent in response to a pkt-line flush.
    
    ACK %s
    -----------------------------------
      * no multi_ack or multi_ack_detailed:
    
        Sent in response to "have" when the object exists on the remote
        side and is therefore an object in common between the peers.
        The argument is the SHA-1 of the common object.
    
      * either multi_ack or multi_ack_detailed:
    
        Sent in response to "done" if there are common objects.
        The argument is the last SHA-1 determined to be common.
    
    ACK %s continue
    -----------------------------------
      * multi_ack only:
    
        Sent in response to "have".
    
        The remote side wants the client to consider this object as
        common, and immediately stop transmitting additional "have"
        lines for objects that are reachable from it.  The reason
        the client should stop is not given, but is one of the two
        cases below available under multi_ack_detailed.
    
    ACK %s common
    -----------------------------------
      * multi_ack_detailed only:
    
        Sent in response to "have".  Both sides have this object.
        Like with "ACK %s continue" above the client should stop
        sending have lines reachable for objects from the argument.
    
    ACK %s ready
    -----------------------------------
      * multi_ack_detailed only:
    
        Sent in response to "have".
    
        The client should stop transmitting objects which are reachable
        from the argument, and send "done" soon to get the objects.
    
        If the remote side has the specified object, it should
        first send an "ACK %s common" message prior to sending
        "ACK %s ready".
    
        Clients may still submit additional "have" lines if there are
        more side branches for the client to explore that might be added
        to the common set and reduce the number of objects to transfer.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 13, 2009
  1. @gitster

    don't dereference NULL upon fdopen failure

    Jim Meyering authored gitster committed
    There were several unchecked use of fdopen(); replace them with xfdopen()
    that checks and dies.
    
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @meyering @gitster

    use write_str_in_full helper to avoid literal string lengths

    meyering authored gitster committed
    In 2d14d65 (Use a clearer style to issue commands to remote helpers,
    2009-09-03) I happened to notice two changes like this:
    
    -	write_in_full(helper->in, "list\n", 5);
    +
    +	strbuf_addstr(&buf, "list\n");
    +	write_in_full(helper->in, buf.buf, buf.len);
    +	strbuf_reset(&buf);
    
    IMHO, it would be better to define a new function,
    
        static inline ssize_t write_str_in_full(int fd, const char *str)
        {
               return write_in_full(fd, str, strlen(str));
        }
    
    and then use it like this:
    
    -       strbuf_addstr(&buf, "list\n");
    -       write_in_full(helper->in, buf.buf, buf.len);
    -       strbuf_reset(&buf);
    +       write_str_in_full(helper->in, "list\n");
    
    Thus not requiring the added allocation, and still avoiding
    the maintenance risk of literal string lengths.
    These days, compilers are good enough that strlen("literal")
    imposes no run-time cost.
    
    Transformed via this:
    
        perl -pi -e \
            's/write_in_full\((.*?), (".*?"), \d+\)/write_str_in_full($1, $2)/'\
          $(git grep -l 'write_in_full.*"')
    
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 7, 2009
  1. @gitster

    Merge branch 'jc/upload-pack-hook'

    gitster authored
    * jc/upload-pack-hook:
      upload-pack: feed "kind [clone|fetch]" to post-upload-pack hook
      upload-pack: add a trigger for post-upload-pack hook
  2. @gitster

    Merge branch 'np/maint-1.6.3-deepen'

    gitster authored
    * np/maint-1.6.3-deepen:
      pack-objects: free preferred base memory after usage
      make shallow repository deepening more network efficient
Commits on Sep 6, 2009
  1. @gitster

    make shallow repository deepening more network efficient

    Nicolas Pitre authored gitster committed
    First of all, I can't find any reason why thin pack generation is
    explicitly disabled when dealing with a shallow repository.  The
    possible delta base objects are collected from the edge commits which
    are always obtained through history walking with the same shallow refs
    as the client, Therefore the client is always going to have those base
    objects available. So let's remove that restriction.
    
    Then we can make shallow repository deepening much more efficient by
    using the remote's unshallowed commits as edge commits to get preferred
    base objects for thin pack generation.  On git.git, this makes the data
    transfer for the deepening of a shallow repository from depth 1 to depth 2
    around 134 KB instead of 3.68 MB.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 1, 2009
  1. @bgianfo @gitster

    Style fixes, add a space after if/for/while.

    bgianfo authored gitster committed
    The majority of code in core git appears to use a single
    space after if/for/while. This is an attempt to bring more
    code to this standard. These are entirely cosmetic changes.
    
    Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 29, 2009
  1. @gitster

    upload-pack: feed "kind [clone|fetch]" to post-upload-pack hook

    gitster authored
    A request to clone the repository does not give any "have" but asks for
    all the refs we offer with "want".  When a request does not ask to clone
    the repository fully, but asks to fetch some refs into an empty
    repository, it will not give any "have" but its "want" won't ask for all
    the refs we offer.
    
    If we suppose (and I would say this is a rather big if) that it makes
    sense to distinguish these two cases, a hook cannot reliably do this
    alone.  The hook can detect lack of "have" and bunch of "want", but there
    is no direct way to tell if the other end asked for all refs we offered,
    or merely most of them.
    
    Between the time we talked with the other end and the time the hook got
    called, we may have acquired more refs or lost some refs in the repository
    by concurrent operations.  Given that we plan to introduce selective
    advertisement of refs with a protocol extension, it would become even more
    difficult for hooks to guess between these two cases.
    
    This adds "kind [clone|fetch]" to hook's input, as a stable interface to
    allow the hooks to tell these cases apart.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    upload-pack: add a trigger for post-upload-pack hook

    gitster authored
    After upload-pack successfully finishes its operation, post-upload-pack
    hook can be called for logging purposes.
    
    The hook is passed various pieces of information, one per line, from its
    standard input.  Currently the following items can be fed to the hook, but
    more types of information may be added in the future:
    
        want SHA-1::
            40-byte hexadecimal object name the client asked to include in the
            resulting pack.  Can occur one or more times in the input.
    
        have SHA-1::
            40-byte hexadecimal object name the client asked to exclude from
            the resulting pack, claiming to have them already.  Can occur zero
            or more times in the input.
    
        time float::
            Number of seconds spent for creating the packfile.
    
        size decimal::
            Size of the resulting packfile in bytes.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 22, 2009
  1. @gitster

    Merge branch 'cc/replace'

    gitster authored
    * cc/replace:
      t6050: check pushing something based on a replaced commit
      Documentation: add documentation for "git replace"
      Add git-replace to .gitignore
      builtin-replace: use "usage_msg_opt" to give better error messages
      parse-options: add new function "usage_msg_opt"
      builtin-replace: teach "git replace" to actually replace
      Add new "git replace" command
      environment: add global variable to disable replacement
      mktag: call "check_sha1_signature" with the replacement sha1
      replace_object: add a test case
      object: call "check_sha1_signature" with the replacement sha1
      sha1_file: add a "read_sha1_file_repl" function
      replace_object: add mechanism to replace objects found in "refs/replace/"
      refs: add a "for_each_replace_ref" function
Commits on Aug 5, 2009
  1. @gitster

    Merge branch 'ne/futz-upload-pack'

    gitster authored
    * ne/futz-upload-pack:
      Shift object enumeration out of upload-pack
    
    Conflicts:
    	upload-pack.c
Commits on Jun 18, 2009
  1. @gitster

    upload-pack: squelch progress indicator if client cannot see it

    Johannes Sixt authored gitster committed
    upload-pack runs pack-objects, which generates progress indicator output
    on its stderr. If the client requests a sideband, this indicator is sent
    to the client; but if it did not, then the progress is written to
    upload-pack's own stderr.
    
    If upload-pack is itself run from git-daemon (and if the client did not
    request a sideband) the progress indicator never reaches the client and it
    need not be generated in the first place. With this patch the progress
    indicator is suppressed in this situation.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.