1. 10 3月, 2009 1 次提交
  2. 08 3月, 2009 1 次提交
  3. 28 2月, 2009 15 次提交
    • J
      builtin-remote: new show output style for push refspecs · e5dcbfd9
      Jay Soffian 提交于
      The existing output of "git remote show <remote>" with respect to push
      ref specs is basically just to show the raw refspec. This patch teaches
      the command to interpret the refspecs and show how each branch will be
      pushed to the destination. The output gives the user an idea of what
      "git push" should do if it is run w/o any arguments.
      
      Example new output:
      
      1a. Typical output with no push refspec (i.e. matching branches only)
      
      $ git remote show origin
      * remote origin
        [...]
        Local refs configured for 'git push':
          master pushes to master (up to date)
          next   pushes to next   (local out of date)
      
      1b. Same as above, w/o querying the remote:
      
      $ git remote show origin -n
      * remote origin
        [...]
        Local ref configured for 'git push' (status not queried):
          (matching) pushes to (matching)
      
      2a. With a forcing refspec (+), and a new topic
          (something like push = refs/heads/*:refs/heads/*):
      
      $ git remote show origin
      * remote origin
        [...]
        Local refs configured for 'git push':
          master     pushes to master    (fast forwardable)
          new-topic  pushes to new-topic (create)
          next       pushes to next      (local out of date)
          pu         forces to pu        (up to date)
      
      2b. Same as above, w/o querying the remote
      
      $ git remote show origin -n
      * remote origin
        [...]
        Local refs configured for 'git push' (status not queried):
          master     pushes to master
          new-topic  pushes to new-topic
          next       pushes to next
          pu         forces to pu
      
      3. With a remote configured as a mirror:
      
      * remote backup
        [...]
        Local refs will be mirrored by 'git push'
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e5dcbfd9
    • J
      builtin-remote: new show output style · 7ecbbf87
      Jay Soffian 提交于
      The existing output of "git remote show <remote>" is too verbose for the
      information it provides. This patch teaches it to provide more
      information in less space.
      
      The output for push refspecs is addressed in the next patch.
      
      Before the patch:
      
      $ git remote show origin
      * remote origin
        URL: git://git.kernel.org/pub/scm/git/git.git
        HEAD branch: master
        Remote branch merged with 'git pull' while on branch master
          master
        Remote branch merged with 'git pull' while on branch next
          next
        Remote branches merged with 'git pull' while on branch octopus
          foo bar baz frotz
        New remote branch (next fetch will store in remotes/origin)
          html
        Stale tracking branch (use 'git remote prune')
          bogus
        Tracked remote branches
          maint
          man
          master
          next
          pu
          todo
      
      After this patch:
      
      $ git remote show origin
      * remote origin
        URL: git://git.kernel.org/pub/scm/git/git.git
        HEAD branch: master
        Remote branches:
          bogus  stale (use 'git remote prune' to remove)
          html   new (next fetch will store in remotes/origin)
          maint  tracked
          man    tracked
          master tracked
          next   tracked
          pu     tracked
          todo   tracked
        Local branches configured for 'git pull':
          master  rebases onto remote master
          next    rebases onto remote next
          octopus  merges with remote foo
                      and with remote bar
                      and with remote baz
                      and with remote frotz
      
      $ git remote show origin -n
      * remote origin
        URL: git://git.kernel.org/pub/scm/git/git.git
        HEAD branch: (not queried)
        Remote branches: (status not queried)
          bogus
          maint
          man
          master
          next
          pu
          todo
        Local branches configured for 'git pull':
          master  rebases onto remote master
          next    rebases onto remote next
          octopus  merges with remote foo
                      and with remote bar
                      and with remote baz
                      and with remote frotz
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7ecbbf87
    • J
      remote: make guess_remote_head() use exact HEAD lookup if it is available · fbb074c2
      Jeff King 提交于
      Our usual method for determining the ref pointed to by HEAD
      is to compare HEAD's sha1 to the sha1 of all refs, trying to
      find a unique match.
      
      However, some transports actually get to look at HEAD
      directly; we should make use of that information when it is
      available.  Currently, only http remotes support this
      feature.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fbb074c2
    • J
      builtin-remote: add set-head subcommand · bc14fac8
      Jay Soffian 提交于
      Provide a porcelain command for setting and deleting
      $GIT_DIR/remotes/<remote>/HEAD.
      
      While we're at it, document what $GIT_DIR/remotes/<remote>/HEAD is all
      about.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bc14fac8
    • J
      builtin-remote: teach show to display remote HEAD · e61e0cc6
      Jay Soffian 提交于
      This is in preparation for teaching remote how to set
      refs/remotes/<remote>/HEAD to match what HEAD is set to at <remote>, but
      is useful in its own right.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e61e0cc6
    • J
      builtin-remote: fix two inconsistencies in the output of "show <remote>" · 3bd92563
      Jay Soffian 提交于
      Remote and stale branches are emitted in alphabetical order, but new and
      tracked branches are not. So sort the latter to be consistent with the
      former. This also lets us use more efficient string_list_has_string()
      instead of unsorted_string_list_has_string().
      
      "show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the
      latter to match the former.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3bd92563
    • J
      builtin-remote: make get_remote_ref_states() always populate states.tracked · cca7c97e
      Jay Soffian 提交于
      When not querying the remote, show() was having to populate
      states.tracked itself. It makes more sense for get_remote_ref_states()
      to do this consistently. Since show() is the only caller of
      get_remote_ref_states() with query=0, this change does not affect
      other callers.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cca7c97e
    • J
      builtin-remote: rename variables and eliminate redundant function call · e0cc81e6
      Jay Soffian 提交于
      - The variable name "remote" is used as both a "char *" and as a "struct
        remote *"; this is confusing, so rename the former to remote_name.
      
      - Consistently refer to the refs returned by transport_get_remote_refs()
        as remote_refs.
      
      - There is no need to call "sort_string_list(&branch_list)" as
        branch_list is populated via string_list_insert(), which maintains its
        order.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e0cc81e6
    • J
      builtin-remote: remove unused code in get_ref_states · 7b9a5e27
      Jay Soffian 提交于
      get_ref_states() populates the util pointer of the string_list_item's
      that it adds to states->new and states->tracked, but nothing ever uses
      the pointer, so we can get rid of the extra code.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b9a5e27
    • J
      builtin-remote: refactor duplicated cleanup code · 88733235
      Jay Soffian 提交于
      This patch moves identical lines of code into a cleanup function. The
      function has two callers and is about to gain a third.
      
      Also removed a bogus NEEDSWORK comment per Daniel Barkalow:
      
        Actually, the comment is wrong; "remote" comes from remote_get(),
        which returns things from a cache in remote.c; there could be a
        remote_put() to let the code know that the caller is done with the
        object, but it wouldn't presently do anything.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      88733235
    • J
      string-list: new for_each_string_list() function · c6f5a7a9
      Jay Soffian 提交于
      Add a convenience function for iterating over a string_list's items via
      a callback.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c6f5a7a9
    • J
      remote: make match_refs() not short-circuit · 5f48cb95
      Jay Soffian 提交于
      match_refs() returns non-zero if there is an error in
      match_explicit_refs(), without handling any remaining pattern ref specs.
      
      Its existing callers exit upon receiving non-zero, so a partial result
      is of no consequence to them; however a new caller, builtin-remote, is
      interested in the complete result even if there are errors in
      match_explicit_refs().
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5f48cb95
    • J
      remote: make match_refs() copy src ref before assigning to peer_ref · cdf690e5
      Jay Soffian 提交于
      In some instances, match_refs() sets the peer_ref field of refs in the
      dst list such that it points to a ref in the src list. This prevents
      callers from freeing both the src and dst lists, as doing so would cause
      a double-free since free_refs() frees the peer_ref.
      
      As well, the following configuration causes two refs in the dst list to
      have the same peer_ref, which can also lead to a double-free:
      
        push = refs/heads/master:refs/heads/backup
        push = refs/heads/master:refs/heads/master
      
      Existing callers of match_heads() call it only once and then terminate,
      w/o ever bothering to free the src or dst lists, so this is not
      currently a problem.
      
      This patch modifies match_refs() to first copy any refs it plucks from
      the src list before assigning them as a peer_ref. This allows
      builtin-remote, a future caller, to free the src and dst lists.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cdf690e5
    • J
      remote: let guess_remote_head() optionally return all matches · 4229f1fa
      Jay Soffian 提交于
      Determining HEAD is ambiguous since it is done by comparing SHA1s.
      
      In the case of multiple matches we return refs/heads/master if it
      matches, else we return the first match we encounter. builtin-remote
      needs all matches returned to it, so add a flag for it to request such.
      
      To be simple and consistent, the return value is now a copy (including
      peer_ref) of the matching refs.
      
      Originally contributed by Jeff King along with the prior commit as a
      single patch.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4229f1fa
    • J
      remote: make copy_ref() perform a deep copy · 7b3db095
      Jay Soffian 提交于
      To ensure that copied refs can always be freed w/o causing a
      double-free, make copy_ref() perform a deep copy.
      
      Also have copy_ref() return NULL if asked to copy NULL to simplify
      things for the caller.
      
      Background: currently copy_ref() performs a shallow copy. This is fine
      for current callers who never free the result and/or only copy refs
      which contain NULL pointers. But copy_ref() is about to gain a new
      caller (guess_remote_head()) which copies refs where peer_ref is not
      NULL and the caller of guess_remote_head() will want to free the result.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b3db095
  4. 26 2月, 2009 12 次提交
    • J
      remote: simplify guess_remote_head() · 6cb4e6cc
      Jay Soffian 提交于
      This function had complications which made it hard to extend.
      
      - It used to do two things: find the HEAD ref, and then find a
        matching ref, optionally returning the former via assignment to a
        passed-in pointer. Since finding HEAD is a one-liner, just have a
        caller do it themselves and pass it as an argument.
      
      - It used to manually search through the ref list for
        refs/heads/master; this can be a one-line call to
        find_ref_by_name.
      
      Originally contributed by Jeff King along with the next commit as a
      single patch.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6cb4e6cc
    • J
      move locate_head() to remote.c · 8ef51733
      Jay Soffian 提交于
      Move locate_head() to remote.c and rename it to guess_remote_head() to
      more accurately reflect what it does. 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>
      8ef51733
    • 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
    • J
      refactor find_ref_by_name() to accept const list · 5483f799
      Jeff King 提交于
      Since it doesn't actually touch its argument, this makes
      sense.
      
      However, we still want to return a non-const version (which
      requires a cast) so that this:
      
        struct ref *a, *b;
        a = find_ref_by_name(b);
      
      works. Unfortunately, you can also silently strip the const
      from a variable:
      
        struct ref *a;
        const struct ref *b;
        a = find_ref_by_name(b);
      
      This is a classic C const problem because there is no way to
      say "return the type with the same constness that was passed
      to us"; we provide the same semantics as standard library
      functions like strchr.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5483f799
    • J
      add basic http clone/fetch tests · 119c8eee
      Jeff King 提交于
      This was mostly being tested implicitly by the "http push"
      tests. But making a separate test script means that:
      
        - we will run fetch tests even when http pushing support
          is not built
      
        - when there are failures on fetching, they are easier to
          see and isolate, as they are not in the middle of push
          tests
      
      This script defaults to running the webserver on port 5550,
      and puts the original t5540 on port 5540, so that the two
      can be run simultaneously without conflict (but both still
      respect an externally set LIB_HTTPD_PORT).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      119c8eee
    • J
      test scripts: refactor start_httpd helper · 75318a3b
      Jeff King 提交于
      There are some redirects and some error checking that need
      to be done by the caller; let's move both into the
      start_httpd function so that all callers don't have to
      repeat them (there is only one caller now, but another will
      follow in this series).
      
      This doesn't violate any assumptions that aren't already
      being made by lib-httpd, which is happy to say "skipping"
      and call test_done for a number of other cases.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75318a3b
    • J
      GIT 1.6.2-rc2 · 661763ab
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      661763ab
    • J
      Merge branch 'jc/maint-1.6.0-pack-directory' · bb0cebd7
      Junio C Hamano 提交于
      * jc/maint-1.6.0-pack-directory:
        Make sure objects/pack exists before creating a new pack
      bb0cebd7
    • J
      Make sure objects/pack exists before creating a new pack · 6e180cdc
      Junio C Hamano 提交于
      In a repository created with git older than f49fb35d (git-init-db: create
      "pack" subdirectory under objects, 2005-06-27), objects/pack/ directory is
      not created upon initialization.  It was Ok because subdirectories are
      created as needed inside directories init-db creates, and back then,
      packfiles were recent invention.
      
      After the said commit, new codepaths started relying on the presense of
      objects/pack/ directory in the repository.  This was exacerbated with
      8b4eb6b6 (Do not perform cross-directory renames when creating packs,
      2008-09-22) that moved the location temporary pack files are created from
      objects/ directory to objects/pack/ directory, because moving temporary to
      the final location was done carefully with lazy leading directory creation.
      
      Many packfile related operations in such an old repository can fail
      mysteriously because of this.
      
      This commit introduces two helper functions to make things work better.
      
       - odb_mkstemp() is a specialized version of mkstemp() to refactor the
         code and teach it to create leading directories as needed;
      
       - odb_pack_keep() refactors the code to create a ".keep" file while
         create leading directories as needed.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6e180cdc
    • J
      Allow HTTP tests to run on Darwin · 69707d61
      Jay Soffian 提交于
      This patch allows the HTTP tests to run on OS X 10.5. It is not
      sufficient to be able to pass in LIB_HTTPD_PATH and
      LIB_HTTPD_MODULE_PATH alone, as the apache.conf also needs a couple
      tweaks.
      
      These changes are put into an <IfDefine> to keep them Darwin specific,
      but this means lib-httpd.sh needs to be modified to pass -DDarwin to
      apache when running on Darwin. As long as we're making this change to
      lib-httpd.sh, we may as well set LIB_HTTPD_PATH and
      LIB_HTTPD_MODULE_PATH to appropriate default values for the platform.
      
      Note that we now pass HTTPD_PARA to apache at shutdown as well.
      Otherwise apache will emit a harmless, but noisy warning that LogFormat
      is an unknown directive.
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      69707d61
    • M
      3dbe1165
  5. 25 2月, 2009 11 次提交