1. 25 1月, 2013 1 次提交
    • J
      push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCE · 75e5c0dc
      Junio C Hamano 提交于
      When we push to update an existing ref, if:
      
       * the object at the tip of the remote is not a commit; or
       * the object we are pushing is not a commit,
      
      it won't be correct to suggest to fetch, integrate and push again,
      as the old and new objects will not "merge".  We should explain that
      the push must be forced when there is a non-committish object is
      involved in such a case.
      
      If we do not have the current object at the tip of the remote, we do
      not even know that object, when fetched, is something that can be
      merged.  In such a case, suggesting to pull first just like
      non-fast-forward case may not be technically correct, but in
      practice, most such failures are seen when you try to push your work
      to a branch without knowing that somebody else already pushed to
      update the same branch since you forked, so "pull first" would work
      as a suggestion most of the time.  And if the object at the tip is
      not a commit, "pull first" will fail, without making any permanent
      damage.  As a side effect, it also makes the error message the user
      will get during the next "push" attempt easier to understand, now
      the user is aware that a non-commit object is involved.
      
      In these cases, the current code already rejects such a push on the
      client end, but we used the same error and advice messages as the
      ones used when rejecting a non-fast-forward push, i.e. pull from
      there and integrate before pushing again.
      
      Introduce new rejection reasons and reword the messages
      appropriately.
      
      [jc: with help by Peff on message details]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75e5c0dc
  2. 02 12月, 2012 1 次提交
  3. 29 10月, 2012 1 次提交
  4. 11 8月, 2012 2 次提交
    • J
      do not send client agent unless server does first · d50c3871
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d50c3871
    • J
      send-pack: fix capability-sending logic · ca8e127c
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ca8e127c
  5. 04 8月, 2012 1 次提交
    • J
      include agent identifier in capability string · ff5effdf
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ff5effdf
  6. 02 5月, 2012 2 次提交
    • J
      teach send-pack about --[no-]progress · 391b1f20
      Jeff King 提交于
      The send_pack function gets a "progress" flag saying "yes,
      definitely show progress" or "no, definitely do not show
      progress". This gets set properly by transport_push when
      send_pack is called directly.
      
      However, when the send-pack command is executed separately
      (as it is for the remote-curl helper), there is no way to
      tell it "definitely do this". As a result, we do not
      properly respect "git push --no-progress" for smart-http
      remotes; you will still get progress if stderr is a tty.
      
      This patch teaches send-pack --progress and --no-progress,
      and teaches remote-curl to pass the appropriate option to
      override send-pack's isatty check. This fixes the
      --no-progress case above, and as a bonus, also makes "git
      push --progress" work when stderr is not a tty.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      391b1f20
    • J
      send-pack: show progress when isatty(2) · 8d32e60d
      Jeff King 提交于
      The send_pack_args struct has two verbosity flags: "quiet"
      and "progress". Originally, if "quiet" was set, we would
      tell pack-objects explicitly to be quiet, and if "progress"
      was set, we would tell it to show progress. Otherwise, we
      told it neither, and it relied on isatty(2) to make the
      decision itself.
      
      However, commit 01fdc21f changed the meaning of these
      variables. Now both "quiet" and "!progress" instruct us to
      tell pack-objects to be quiet (and a non-zero "progress"
      means the same as before). This works well for transports
      which call send_pack directly, as the transport code copies
      transport->progress into send_pack_args->progress, and they
      both have the same meaning.
      
      However, the code path of calling "git send-pack" was left
      behind. It always sets "progress" to 0, and thus always
      tells pack-objects to be quiet.  We can work around this by
      checking isatty(2) ourselves in the cmd_send_pack code path,
      restoring the original behavior of the send-pack command.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8d32e60d
  7. 14 2月, 2012 1 次提交
  8. 09 1月, 2012 1 次提交
  9. 14 12月, 2011 1 次提交
    • J
      drop "match" parameter from get_remote_heads · afe7c5ff
      Jeff King 提交于
      The get_remote_heads function reads the list of remote refs
      during git protocol session. It dates all the way back to
      def88e9a (Commit first cut at "git-fetch-pack", 2005-07-04).
      At that time, the idea was to come up with a list of refs we
      were interested in, and then filter the list as we got it
      from the remote side.
      
      Later, 1baaae5e (Make maximal use of the remote refs,
      2005-10-28) stopped filtering at the get_remote_heads layer,
      letting us use the non-matching refs to find common history.
      
      As a result, all callers now simply pass an empty match
      list (and any future callers will want to do the same). So
      let's drop these now-useless parameters.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      afe7c5ff
  10. 13 9月, 2011 2 次提交
  11. 07 9月, 2011 1 次提交
  12. 01 8月, 2011 1 次提交
  13. 23 3月, 2011 1 次提交
    • S
      Fix sparse warnings · c2e86add
      Stephen Boyd 提交于
      Fix warnings from 'make check'.
      
       - These files don't include 'builtin.h' causing sparse to complain that
         cmd_* isn't declared:
      
         builtin/clone.c:364, builtin/fetch-pack.c:797,
         builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
         builtin/merge-index.c:69, builtin/merge-recursive.c:22
         builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
         builtin/notes.c:822, builtin/pack-redundant.c:596,
         builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
         builtin/remote.c:1512, builtin/remote-ext.c:240,
         builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
         builtin/unpack-file.c:25, builtin/var.c:75
      
       - These files have symbols which should be marked static since they're
         only file scope:
      
         submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
         submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
         unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
         url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48
      
       - These files redeclare symbols to be different types:
      
         builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
         usage.c:49, usage.c:58, usage.c:63, usage.c:72
      
       - These files use a literal integer 0 when they really should use a NULL
         pointer:
      
         daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362
      
      While we're in the area, clean up some unused #includes in builtin files
      (mostly exec_cmd.h).
      Signed-off-by: NStephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c2e86add
  14. 19 10月, 2010 2 次提交
  15. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  16. 18 2月, 2010 1 次提交
  17. 06 2月, 2010 1 次提交
  18. 10 1月, 2010 1 次提交
    • T
      refactor ref status logic for pushing · 20e8b465
      Tay Ray Chuan 提交于
      Move the logic that detects up-to-date and non-fast-forward refs to a
      new function in remote.[ch], set_ref_status_for_push().
      
      Make transport_push() invoke set_ref_status_for_push() before invoking
      the push_refs() implementation. (As a side-effect, the push_refs()
      implementation in transport-helper.c now knows of non-fast-forward
      pushes.)
      
      Removed logic for detecting up-to-date refs from the push_refs()
      implementation in transport-helper.c, as transport_push() has already
      done so for it.
      
      Make cmd_send_pack() invoke set_ref_status_for_push() before invoking
      send_pack(), as transport_push() can't do it for send_pack() here.
      
      Mark the test on the return status of non-fast-forward push to fail.
      Git now exits with success, as transport.c::transport_push() does not
      check for refs with status REF_STATUS_REJECT_NONFASTFORWARD nor does it
      indicate rejected pushes with its return value.
      
      Mark the test for ref status to succeed. As mentioned earlier, refs
      might be marked as non-fast-forwards, triggering the push status
      printing mechanism in transport.c.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      20e8b465
  19. 24 11月, 2009 1 次提交
    • N
      pack-objects: split implications of --all-progress from progress activation · 4f366275
      Nicolas Pitre 提交于
      Currently the --all-progress flag is used to use force progress display
      during the writing object phase even if output goes to stdout which is
      primarily the case during a push operation.  This has the unfortunate
      side effect of forcing progress display even if stderr is not a
      terminal.
      
      Let's introduce the --all-progress-implied argument which has the same
      intent except for actually forcing the activation of any progress
      display.  With this, progress display will be automatically inhibited
      whenever stderr is not a terminal, or full progress display will be
      included otherwise.  This should let people use 'git push' within a cron
      job without filling their logs with useless percentage displays.
      Signed-off-by: NNicolas Pitre <nico@fluxnic.net>
      Tested-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4f366275
  20. 05 11月, 2009 1 次提交
    • S
      Smart push over HTTP: client side · de1a2fdd
      Shawn O. Pearce 提交于
      The git-remote-curl backend detects if the remote server supports
      the git-receive-pack service, and if so, runs git-send-pack in a
      pipe to dump the command and pack data as a single POST request.
      
      The advertisements from the server that were obtained during the
      discovery are passed into git-send-pack before the POST request
      starts.  This permits git-send-pack to operate largely unmodified.
      
      For smaller packs (those under 1 MiB) a HTTP/1.0 POST with a
      Content-Length is used, permitting interaction with any server.
      The 1 MiB limit is arbitrary, but is sufficent to fit most deltas
      created by human authors against text sources with the occasional
      small binary file (e.g. few KiB icon image).  The configuration
      option http.postBuffer can be used to increase (or shink) this
      buffer if the default is not sufficient.
      
      For larger packs which cannot be spooled entirely into the helper's
      memory space (due to http.postBuffer being too small), the POST
      request requires HTTP/1.1 and sets "Transfer-Encoding: chunked".
      This permits the client to upload an unknown amount of data in one
      HTTP transaction without needing to pregenerate the entire pack
      file locally.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      CC: Daniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      de1a2fdd
  21. 25 10月, 2009 1 次提交
  22. 06 8月, 2009 1 次提交
  23. 28 6月, 2009 1 次提交
  24. 02 6月, 2009 1 次提交
  25. 14 5月, 2009 1 次提交
  26. 02 5月, 2009 1 次提交
    • N
      allow OFS_DELTA objects during a push · b74fce16
      Nicolas Pitre 提交于
      The fetching of OFS_DELTA objects has been negotiated between both peers
      since git version 1.4.4.  However, this was missing from the push side
      where every OFS_DELTA objects were always converted to REF_DELTA objects
      causing an increase in transferred data.
      
      To fix this, both the client and the server processes have to be
      modified: the former to invoke pack-objects with --delta-base-offset
      when the server provides the ofs-delta capability, and the later to send
      that capability when OFS_DELTA objects are allowed as already indicated
      by the repack.usedeltabaseoffset config variable which is TRUE by
      default since git v1.6.0.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b74fce16
  27. 27 3月, 2009 1 次提交
  28. 10 3月, 2009 2 次提交
  29. 26 2月, 2009 2 次提交
    • J
      move duplicated ref_newer() to remote.c · ec8452d5
      Jay Soffian 提交于
      ref_newer() appears to have been copied from builtin-send-pack.c to
      http-push.c via cut and paste. This patch moves the function and its
      helper unmark_and_free() to remote.c. There was a slight difference
      between the two implementations, one used TMP_MARK for the mark, the
      other used 1. Per Jeff King, I went with TMP_MARK as more correct.
      
      This is in preparation for being able to call it from builtin-remote.c
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ec8452d5
    • J
      move duplicated get_local_heads() to remote.c · 454e2025
      Jay Soffian 提交于
      get_local_heads() appears to have been copied from builtin-send-pack.c
      to http-push.c via cut and paste. This patch moves the function and its
      helper one_local_ref() to remote.c.
      
      The two copies of one_local_ref() were not identical. I used the more
      recent version from builtin-send-pack.c after confirming with Jeff King
      that it was an oversight that commit 30affa1e did not update both
      copies.
      
      This is in preparation for being able to call it from builtin-remote.c
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      454e2025
  30. 28 1月, 2009 1 次提交
    • J
      send-pack: do not send unknown object name from ".have" to pack-objects · 02322e16
      Junio C Hamano 提交于
      v1.6.1 introduced ".have" extension to the protocol to allow the receiving
      side to advertise objects that are reachable from refs in the repositories
      it borrows from.  This was meant to be used by the sending side to avoid
      sending such objects; they are already available through the alternates
      mechanism.
      
      The client side implementation in v1.6.1, which was introduced with
      40c155ff (push: prepare sender to receive extended ref information from the
      receiver, 2008-09-09) aka v1.6.1-rc1~203^2~1, were faulty in that it did
      not consider the possiblity that the repository receiver borrows from
      might have objects it does not know about.
      
      This fixes it by refraining from passing missing commits to underlying
      pack-objects.  Revision machinery may need to be tightened further to
      treat missing uninteresting objects as non-error events, but this is an
      obvious and safe fix for a maintenance release that is almost good enough.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      02322e16
  31. 06 11月, 2008 1 次提交
  32. 02 11月, 2008 1 次提交
  33. 27 10月, 2008 1 次提交
  34. 16 9月, 2008 1 次提交