1. 16 1月, 2017 4 次提交
    • J
      sha1_file: add read_loose_object() function · f6371f92
      Jeff King 提交于
      It's surprisingly hard to ask the sha1_file code to open a
      _specific_ incarnation of a loose object. Most of the
      functions take a sha1, and loop over the various object
      types (packed versus loose) and locations (local versus
      alternates) at a low level.
      
      However, some tools like fsck need to look at a specific
      file. This patch gives them a function they can use to open
      the loose object at a given path.
      
      The implementation unfortunately ends up repeating bits of
      related functions, but there's not a good way around it
      without some major refactoring of the whole sha1_file stack.
      We need to mmap the specific file, then partially read the
      zlib stream to know whether we're streaming or not, and then
      finally either stream it or copy the data to a buffer.
      
      We can do that by assembling some of the more arcane
      internal sha1_file functions, but we end up having to
      essentially reimplement unpack_sha1_file(), along with the
      streaming bits of check_sha1_signature().
      
      Still, most of the ugliness is contained in the new
      function, and the interface is clean enough that it may be
      reusable (though it seems unlikely anything but git-fsck
      would care about opening a specific file).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f6371f92
    • J
      t1450: test fsck of packed objects · 118e6cea
      Jeff King 提交于
      The code paths in fsck for packed and loose objects are
      quite different, and it is not immediately obvious that the
      packed case behaves well. In particular:
      
        1. The fsck_loose() function always returns "0" to tell the
           iterator to keep checking more objects. Whereas
           fsck_obj_buffer() (which handles packed objects)
           returns -1. This is OK, because the callback machinery
           for verify_pack() does not stop when it sees a non-zero
           return.
      
        2. The fsck_loose() function sets the ERROR_OBJECT bit
           when fsck_obj() fails, whereas fsck_obj_buffer() sets it
           only when it sees a corrupt object. This turns out not
           to matter. We don't actually do anything with this bit
           except exit the program with a non-zero code, and that
           is handled already by the non-zero return from the
           function.
      
      So there are no bugs here, but it was certainly confusing to
      me. And we do not test either of the properties in t1450
      (neither that a non-corruption error will caused a non-zero
      exit for a packed object, nor that we keep going after
      seeing the first error). Let's test both of those
      conditions, so that we'll notice if any of those assumptions
      becomes invalid.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      118e6cea
    • J
      sha1_file: fix error message for alternate objects · 771e7d57
      Jeff King 提交于
      When we fail to open a corrupt loose object, we report an
      error and mention the filename via sha1_file_name().
      However, that function will always give us a path in the
      local repository, whereas the corrupt object may have come
      from an alternate. The result is a very misleading error
      message.
      
      Teach the open_sha1_file() and stat_sha1_file() helpers to
      pass back the path they found, so that we can report it
      correctly.
      
      Note that the pointers we return go to static storage (e.g.,
      from sha1_file_name()), which is slightly dangerous.
      However, these helpers are static local helpers, and the
      names are used for immediately generating error messages.
      The simplicity is an acceptable tradeoff for the danger.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      771e7d57
    • J
      t1450: refactor loose-object removal · 0b20f1a2
      Jeff King 提交于
      Commit 90cf590f (fsck: optionally show more helpful info
      for broken links, 2016-07-17) added a remove_loose_object()
      helper, but we already had a remove_object() helper that did
      the same thing. Let's combine these into one.
      
      The implementations had a few subtle differences, so I've
      tried to take the best of both:
      
        - the original used "sed", but the newer version avoids
          spawning an extra process
      
        - the original processed "$*", which was nonsense, as it
          assumed only a single sha1. Use "$1" to make that more
          clear.
      
        - the newer version ran an extra rev-parse, but it was not
          necessary; it's sole caller already converted the
          argument into a raw sha1
      
        - the original used "rm -f", whereas the new one uses
          "rm". The latter is better because it may notice a bug
          or other unexpected failure in the test. (The original
          does check that the object exists before we remove it,
          which is good, but that's a subset of the possible
          unexpected conditions).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0b20f1a2
  2. 06 12月, 2016 3 次提交
  3. 30 11月, 2016 22 次提交
    • J
      Merge branch 'tk/diffcore-delta-remove-unused' into maint · 0a79ccaa
      Junio C Hamano 提交于
      Code cleanup.
      
      * tk/diffcore-delta-remove-unused:
        diffcore-delta: remove unused parameter to diffcore_count_changes()
      0a79ccaa
    • J
      Merge branch 'jk/create-branch-remove-unused-param' into maint · af8d6a98
      Junio C Hamano 提交于
      Code clean-up.
      
      * jk/create-branch-remove-unused-param:
        create_branch: drop unused "head" parameter
      af8d6a98
    • J
      Merge branch 'nd/worktree-lock' into maint · 797d1a46
      Junio C Hamano 提交于
      Typofix.
      
      * nd/worktree-lock:
        git-worktree.txt: fix typo "to"/"two", and add comma
      797d1a46
    • J
      Merge branch 'ps/common-info-doc' into maint · d92466ee
      Junio C Hamano 提交于
      Doc fix.
      
      * ps/common-info-doc:
        doc: fix location of 'info/' with $GIT_COMMON_DIR
      d92466ee
    • J
      Merge branch 'rs/cocci' into maint · e3c4323e
      Junio C Hamano 提交于
      Improve the rule to convert "unsigned char [20]" into "struct
      object_id *" in contrib/coccinelle/
      
      * rs/cocci:
        cocci: avoid self-references in object_id transformations
      e3c4323e
    • J
      Merge branch 'nd/test-helpers' into maint · 91207f37
      Junio C Hamano 提交于
      Update to the test framework made in 2.9 timeframe broke running
      the tests under valgrind, which has been fixed.
      
      * nd/test-helpers:
        valgrind: support test helpers
      91207f37
    • J
      Merge branch 'sc/fmt-merge-msg-doc-markup-fix' into maint · 6afadbd5
      Junio C Hamano 提交于
      Documentation fix.
      
      * sc/fmt-merge-msg-doc-markup-fix:
        Documentation/fmt-merge-msg: fix markup in example
      6afadbd5
    • J
      Merge branch 'rs/commit-pptr-simplify' into maint · c8a3ec37
      Junio C Hamano 提交于
      Code simplification.
      
      * rs/commit-pptr-simplify:
        commit: simplify building parents list
      c8a3ec37
    • J
      Merge branch 'jk/rebase-config-insn-fmt-docfix' into maint · 50b8276a
      Junio C Hamano 提交于
      Documentation fix.
      
      * jk/rebase-config-insn-fmt-docfix:
        doc: fix missing "::" in config list
      50b8276a
    • J
      Merge branch 'ak/pre-receive-hook-template-modefix' into maint · e9f74313
      Junio C Hamano 提交于
      A trivial clean-up to a recently graduated topic.
      
      * ak/pre-receive-hook-template-modefix:
        pre-receive.sample: mark it executable
      e9f74313
    • J
      Merge branch 'ls/macos-update' into maint · 729fb9ad
      Junio C Hamano 提交于
      Portability update and workaround for builds on recent Mac OS X.
      
      * ls/macos-update:
        travis-ci: disable GIT_TEST_HTTPD for macOS
        Makefile: set NO_OPENSSL on macOS by default
      729fb9ad
    • J
      Merge branch 'as/merge-attr-sleep' into maint · 25e298d2
      Junio C Hamano 提交于
      Fix for a racy false-positive test failure.
      
      * as/merge-attr-sleep:
        t6026: clarify the point of "kill $(cat sleep.pid)"
        t6026: ensure that long-running script really is
        Revert "t6026-merge-attr: don't fail if sleep exits early"
        Revert "t6026-merge-attr: ensure that the merge driver was called"
        t6026-merge-attr: ensure that the merge driver was called
        t6026-merge-attr: don't fail if sleep exits early
      25e298d2
    • J
      Merge branch 'ak/sh-setup-dot-source-i18n-fix' into maint · bb6bc68d
      Junio C Hamano 提交于
      Recent update to git-sh-setup (a library of shell functions that
      are used by our in-tree scripted Porcelain commands) included
      another shell library git-sh-i18n without specifying where it is,
      relying on the $PATH.  This has been fixed to be more explicit by
      prefixing $(git --exec-path) output in front.
      
      * ak/sh-setup-dot-source-i18n-fix:
        git-sh-setup: be explicit where to dot-source git-sh-i18n from.
      bb6bc68d
    • J
      Merge branch 'jk/daemon-path-ok-check-truncation' into maint · aa22ef8a
      Junio C Hamano 提交于
      "git daemon" used fixed-length buffers to turn URL to the
      repository the client asked for into the server side directory
      path, using snprintf() to avoid overflowing these buffers, but
      allowed possibly truncated paths to the directory.  This has been
      tightened to reject such a request that causes overlong path to be
      required to serve.
      
      * jk/daemon-path-ok-check-truncation:
        daemon: detect and reject too-long paths
      aa22ef8a
    • J
      Merge branch 'rs/ring-buffer-wraparound' into maint · f2ad912f
      Junio C Hamano 提交于
      The code that we have used for the past 10+ years to cycle
      4-element ring buffers turns out to be not quite portable in
      theoretical world.
      
      * rs/ring-buffer-wraparound:
        hex: make wraparound of the index into ring-buffer explicit
      f2ad912f
    • J
      Merge branch 'mm/send-email-cc-cruft-after-address' into maint · a3f2781d
      Junio C Hamano 提交于
      "git send-email" attempts to pick up valid e-mails from the
      trailers, but people in real world write non-addresses there, like
      "Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
      on the availability and vintage of Mail::Address perl module.
      
      * mm/send-email-cc-cruft-after-address:
        Git.pm: add comment pointing to t9000
        t9000-addresses: update expected results after fix
        parse_mailboxes: accept extra text after <...> address
      a3f2781d
    • J
      Merge branch 'cp/completion-negative-refs' into maint · fa308cd8
      Junio C Hamano 提交于
      The command-line completion script (in contrib/) learned to
      complete "git cmd ^mas<HT>" to complete the negative end of
      reference to "git cmd ^master".
      
      * cp/completion-negative-refs:
        completion: support excluding refs
      fa308cd8
    • J
      Merge branch 'jc/am-read-author-file' into maint · bab32da3
      Junio C Hamano 提交于
      Extract a small helper out of the function that reads the authors
      script file "git am" internally uses.
      This by itself is not useful until a second caller appears in the
      future for "rebase -i" helper.
      
      * jc/am-read-author-file:
        am: refactor read_author_script()
      bab32da3
    • J
      Git 2.11 · 454cb6bd
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      454cb6bd
    • J
      Merge branch 'jk/common-main' · 95c2b13a
      Junio C Hamano 提交于
      Fix for a small regression in a topic already in 'master'.
      
      * jk/common-main:
        common-main: stop munging argv[0] path
      95c2b13a
    • J
      Merge tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-po · 061eeff1
      Junio C Hamano 提交于
      l10n-2.11.0-rnd3.1: update ru and ca translations
      
      * tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-po:
        l10n: ru.po: update Russian translation
        l10n: ca.po: update translation
      061eeff1
    • J
      common-main: stop munging argv[0] path · 6854a8f5
      Jeff King 提交于
      Since 650c4492 (common-main: call git_extract_argv0_path(),
      2016-07-01), the argv[0] that is seen in cmd_main() of
      individual programs is always the basename of the
      executable, as common-main strips off the full path. This
      can produce confusing results for git-daemon, which wants to
      re-exec itself.
      
      For instance, if the program was originally run as
      "/usr/lib/git/git-daemon", it will try just re-execing
      "git-daemon", which will find the first instance in $PATH.
      If git's exec-path has not been prepended to $PATH, we may
      find the git-daemon from a different version (or no
      git-daemon at all).
      
      Normally this isn't a problem. Git commands are run as "git
      daemon", the git wrapper puts the exec-path at the front of
      $PATH, and argv[0] is already "daemon" anyway. But running
      git-daemon via its full exec-path, while not really a
      recommended method, did work prior to 650c4492. Let's make
      it work again.
      
      The real goal of 650c4492 was not to munge argv[0], but to
      reliably set the argv0_path global. The only reason it
      munges at all is that one caller, the git.c wrapper,
      piggy-backed on that computation to find the command
      basename.  Instead, let's leave argv[0] untouched in
      common-main, and have git.c do its own basename computation.
      
      While we're at it, let's drop the return value from
      git_extract_argv0_path(). It was only ever used in this one
      callsite, and its dual purposes is what led to this
      confusion in the first place.
      
      Note that by changing the interface, the compiler can
      confirm for us that there are no other callers storing the
      return value. But the compiler can't tell us whether any of
      the cmd_main() functions (besides git.c) were relying on the
      basename munging. However, we can observe that prior to
      650c4492, no other cmd_main() functions did that munging,
      and no new cmd_main() functions have been introduced since
      then. So we can't be regressing any of those cases.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6854a8f5
  4. 29 11月, 2016 6 次提交
  5. 25 11月, 2016 1 次提交
  6. 24 11月, 2016 4 次提交