This project is mirrored from https://github.com/git/git. Updated .
  1. 16 Oct, 2014 13 commits
    • Jeff King's avatar
      sha1_file: add for_each iterators for loose and packed objects · 660c889e
      Jeff King authored
      We typically iterate over the reachable objects in a
      repository by starting at the tips and walking the graph.
      There's no easy way to iterate over all of the objects,
      including unreachable ones. Let's provide a way of doing so.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      660c889e
    • Jeff King's avatar
      count-objects: use for_each_loose_file_in_objdir · 4a1e693a
      Jeff King authored
      This drops our line count considerably, and should make
      things more readable by keeping the counting logic separate
      from the traversal.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4a1e693a
    • Jeff King's avatar
      count-objects: do not use xsize_t when counting object size · cac05d4d
      Jeff King authored
      The point of xsize_t is to safely cast an off_t into a size_t
      (because we are about to mmap). But in count-objects, we are
      summing the sizes in an off_t. Using xsize_t means that
      count-objects could fail on a 32-bit system with a 4G
      object (not likely, as other parts of git would fail, but
      we should at least be correct here).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      cac05d4d
    • Jeff King's avatar
      prune-packed: use for_each_loose_file_in_objdir · 0d3b7296
      Jeff King authored
      This saves us from manually traversing the directory
      structure ourselves.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      0d3b7296
    • Jeff King's avatar
      reachable: mark index blobs as SEEN · 37254279
      Jeff King authored
      When we mark all reachable objects for pruning, that
      includes blobs mentioned by the index. However, we do not
      mark these with the SEEN flag, as we do for objects that we
      find by traversing (we also do not add them to the pending
      list, but that is because there is nothing further to
      traverse with them).
      
      This doesn't cause any problems with prune, because it
      checks only that the object exists in the global object
      hash, and not its flags. However, let's mark these objects
      to be consistent and avoid any later surprises.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      37254279
    • Jeff King's avatar
      prune: factor out loose-object directory traversal · 27e1e22d
      Jeff King authored
      Prune has to walk $GIT_DIR/objects/?? in order to find the
      set of loose objects to prune. Other parts of the code
      (e.g., count-objects) want to do the same. Let's factor it
      out into a reusable for_each-style function.
      
      Note that this is not quite a straight code movement. The
      original code had strange behavior when it found a file of
      the form "[0-9a-f]{2}/.{38}" that did _not_ contain all hex
      digits. It executed a "break" from the loop, meaning that we
      stopped pruning in that directory (but still pruned other
      directories!). This was probably a bug; we do not want to
      process the file as an object, but we should keep going
      otherwise (and that is how the new code handles it).
      
      We are also a little more careful with loose object
      directories which fail to open. The original code silently
      ignored any failures, but the new code will complain about
      any problems besides ENOENT.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      27e1e22d
    • Jeff King's avatar
      reachable: reuse revision.c "add all reflogs" code · 718ccc97
      Jeff King authored
      We want to add all reflog entries as tips for finding
      reachable objects. The revision machinery can already do
      this (to support "rev-list --reflog"); we can reuse that
      code.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      718ccc97
    • Jeff King's avatar
      reachable: use traverse_commit_list instead of custom walk · 5f78a431
      Jeff King authored
      To find the set of reachable objects, we add a bunch of
      possible sources to our rev_info, call prepare_revision_walk,
      and then launch into a custom walker that handles each
      object top. This is a subset of what traverse_commit_list
      does, so we can just reuse that code (it can also handle
      more complex cases like UNINTERESTING commits and pathspecs,
      but we don't use those features).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      5f78a431
    • Jeff King's avatar
      clean up name allocation in prepare_revision_walk · 1da1e07c
      Jeff King authored
      When we enter prepare_revision_walk, we have zero or more
      entries in our "pending" array. We disconnect that array
      from the rev_info, and then process each entry:
      
        1. If the entry is a commit and the --source option is in
           effect, we keep a pointer to the object name.
      
        2. Otherwise, we re-add the item to the pending list with
           a blank name.
      
      We then throw away the old array by freeing the array
      itself, but do not touch the "name" field of each entry. For
      any items of type (2), we leak the memory associated with
      the name. This commit fixes that by calling object_array_clear,
      which handles the cleanup for us.
      
      That breaks (1), though, because it depends on the memory
      pointed to by the name to last forever. We can solve that by
      making a copy of the name. This is slightly less efficient,
      but it shouldn't matter in practice, as we do it only for
      the tip commits of the traversal.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      1da1e07c
    • Jeff King's avatar
      object_array: add a "clear" function · 46be8231
      Jeff King authored
      There's currently no easy way to free the memory associated
      with an object_array (and in most cases, we simply leak the
      memory in a rev_info's pending array). Let's provide a
      helper to make this easier to handle.
      
      We can make use of it in list-objects.c, which does the same
      thing by hand (but fails to free the "name" field of each
      entry, potentially leaking memory).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      46be8231
    • Jeff King's avatar
      object_array: factor out slopbuf-freeing logic · 68f49235
      Jeff King authored
      This is not a lot of code, but it's a logical construct that
      should not need to be repeated (and we are about to add a
      third repetition).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      68f49235
    • Jeff King's avatar
      isxdigit: cast input to unsigned char · 50a71776
      Jeff King authored
      Otherwise, callers must do so or risk triggering warnings
      -Wchar-subscript (and rightfully so; a signed char might
      cause us to use a bogus negative index into the
      hexval_table).
      
      While we are dropping the now-unnecessary casts from the
      caller in urlmatch.c, we can get rid of similar casts in
      actually parsing the hex by using the hexval() helper, which
      implicitly casts to unsigned (but note that we cannot
      implement isxdigit in terms of hexval(), as it also casts
      its return value to unsigned).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      50a71776
    • Jeff King's avatar
      foreach_alt_odb: propagate return value from callback · fe1b2268
      Jeff King authored
      We check the return value of the callback and stop iterating
      if it is non-zero. However, we do not make the non-zero
      return value available to the caller, so they have no way of
      knowing whether the operation succeeded or not (technically
      they can keep their own error flag in the callback data, but
      that is unlike our other for_each functions).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      fe1b2268
  2. 13 Oct, 2014 3 commits
    • Jeff King's avatar
      test-lib.sh: support -x option for shell-tracing · a136f6d8
      Jeff King authored
      Usually running a test under "-v" makes it clear which
      command is failing. However, sometimes it can be useful to
      also see a complete trace of the shell commands being run in
      the test. You can do so without any support from the test
      suite by running "sh -x tXXXX-foo.sh". However, this
      produces quite a large bit of output, as we see a trace of
      the entire test suite.
      
      This patch instead introduces a "-x" option to the test
      scripts (i.e., "./tXXXX-foo.sh -x"). When enabled, this
      turns on "set -x" only for the tests themselves. This can
      still be a bit verbose, but should keep things to a more
      manageable level. You can even use "--verbose-only" to see
      the trace only for a specific test.
      
      The implementation is a little invasive. We turn on the "set
      -x" inside the "eval" of the test code. This lets the eval
      itself avoid being reported in the trace (which would be
      long, and redundant with the verbose listing we already
      showed). And then after the eval runs, we do some trickery
      with stderr to avoid showing the "set +x" to the user.
      
      We also show traces for test_cleanup functions (since they
      can impact the test outcome, too). However, we do avoid
      running the noop ":" cleanup (the default if the test does
      not use test_cleanup at all), as it creates unnecessary
      noise in the "set -x" output.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      a136f6d8
    • Jeff King's avatar
      t5304: use helper to report failure of "test foo = bar" · 8ad16524
      Jeff King authored
      For small outputs, we sometimes use:
      
        test "$(some_cmd)" = "something we expect"
      
      instead of a full test_cmp. The downside of this is that
      when it fails, there is no output at all from the script.
      Let's introduce a small helper to make tests easier to
      debug.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      8ad16524
    • Jeff King's avatar
      t5304: use test_path_is_* instead of "test -f" · f1dd90bd
      Jeff King authored
      This is slightly more robust (checking "! test -f" would not
      notice a directory of the same name, though that is not
      likely to happen here). It also makes debugging easier, as
      the test script will output a message on failure.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      f1dd90bd
  3. 08 Oct, 2014 5 commits
    • Junio C Hamano's avatar
      Update draft release notes to 2.2 · 63a45136
      Junio C Hamano authored
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      63a45136
    • Junio C Hamano's avatar
      Merge branch 'sp/stream-clean-filter' · f0d89001
      Junio C Hamano authored
      When running a required clean filter, we do not have to mmap the
      original before feeding the filter.  Instead, stream the file
      contents directly to the filter and process its output.
      
      * sp/stream-clean-filter:
        sha1_file: don't convert off_t to size_t too early to avoid potential die()
        convert: stream from fd to required clean filter to reduce used address space
        copy_fd(): do not close the input file descriptor
        mmap_limit: introduce GIT_MMAP_LIMIT to allow testing expected mmap size
        memory_limit: use git_env_ulong() to parse GIT_ALLOC_LIMIT
        config.c: add git_env_ulong() to parse environment variable
        convert: drop arguments other than 'path' from would_convert_to_git()
      f0d89001
    • Junio C Hamano's avatar
      Merge branch 'bw/use-write-script-in-tests' · 9342f497
      Junio C Hamano authored
      * bw/use-write-script-in-tests:
        t/lib-credential: use write_script
      9342f497
    • Junio C Hamano's avatar
      Merge branch 'nd/archive-pathspec' · b2c45f5b
      Junio C Hamano authored
      "git archive" learned to filter what gets archived with pathspec.
      
      * nd/archive-pathspec:
        archive: support filtering paths with glob
      b2c45f5b
    • Junio C Hamano's avatar
      Merge branch 'jc/push-cert' · fb06b528
      Junio C Hamano authored
      Allow "git push" request to be signed, so that it can be verified and
      audited, using the GPG signature of the person who pushed, that the
      tips of branches at a public repository really point the commits
      the pusher wanted to, without having to "trust" the server.
      
      * jc/push-cert: (24 commits)
        receive-pack::hmac_sha1(): copy the entire SHA-1 hash out
        signed push: allow stale nonce in stateless mode
        signed push: teach smart-HTTP to pass "git push --signed" around
        signed push: fortify against replay attacks
        signed push: add "pushee" header to push certificate
        signed push: remove duplicated protocol info
        send-pack: send feature request on push-cert packet
        receive-pack: GPG-validate push certificates
        push: the beginning of "git push --signed"
        pack-protocol doc: typofix for PKT-LINE
        gpg-interface: move parse_signature() to where it should be
        gpg-interface: move parse_gpg_output() to where it should be
        send-pack: clarify that cmds_sent is a boolean
        send-pack: refactor inspecting and resetting status and sending commands
        send-pack: rename "new_refs" to "need_pack_data"
        receive-pack: factor out capability string generation
        send-pack: factor out capability string generation
        send-pack: always send capabilities
        send-pack: refactor decision to send update per ref
        send-pack: move REF_STATUS_REJECT_NODELETE logic a bit higher
        ...
      fb06b528
  4. 07 Oct, 2014 6 commits
  5. 30 Sep, 2014 13 commits
    • Junio C Hamano's avatar
      Sync with 2.1.2 · 565301e4
      Junio C Hamano authored
      * maint:
        Git 2.1.2
      565301e4
    • Junio C Hamano's avatar
      Merge branch 'jt/itimer-autoconf' · 7dded661
      Junio C Hamano authored
      setitmer(2) and related API elements can be configured from
      Makefile but autoconf did not know about it.
      
      * jt/itimer-autoconf:
        autoconf: check for setitimer()
        autoconf: check for struct itimerval
        git-compat-util.h: add missing semicolon after struct itimerval
      7dded661
    • Junio C Hamano's avatar
      Merge branch 'jc/test-lazy-prereq' · 0ba92ef3
      Junio C Hamano authored
      Test-script clean-up.
      
      * jc/test-lazy-prereq:
        tests: drop GIT_*_TIMING_TESTS environment variable support
      0ba92ef3
    • Junio C Hamano's avatar
      Merge branch 'sb/merge-recursive-copy-paste-fix' · ab9bc95d
      Junio C Hamano authored
      "git merge-recursive" had a small bug that could have made it
      mishandle "one side deleted, the other side did not touch it" in a
      rare corner case, where the other side actually did touch to cause
      the blob object names to be different but both blobs before and
      after the change normalize to the same (e.g. correcting mistake to
      check in a blob with CRLF line endings by replacing it with another
      blob that records the same contents with LF line endings).
      
      * sb/merge-recursive-copy-paste-fix:
        merge-recursive: remove stale commented debugging code
        merge-recursive: fix copy-paste mistake
      ab9bc95d
    • Junio C Hamano's avatar
      Merge branch 'pr/use-default-sigpipe-setting' · 131f0315
      Junio C Hamano authored
      We used to get confused when a process called us with SIGPIPE
      ignored; we do want to die with SIGPIPE when the output is not
      read by default, and do ignore the signal when appropriate.
      
      * pr/use-default-sigpipe-setting:
        mingw.h: add dummy functions for sigset_t operations
        unblock and unignore SIGPIPE
      131f0315
    • Junio C Hamano's avatar
      Git 2.1.2 · 80b616d0
      Junio C Hamano authored
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      80b616d0
    • Junio C Hamano's avatar
      Merge branch 'jk/fsck-exit-code-fix' into maint · 46c8f859
      Junio C Hamano authored
      "git fsck" failed to report that it found corrupt objects via its
      exit status in some cases.
      
      * jk/fsck-exit-code-fix:
        fsck: return non-zero status on missing ref tips
        fsck: exit with non-zero status upon error from fsck_obj()
      46c8f859
    • Junio C Hamano's avatar
      Merge branch 'ta/config-add-to-empty-or-true-fix' into maint · 102edda4
      Junio C Hamano authored
      "git config --add section.var val" used to lose existing
      section.var whose value was an empty string.
      
      * ta/config-add-to-empty-or-true-fix:
        config: avoid a funny sentinel value "a^"
        make config --add behave correctly for empty and NULL values
      102edda4
    • Junio C Hamano's avatar
      Merge branch 'mk/reachable-protect-detached-head' into maint · 421ec4f8
      Junio C Hamano authored
      Reachability check (used in "git prune" and friends) did not add a
      detached HEAD as a starting point to traverse objects still in use.
      
      * mk/reachable-protect-detached-head:
        reachable.c: add HEAD to reachability starting commits
      421ec4f8
    • Junio C Hamano's avatar
      Merge branch 'mb/fast-import-delete-root' into maint · 5b830a85
      Junio C Hamano authored
      An attempt to remove the entire tree in the "git fast-import" input
      stream caused it to misbehave.
      
      * mb/fast-import-delete-root:
        fast-import: fix segfault in store_tree()
        t9300: test filedelete command
      5b830a85
    • Junio C Hamano's avatar
      Merge branch 'jk/index-pack-threading-races' into maint · 46092ebf
      Junio C Hamano authored
      When receiving an invalid pack stream that records the same object
      twice, multiple threads got confused due to a race.
      
      * jk/index-pack-threading-races:
        index-pack: fix race condition with duplicate bases
      46092ebf
    • Junio C Hamano's avatar
      Merge branch 'jk/send-pack-many-refspecs' into maint · 06051709
      Junio C Hamano authored
      "git push" over HTTP transport had an artificial limit on number of
      refs that can be pushed imposed by the command line length.
      
      * jk/send-pack-many-refspecs:
        send-pack: take refspecs over stdin
      06051709
    • Junio C Hamano's avatar
      Merge branch 'so/rebase-doc' into maint · e7867e80
      Junio C Hamano authored
      * so/rebase-doc:
        Documentation/git-rebase.txt: <upstream> must be given to specify <branch>
        Documentation/git-rebase.txt: -f forces a rebase that would otherwise be a no-op
      e7867e80