1. 22 11月, 2012 1 次提交
  2. 31 10月, 2012 2 次提交
    • J
      remote-curl: retry failed requests for auth even with gzip · 2e736fd5
      Jeff King 提交于
      Commit b81401c1 taught the post_rpc function to retry the
      http request after prompting for credentials. However, it
      did not handle two cases:
      
        1. If we have a large request, we do not retry. That's OK,
           since we would have sent a probe (with retry) already.
      
        2. If we are gzipping the request, we do not retry. That
           was considered OK, because the intended use was for
           push (e.g., listing refs is OK, but actually pushing
           objects is not), and we never gzip on push.
      
      This patch teaches post_rpc to retry even a gzipped request.
      This has two advantages:
      
        1. It is possible to configure a "half-auth" state for
           fetching, where the set of refs and their sha1s are
           advertised, but one cannot actually fetch objects.
      
           This is not a recommended configuration, as it leaks
           some information about what is in the repository (e.g.,
           an attacker can try brute-forcing possible content in
           your repository and checking whether it matches your
           branch sha1). However, it can be slightly more
           convenient, since a no-op fetch will not require a
           password at all.
      
        2. It future-proofs us should we decide to ever gzip more
           requests.
      Signed-off-by: NJeff King <peff@peff.net>
      2e736fd5
    • J
      remote-curl: hoist gzip buffer size to top of post_rpc · df126e10
      Jeff King 提交于
      When we gzip the post data for a smart-http rpc request, we
      compute the gzip body and its size inside the "use_gzip"
      conditional. We keep track of the body after the conditional
      ends, but not the size. Let's remember both, which will
      enable us to retry failed gzip requests in a future patch.
      Signed-off-by: NJeff King <peff@peff.net>
      df126e10
  3. 13 10月, 2012 3 次提交
    • J
      http: do not set up curl auth after a 401 · 1960897e
      Jeff King 提交于
      When we get an http 401, we prompt for credentials and put
      them in our global credential struct. We also feed them to
      the curl handle that produced the 401, with the intent that
      they will be used on a retry.
      
      When the code was originally introduced in commit 42653c09,
      this was a necessary step. However, since dfa1725a, we always
      feed our global credential into every curl handle when we
      initialize the slot with get_active_slot. So every further
      request already feeds the credential to curl.
      
      Moreover, accessing the slot here is somewhat dubious. After
      the slot has produced a response, we don't actually control
      it any more.  If we are using curl_multi, it may even have
      been re-initialized to handle a different request.
      
      It just so happens that we will reuse the curl handle within
      the slot in such a case, and that because we only keep one
      global credential, it will be the one we want.  So the
      current code is not buggy, but it is misleading.
      
      By cleaning it up, we can remove the slot argument entirely
      from handle_curl_result, making it much more obvious that
      slots should not be accessed after they are marked as
      finished.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1960897e
    • J
      remote-curl: do not call run_slot repeatedly · abf8df86
      Jeff King 提交于
      Commit b81401c1 (http: prompt for credentials on failed POST)
      taught post_rpc to call run_slot in a loop in order to retry
      a request after asking the user for credentials. However,
      after a call to run_slot we will have called
      finish_active_slot. This means we have released the slot,
      and we should no longer look at it.
      
      As it happens, this does not cause any bugs in the current
      code, since we know that we are not using curl_multi in this
      code path, and therefore nobody will have taken over our
      slot in the meantime. However, it is good form to actually
      call get_active_slot again. It also future proofs us against
      changes in the http code.
      
      We can do this by jumping back to a retry label at the top
      of our function. We just need to reorder a few setup lines
      that should not be repeated; everything else within the loop
      is either idempotent, needs to be repeated, or in a path we
      do not follow (e.g., we do not even try when large_request
      is set, because we don't know how much data we might have
      streamed from our helper program).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      abf8df86
    • J
      http: fix segfault in handle_curl_result · 188923f0
      Jeff King 提交于
      When we create an http active_request_slot, we can set its
      "results" pointer back to local storage. The http code will
      fill in the details of how the request went, and we can
      access those details even after the slot has been cleaned
      up.
      
      Commit 88097030 (http: factor out http error code handling)
      switched us from accessing our local results struct directly
      to accessing it via the "results" pointer of the slot. That
      means we're accessing the slot after it has been marked as
      finished, defeating the whole purpose of keeping the results
      storage separate.
      
      Most of the time this doesn't matter, as finishing the slot
      does not actually clean up the pointer. However, when using
      curl's multi interface with the dumb-http revision walker,
      we might actually start a new request before handing control
      back to the original caller. In that case, we may reuse the
      slot, zeroing its results pointer, and leading the original
      caller to segfault while looking for its results inside the
      slot.
      
      Instead, we need to pass a pointer to our local results
      storage to the handle_curl_result function, rather than
      relying on the pointer in the slot struct. This matches what
      the original code did before the refactoring (which did not
      use a separate function, and therefore just accessed the
      results struct directly).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      188923f0
  4. 28 8月, 2012 8 次提交
    • J
      http: prompt for credentials on failed POST · b81401c1
      Jeff King 提交于
      All of the smart-http GET requests go through the http_get_*
      functions, which will prompt for credentials and retry if we
      see an HTTP 401.
      
      POST requests, however, do not go through any central point.
      Moreover, it is difficult to retry in the general case; we
      cannot assume the request body fits in memory or is even
      seekable, and we don't know how much of it was consumed
      during the attempt.
      
      Most of the time, this is not a big deal; for both fetching
      and pushing, we make a GET request before doing any POSTs,
      so typically we figure out the credentials during the first
      request, then reuse them during the POST. However, some
      servers may allow a client to get the list of refs from
      receive-pack without authentication, and then require
      authentication when the client actually tries to POST the
      pack.
      
      This is not ideal, as the client may do a non-trivial amount
      of work to generate the pack (e.g., delta-compressing
      objects). However, for a long time it has been the
      recommended example configuration in git-http-backend(1) for
      setting up a repository with anonymous fetch and
      authenticated push. This setup has always been broken
      without putting a username into the URL. Prior to commit
      986bbc08, it did work with a username in the URL, because git
      would prompt for credentials before making any requests at
      all. However, post-986bbc08, it is totally broken. Since it
      has been advertised in the manpage for some time, we should
      make sure it works.
      
      Unfortunately, it is not as easy as simply calling post_rpc
      again when it fails, due to the input issue mentioned above.
      However, we can still make this specific case work by
      retrying in two specific instances:
      
        1. If the request is large (bigger than LARGE_PACKET_MAX),
           we will first send a probe request with a single flush
           packet. Since this request is static, we can freely
           retry it.
      
        2. If the request is small and we are not using gzip, then
           we have the whole thing in-core, and we can freely
           retry.
      
      That means we will not retry in some instances, including:
      
        1. If we are using gzip. However, we only do so when
           calling git-upload-pack, so it does not apply to
           pushes.
      
        2. If we have a large request, the probe succeeds, but
           then the real POST wants authentication. This is an
           extremely unlikely configuration and not worth worrying
           about.
      
      While it might be nice to cover those instances, doing so
      would be significantly more complex for very little
      real-world gain. In the long run, we will be much better off
      when curl learns to internally handle authentication as a
      callback, and we can cleanly handle all cases that way.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b81401c1
    • J
      http: factor out http error code handling · 88097030
      Jeff King 提交于
      Most of our http requests go through the http_request()
      interface, which does some nice post-processing on the
      results. In particular, it handles prompting for missing
      credentials as well as approving and rejecting valid or
      invalid credentials. Unfortunately, it only handles GET
      requests. Making it handle POSTs would be quite complex, so
      let's pull result handling code into its own function so
      that it can be reused from the POST code paths.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      88097030
    • J
      t: test http access to "half-auth" repositories · 4c71009d
      Jeff King 提交于
      Some sites set up http access to repositories such that
      fetching is anonymous and unauthenticated, but pushing is
      authenticated. While there are multiple ways to do this, the
      technique advertised in the git-http-backend manpage is to
      block access to locations matching "/git-receive-pack$".
      
      Let's emulate that advice in our test setup, which makes it
      clear that this advice does not actually work.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4c71009d
    • J
      t: test basic smart-http authentication · 6ac2b3ae
      Jeff King 提交于
      We do not currently test authentication over smart-http at
      all. In theory, it should work exactly as it does for dumb
      http (which we do test). It does indeed work for these
      simple tests, but this patch lays the groundwork for more
      complex tests in future patches.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6ac2b3ae
    • J
      t/lib-httpd: recognize */smart/* repos as smart-http · 666aae9a
      Jeff King 提交于
      We do not currently test authentication for smart-http repos
      at all. Part of the infrastructure to do this is recognizing
      that auth/smart is indeed a smart-http repo.
      
      The current apache config recognizes only "^/smart/*" as
      smart-http. Let's instead treat anything with /smart/ in the
      URL as smart-http. This is obviously a stupid thing to do
      for a real production site, but for our test suite we know
      that our repositories will not have this magic string in the
      name.
      
      Note that we will route /foo/smart/bar.git directly to
      git-http-backend/bar.git; in other words, everything before
      the "/smart/" is irrelevant to finding the repo on disk (but
      may impact apache config, for example by triggering auth
      checks).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      666aae9a
    • J
      t/lib-httpd: only route auth/dumb to dumb repos · 05b57710
      Jeff King 提交于
      Our test apache config points all of auth/ directly to the
      on-disk repositories via an Alias directive. This works fine
      because everything authenticated is currently in auth/dumb,
      which is a subset.  However, this would conflict with a
      ScriptAlias for auth/smart (which will come in future
      patches), so let's narrow the Alias.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      05b57710
    • J
      t5550: factor out http auth setup · e837936c
      Jeff King 提交于
      The t5550 script sets up a nice askpass helper for
      simulating user input and checking what git prompted for.
      Let's make it available to other http scripts by migrating
      it to lib-httpd.
      
      We can use this immediately in t5540 to make our tests more
      robust (previously, we did not check at all that hitting the
      password-protected repo actually involved a password).
      Unfortunately, we end up failing the test because the
      current code erroneously prompts twice (once for
      git-remote-http, and then again when the former spawns
      git-http-push).
      
      More importantly, though, it will let us easily add
      smart-http authentication tests in t5541 and t5551; we
      currently do not test smart-http authentication at all.
      
      As part of making it generic, let's always look for and
      store auxiliary askpass files at the top-level trash
      directory; this makes it compatible with t5540, which runs
      some tests from sub-repositories. We can abstract away the
      ugliness with a short helper function.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e837936c
    • J
      t5550: put auth-required repo in auth/dumb · 726800a8
      Jeff King 提交于
      In most of our tests, we put repos to be accessed by dumb
      protocols in /dumb, and repos to be accessed by smart
      protocols in /smart.  In our test apache setup, the whole
      /auth hierarchy requires authentication. However, we don't
      bother to split it by smart and dumb here because we are not
      currently testing smart-http authentication at all.
      
      That will change in future patches, so let's be explicit
      that we are interested in testing dumb access here. This
      also happens to match what t5540 does for the push tests.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      726800a8
  5. 18 6月, 2012 3 次提交
  6. 12 6月, 2012 1 次提交
  7. 04 6月, 2012 2 次提交
  8. 02 6月, 2012 8 次提交
  9. 01 6月, 2012 1 次提交
  10. 31 5月, 2012 1 次提交
  11. 29 5月, 2012 1 次提交
  12. 26 5月, 2012 5 次提交
    • J
      Git 1.7.10.3 · 26e5c5d0
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      26e5c5d0
    • J
      Merge branch 'hv/submodule-alt-odb' into maint · 69e82602
      Junio C Hamano 提交于
      When a submodule repository uses alternate object store mechanism, some
      commands that were started from the superproject did not notice it and
      failed with "No such object" errors.  The subcommands of "git submodule"
      command that recursed into the submodule in a separate process were OK;
      only the ones that cheated and peeked directly into the submodule's
      repository from the primary process were affected.
      
      By Heiko Voigt
      * hv/submodule-alt-odb:
        teach add_submodule_odb() to look for alternates
      69e82602
    • J
      Merge branch 'bp/diff-no-index-strbuf-fix' into maint · 98eb3fc6
      Junio C Hamano 提交于
      The directory path used in "git diff --no-index", when it recurses
      down, was broken with a recent update after v1.7.10.1 release.
      
      By Bobby Powers
      * bp/diff-no-index-strbuf-fix:
        diff --no-index: don't leak buffers in queue_diff
        diff --no-index: reset temporary buffer lengths on directory iteration
      98eb3fc6
    • L
      fmt-merge-message: add empty line between tag and signature verification · a3347b98
      Linus Torvalds 提交于
      When adding the information from a tag, put an empty line between the
      message of the tag and the commented-out signature verification
      information.
      
      At least for the kernel workflow, I often end up re-formatting the message
      that people send me in the tag data. In that situation, putting the tag
      message and the tag signature verification back-to-back then means that
      normal editor "reflow parapgraph" command will get confused and think that
      the signature is a continuation of the last message paragraph.
      
      So I always end up having to first add an empty line, and then go back and
      reflow the last paragraph. Let's just do it in git directly.
      
      The extra vertical space also makes the verification visually stand out
      more from the user-supplied message, so it looks a bit more readable to me
      too, but that may be just an odd personal preference.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a3347b98
    • J
      config doc: remove confusion about relative GIT_DIR from FILES section · ec84e069
      Jonathan Nieder 提交于
      From the FILES section of the git-config(1) manual:
      
      	$GIT_DIR/config::
      		Repository specific configuration file. (The filename is
      		of course relative to the repository root, not the working
      		directory.)
      
      That's confusing because $GIT_DIR really is relative to the working
      directory.
      
      	$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
      	$ export GIT_DIR GIT_EDITOR
      	$ git config --edit --local
      	/home/jrn/src/git/Documentation
      	editing .git/config
      
      It turns out that the comment is a remnant from older days when the
      heading said ".git/config" (which is indeed relative to the top of the
      worktree).
      
      It was only when the heading was changed to refer more precisely to
      <git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
      dot, 2007-09-14) that the parenthesis stopped making sense.  Remove
      it.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ec84e069
  13. 25 5月, 2012 4 次提交
    • J
      Update draft release notes to 1.7.10.3 · c4649188
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c4649188
    • J
      Merge branch 'jk/maint-status-porcelain-z-b' into maint · a8bd582d
      Junio C Hamano 提交于
      "git status --porcelain" ignored "--branch" option by mistake.  The output
      for "git status --branch -z" was also incorrect and did not terminate the
      record for the current branch name with NUL as asked.
      
      By Jeff King
      * jk/maint-status-porcelain-z-b:
        status: respect "-b" for porcelain format
        status: fix null termination with "-b"
        status: refactor null_termination option
        commit: refactor option parsing
      a8bd582d
    • A
      checkout: no progress messages if !isatty(2). · e9fc64c6
      Avery Pennarun 提交于
      If stderr isn't a tty, we shouldn't be printing incremental progress
      messages.  In particular, this affects 'git checkout -f . >&logfile'
      unless you provided -q.  And git-new-workdir has no way to provide -q.
      
      It would probably be better to have progress.c check isatty(2) all the time,
      but that wouldn't allow things like 'git push --progress' to force progress
      reporting to on, so I won't try to solve the general case right now.
      
      Actual fix suggested by Jeff King.
      Signed-off-by: NAvery Pennarun <apenwarr@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e9fc64c6
    • J
      osxkeychain: pull make config from top-level directory · 17a9ac7d
      Jeff King 提交于
      The default compiler and cflags were mostly "works for me"
      when I built the original version. We need to be much less
      careful here than usual, because we know we are building
      only on OS X.  But it's only polite to at least respect the
      CFLAGS and CC definitions that the user may have provided
      earlier.
      
      While we're at it, let's update our definitions and rules to
      be more like the top-level Makefile; default our CFLAGS to
      include -O2, and make sure we use CFLAGS and LDFLAGS when
      linking.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      17a9ac7d