1. 20 8月, 2015 8 次提交
    • J
      Merge branch 'jc/finalize-temp-file' · 51a22ce1
      Junio C Hamano 提交于
      Long overdue micro clean-up.
      
      * jc/finalize-temp-file:
        sha1_file.c: rename move_temp_to_file() to finalize_object_file()
      51a22ce1
    • J
      Merge branch 'ps/guess-repo-name-at-root' · 4bfab58c
      Junio C Hamano 提交于
      "git clone $URL", when cloning from a site whose sole purpose is to
      host a single repository (hence, no path after <scheme>://<site>/),
      tried to use the site name as the new repository name, but did not
      remove username or password when <site> part was of the form
      <user>@<pass>:<host>.  The code is taught to redact these.
      
      * ps/guess-repo-name-at-root:
        clone: abort if no dir name could be guessed
        clone: do not use port number as dir name
        clone: do not include authentication data in guessed dir
      4bfab58c
    • J
      Merge branch 'jk/guess-repo-name-regression-fix' · 8259da5e
      Junio C Hamano 提交于
      "git clone $URL" in recent releases of Git contains a regression in
      the code that invents a new repository name incorrectly based on
      the $URL.  This has been corrected.
      
      * jk/guess-repo-name-regression-fix:
        clone: use computed length in guess_dir_name
        clone: add tests for output directory
      8259da5e
    • J
      Merge branch 'jk/negative-hiderefs' · 824a0be6
      Junio C Hamano 提交于
      A negative !ref entry in multi-value transfer.hideRefs
      configuration can be used to say "don't hide this one".
      
      * jk/negative-hiderefs:
        refs: support negative transfer.hideRefs
        docs/config.txt: reorder hideRefs config
      824a0be6
    • J
      Merge branch 'jk/test-with-x' · 138014c3
      Junio C Hamano 提交于
      Running tests with the "-x" option to make them verbose had some
      unpleasant interactions with other features of the test suite.
      
      * jk/test-with-x:
        test-lib: disable trace when test is not verbose
        test-lib: turn off "-x" tracing during chain-lint check
      138014c3
    • J
      Merge branch 'ps/t1509-chroot-test-fixup' · 034603f0
      Junio C Hamano 提交于
      t1509 test that requires a dedicated VM environment had some
      bitrot, which has been corrected.
      
      * ps/t1509-chroot-test-fixup:
        tests: fix cleanup after tests in t1509-root-worktree
        tests: fix broken && chains in t1509-root-worktree
      034603f0
    • J
      Merge branch 'sb/check-return-from-read-ref' · 1d82ef5b
      Junio C Hamano 提交于
      * sb/check-return-from-read-ref:
        transport-helper: die on errors reading refs.
      1d82ef5b
    • J
      Merge branch 'mm/pull-upload-pack' · d772def9
      Junio C Hamano 提交于
      "git pull" in recent releases of Git has a regression in the code
      that allows custom path to the --upload-pack=<program>.  This has
      been corrected.
      
      Note that this is irrelevant for 'master' with "git pull" rewritten
      in C.
      
      * mm/pull-upload-pack:
        pull.sh: quote $upload_pack when passing it to git-fetch
      d772def9
  2. 18 8月, 2015 5 次提交
  3. 13 8月, 2015 9 次提交
    • J
      Second batch for 2.6 · 130be8ee
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      130be8ee
    • J
      Merge branch 'sb/remove-unused-var-from-builtin-add' · fde61a0f
      Junio C Hamano 提交于
      * sb/remove-unused-var-from-builtin-add:
        add: remove dead code
      fde61a0f
    • J
      Merge branch 'sb/parse-options-codeformat' · 535efaf6
      Junio C Hamano 提交于
      * sb/parse-options-codeformat:
        parse-options: align curly braces for all options
      535efaf6
    • J
      Merge branch 'dt/unpack-trees-cache-tree-revalidate' · 9ad8474b
      Junio C Hamano 提交于
      The code to perform multi-tree merges has been taught to repopulate
      the cache-tree upon a successful merge into the index, so that
      subsequent "diff-index --cached" (hence "status") and "write-tree"
      (hence "commit") will go faster.
      
      The same logic in "git checkout" may now be removed, but that is a
      separate issue.
      
      * dt/unpack-trees-cache-tree-revalidate:
        unpack-trees: populate cache-tree on successful merge
      9ad8474b
    • J
      Merge branch 'dt/reflog-tests' · 0188f323
      Junio C Hamano 提交于
      Tests that assume how reflogs are represented on the filesystem too
      much have been corrected.
      
      * dt/reflog-tests:
        tests: remove some direct access to .git/logs
        t/t7509: remove unnecessary manipulation of reflog
      0188f323
    • J
      Merge branch 'es/worktree-add-cleanup' · 53860f03
      Junio C Hamano 提交于
      The "new-worktree-mode" hack in "checkout" that was added in
      nd/multiple-work-trees topic has been removed by updating the
      implementation of new "worktree add".
      
      * es/worktree-add-cleanup: (25 commits)
        Documentation/git-worktree: fix duplicated 'from'
        Documentation/config: mention "now" and "never" for 'expire' settings
        Documentation/git-worktree: fix broken 'linkgit' invocation
        checkout: drop intimate knowledge of newly created worktree
        worktree: populate via "git reset --hard" rather than "git checkout"
        worktree: avoid resolving HEAD unnecessarily
        worktree: make setup of new HEAD distinct from worktree population
        worktree: detect branch-name/detached and error conditions locally
        worktree: add_worktree: construct worktree-population command locally
        worktree: elucidate environment variables intended for child processes
        worktree: make branch creation distinct from worktree population
        worktree: add: suppress auto-vivication with --detach and no <branch>
        worktree: make --detach mutually exclusive with -b/-B
        worktree: introduce options container
        worktree: simplify new branch (-b/-B) option checking
        worktree: improve worktree setup message
        branch: publish die_if_checked_out()
        checkout: teach check_linked_checkout() about symbolic link HEAD
        checkout: check_linked_checkout: simplify symref parsing
        checkout: check_linked_checkout: improve "already checked out" aesthetic
        ...
      53860f03
    • J
      Merge branch 'pt/am-builtin' · 7aa2da61
      Junio C Hamano 提交于
      Rewrite "am" in "C".
      
      * pt/am-builtin: (46 commits)
        git-am: add am.threeWay config variable
        builtin-am: remove redirection to git-am.sh
        builtin-am: check for valid committer ident
        builtin-am: implement legacy -b/--binary option
        builtin-am: implement -i/--interactive
        builtin-am: support and auto-detect mercurial patches
        builtin-am: support and auto-detect StGit series files
        builtin-am: support and auto-detect StGit patches
        builtin-am: rerere support
        builtin-am: invoke post-applypatch hook
        builtin-am: invoke pre-applypatch hook
        builtin-am: invoke applypatch-msg hook
        builtin-am: support automatic notes copying
        builtin-am: invoke post-rewrite hook
        builtin-am: implement -S/--gpg-sign, commit.gpgsign
        builtin-am: implement --committer-date-is-author-date
        builtin-am: implement --ignore-date
        builtin-am: pass git-apply's options to git-apply
        builtin-am: implement --[no-]scissors
        builtin-am: support --keep-cr, am.keepcr
        ...
      7aa2da61
    • J
      Merge branch 'es/worktree-add' · c1e5ca90
      Junio C Hamano 提交于
      Remove remaining cruft from  "git checkout --to", which
      transitioned to "git worktree add".
      
      * es/worktree-add:
        config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"
        Documentation/git-worktree: wordsmith worktree-related manpages
        Documentation/config: fix stale "git prune --worktree" reference
        Documentation/git-worktree: fix incorrect reference to file "locked"
        Documentation/git-worktree: consistently use term "linked working tree"
      c1e5ca90
    • J
      Merge branch 'ad/bisect-cleanup' · 71cc6007
      Junio C Hamano 提交于
      Code and documentation clean-up to "git bisect".
      
      * ad/bisect-cleanup:
        bisect: don't mix option parsing and non-trivial code
        bisect: simplify the addition of new bisect terms
        bisect: replace hardcoded "bad|good" by variables
        Documentation/bisect: revise overall content
        Documentation/bisect: move getting help section to the end
        bisect: correction of typo
      71cc6007
  4. 11 8月, 2015 6 次提交
    • J
      sha1_file.c: rename move_temp_to_file() to finalize_object_file() · cb5add58
      Junio C Hamano 提交于
      Since 5a688fe4 ("core.sharedrepository = 0mode" should set, not
      loosen, 2009-03-25), we kept reminding ourselves:
      
          NEEDSWORK: this should be renamed to finalize_temp_file() as
          "moving" is only a part of what it does, when no patch between
          master to pu changes the call sites of this function.
      
      without doing anything about it.  Let's do so.
      
      The purpose of this function was not to move but to finalize.  The
      detail of the primarily implementation of finalizing was to link the
      temporary file to its final name and then to unlink, which wasn't
      even "moving".  The alternative implementation did "move" by calling
      rename(2), which is a fun tangent.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cb5add58
    • P
      clone: abort if no dir name could be guessed · adef9561
      Patrick Steinhardt 提交于
      Due to various components of the URI being stripped off it may
      happen that we fail to guess a directory name. We currently error
      out with a message that it is impossible to create the working
      tree '' in such cases. Instead, error out early with a sensible
      error message hinting that a directory name should be specified
      manually on the command line.
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      adef9561
    • P
      clone: do not use port number as dir name · 92722efe
      Patrick Steinhardt 提交于
      If the URI contains a port number and the URI's path component is
      empty we fail to guess a sensible directory name. E.g. cloning a
      repository 'ssh://example.com:2222/' we guess a directory name
      '2222' where we would want the hostname only, e.g. 'example.com'.
      
      We need to take care to not drop trailing port-like numbers in
      certain cases. E.g. when cloning a repository 'foo/bar:2222.git'
      we want to guess the directory name '2222' instead of 'bar'.
      Thus, we have to first check the stripped URI for path separators
      and only strip port numbers if there are path separators present.
      This heuristic breaks when cloning a repository 'bar:2222.git',
      though.
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      92722efe
    • P
      clone: do not include authentication data in guessed dir · e8959867
      Patrick Steinhardt 提交于
      If the URI contains authentication data and the URI's path
      component is empty, we fail to guess a sensible directory name.
      E.g. cloning a repository 'ssh://user:password@example.com/' we
      guess a directory name 'password@example.com' where we would want
      the hostname only, e.g. 'example.com'.
      
      The naive way of just adding '@' as a path separator would break
      cloning repositories like 'foo/bar@baz.git' (which would
      currently become 'bar@baz' but would then become 'baz' only).
      Instead fix this by first dropping the scheme and then greedily
      scanning for an '@' sign until we find the first path separator.
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e8959867
    • J
      clone: use computed length in guess_dir_name · db2e2204
      Jeff King 提交于
      Commit 7e837c64 (clone: simplify string handling in
      guess_dir_name(), 2015-07-09) changed clone to use
      strip_suffix instead of hand-rolled pointer manipulation.
      However, strip_suffix will strip from the end of a
      NUL-terminated string, and we may have already stripped some
      characters (like directory separators, or "/.git"). This
      leads to commands like:
      
        git clone host:foo.git/
      
      failing to strip the ".git".
      
      We must instead convert our pointer arithmetic into a
      computed length and feed that to strip_suffix_mem, which will
      then reduce the length further for us.
      
      It would be nicer if we could drop the pointer manipulation
      entirely, and just continually strip using strip_suffix. But
      that doesn't quite work for two reasons:
      
        1. The early suffixes we're stripping are not constant; we
           need to look for is_dir_sep, which could be one of
           several characters.
      
        2. Mid-way through the stripping we compute the pointer
           "start", which shows us the beginning of the pathname.
           Which really give us two lengths to work with: the
           offset from the start of the string, and from the start
           of the path. By using pointers for the early part, we
           can just compute the length from "start" when we need
           it.
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NSebastian Schuberth <sschuberth@gmail.com>
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      db2e2204
    • J
      clone: add tests for output directory · d6a31e08
      Jeff King 提交于
      When we run "git clone $url", clone guesses from the $url
      what to name the local output directory. We don't have any
      test coverage of this, so let's add some basic tests.
      
      This reveals a few problems:
      
        - cloning "foo.git/" does not properly remove the ".git";
          this is a recent regression from 7e837c64 (clone:
          simplify string handling in guess_dir_name(), 2015-07-09)
      
        - likewise, cloning foo/.git does not seem to handle the
          bare case (we should end up in foo.git, but we try to
          use foo/.git on the local end), which also comes from
          7e837c64.
      
        - cloning the root is not very smart about URL parsing,
          and usernames and port numbers may end up in the
          directory name
      
      All of these tests are marked as failures.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d6a31e08
  5. 08 8月, 2015 3 次提交
    • J
      test-lib: disable trace when test is not verbose · 9b5fe78b
      Jeff King 提交于
      The "-x" test-script option turns on the shell's "-x"
      tracing, which can help show why a particular test is
      failing. Unfortunately, this can create false negatives in
      some tests if they invoke a shell function with its stderr
      redirected. t5512.10 is such a test, as it does:
      
          test_must_fail git ls-remote refs*master >actual 2>&1 &&
          test_cmp exp actual
      
      The "actual" file gets the "-x" trace for the test_must_fail
      function, which prevents it from matching the expected
      output.
      
      There's no way to avoid this without managing the
      trace flag inside each sub-function, which isn't really a
      workable solution. But unless you specifically care about
      t5512.10, we can work around it by enabling tracing only for
      the specific tests we want.
      
      You can already do:
      
          ./t5512-ls-remote.sh -x --verbose-only=16
      
      to see the trace only for a specific test. But that doesn't
      _disable_ the tracing in the other tests; it just sends it
      to /dev/null. However, there's no point in generating a
      trace that the user won't see, so we can simply disable
      tracing whenever it doesn't have a matching verbose flag.
      
      The normal case of just "./t5512-ls-remote.sh -x" stays the
      same, as "-x" already implies "--verbose" (and
      "--verbose-only" overrides "--verbose", which is why this
      works at all). And for our test, we need only check
      $verbose, as maybe_setup_verbose will have already
      set that flag based on the $verbose_only list).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9b5fe78b
    • J
      test-lib: turn off "-x" tracing during chain-lint check · 2a01ef8c
      Jeff King 提交于
      Now that GIT_TEST_CHAIN_LINT is on by default, running:
      
          ./t0000-basic.sh -x --verbose-only=1
      
      starts with:
      
          expecting success:
                  find .git/objects -type f -print >should-be-empty &&
                  test_line_count = 0 should-be-empty
      
          + exit 117
          error: last command exited with $?=117
          + find .git/objects -type f -print
          + test_line_count = 0 should-be-empty
          + test 3 != 3
          + wc -l
          + test 0 = 0
          ok 1 - .git/objects should be empty after git init in an empty repo
      
      This is confusing, as the "exit 117" line and the error line
      (which is printed in red, no less!) are not part of the test
      at all, but are rather in the separate chain-lint test_eval.
      Let's unset the "trace" variable when eval-ing the chain
      lint check, which avoids this.
      
      Note that we cannot just do a one-shot variable like:
      
          trace= test_eval ...
      
      as the behavior of one-shot variables for function calls
      is not portable.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2a01ef8c
    • J
      refs: support negative transfer.hideRefs · 2bc31d16
      Jeff King 提交于
      If you hide a hierarchy of refs using the transfer.hideRefs
      config, there is no way to later override that config to
      "unhide" it. This patch implements a "negative" hide which
      causes matches to immediately be marked as unhidden, even if
      another match would hide it. We take care to apply the
      matches in reverse-order from how they are fed to us by the
      config machinery, as that lets our usual "last one wins"
      config precedence work (and entries in .git/config, for
      example, will override /etc/gitconfig).
      
      So you can now do:
      
        $ git config --system transfer.hideRefs refs/secret
        $ git config transfer.hideRefs '!refs/secret/not-so-secret'
      
      to hide refs/secret in all repos, except for one public bit
      in one specific repo. Or you can even do:
      
        $ git clone \
            -u "git -c transfer.hiderefs="!refs/foo" upload-pack" \
            remote:repo.git
      
      to clone remote:repo.git, overriding any hiding it has
      configured.
      
      There are two alternatives that were considered and
      rejected:
      
        1. A generic config mechanism for removing an item from a
           list. E.g.: (e.g., "[transfer] hideRefs -= refs/foo").
      
           This is nice because it could apply to other
           multi-valued config, as well. But it is not nearly as
           flexible. There is no way to say:
      
             [transfer]
             hideRefs = refs/secret
             hideRefs = refs/secret/not-so-secret
      
           Having explicit negative specifications means we can
           override previous entries, even if they are not the
           same literal string.
      
        2. Adding another variable to override some parts of
           hideRefs (e.g., "exposeRefs").
      
           This solves the problem from alternative (1), but it
           cannot easily obey the normal config precedence,
           because it would use two separate lists. For example:
      
             [transfer]
             hideRefs = refs/secret
             exposeRefs = refs/secret/not-so-secret
             hideRefs = refs/secret/not-so-secret/no-really-its-secret
      
           With two lists, we have to apply the "expose" rules
           first, and only then apply the "hide" rules. But that
           does not match what the above config intends.
      
           Of course we could internally parse that to a single
           list, respecting the ordering, which saves us having to
           invent the new "!" syntax. But using a single name
           communicates to the user that the ordering _is_
           important. And "!" is well-known for negation, and
           should not appear at the beginning of a ref (it is
           actually valid in a ref-name, but all entries here
           should be fully-qualified, starting with "refs/").
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2bc31d16
  6. 06 8月, 2015 3 次提交
  7. 05 8月, 2015 6 次提交
    • R
      git-am: add am.threeWay config variable · e97a5e76
      Remi Lespinet 提交于
      Add the am.threeWay configuration variable to use the -3 or --3way
      option of git am by default. When am.threeway is set and not desired
      for a specific git am command, the --no-3way option can be used to
      override it.
      Signed-off-by: NRemi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e97a5e76
    • P
      builtin-am: remove redirection to git-am.sh · 783d7e86
      Paul Tan 提交于
      At the beginning of the rewrite of git-am.sh to C, in order to not break
      existing test scripts that depended on a functional git-am, a
      redirection to git-am.sh was introduced that would activate if the
      environment variable _GIT_USE_BUILTIN_AM was not defined.
      
      Now that all of git-am.sh's functionality has been re-implemented in
      builtin/am.c, remove this redirection, and retire git-am.sh into
      contrib/examples/.
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      783d7e86
    • P
      builtin-am: check for valid committer ident · 5e4f9cff
      Paul Tan 提交于
      When commit_tree() is called, if the user does not have an explicit
      committer ident configured, it will attempt to construct a default
      committer ident based on the user's and system's info (e.g. gecos field,
      hostname etc.) However, if a default committer ident is unable to be
      constructed, commit_tree() will die(), but at this point of git-am's
      execution, there will already be changes made to the index and work
      tree.
      
      This can be confusing to new users, and as such since d64e6b04 (Keep
      Porcelainish from failing by broken ident after making changes.,
      2006-02-18) git-am.sh will check to see if the committer ident has been
      configured, or a default one can be constructed, before even starting to
      apply patches.
      
      Re-implement this in builtin/am.c.
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5e4f9cff
    • P
      builtin-am: implement legacy -b/--binary option · c2676cde
      Paul Tan 提交于
      The -b/--binary option was initially implemented in 087b6742 (git-am:
      --binary; document --resume and --binary., 2005-11-16). The option will
      pass the --binary flag to git-apply to allow it to apply binary patches.
      
      However, in 2b6eef94 (Make apply --binary a no-op., 2006-09-06), --binary
      was been made a no-op in git-apply. Following that, since cb3a160d
      (git-am: ignore --binary option, 2008-08-09), the --binary option in
      git-am is ignored as well.
      
      In 6c15a1c6 (am: officially deprecate -b/--binary option, 2012-03-13),
      the --binary option was tweaked to its present behavior: when set, the
      message:
      
      	The -b/--binary option has been a no-op for long time, and it
      	will be removed. Please do not use it anymore.
      
      will be printed.
      
      Re-implement this in builtin/am.c.
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c2676cde
    • P
      builtin-am: implement -i/--interactive · 7ff26832
      Paul Tan 提交于
      Since d1c5f2a4 (Add git-am, applymbox replacement., 2005-10-07),
      git-am.sh supported the --interactive mode. After parsing the patch mail
      and extracting the patch, commit message and authorship info, an
      interactive session will begin that allows the user to choose between:
      
      * applying the patch
      
      * applying the patch and all subsequent patches (by disabling
        interactive mode in subsequent patches)
      
      * skipping the patch
      
      * editing the commit message
      
      Since f89ad67f (Add [v]iew patch in git-am interactive., 2005-10-25),
      git-am.sh --interactive also supported viewing the patch to be applied.
      
      When --resolved-ing in --interactive mode, we need to take care to
      update the patch with the contents of the index, such that the correct
      patch will be displayed when the patch is viewed in interactive mode.
      
      Re-implement the above in builtin/am.c
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7ff26832
    • P
      builtin-am: support and auto-detect mercurial patches · 94cd175c
      Paul Tan 提交于
      Since 0cfd1120 (am: preliminary support for hg patches, 2011-08-29),
      git-am.sh could convert mercurial patches to an RFC2822 mail patch
      suitable for parsing with git-mailinfo, and queue them in the state
      directory for application.
      
      Since 15ced753 (git-am foreign patch support: autodetect some patch
      formats, 2009-05-27), git-am.sh was able to auto-detect mercurial
      patches by checking if the file begins with the line:
      
      	# HG changeset patch
      
      Re-implement the above in builtin/am.c.
      Helped-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      94cd175c