1. 27 9月, 2017 1 次提交
  2. 11 5月, 2017 1 次提交
    • Æ
      tests: fix tests broken under GETTEXT_POISON=YesPlease · 0d75bfe6
      Ævar Arnfjörð Bjarmason 提交于
      The GETTEXT_POISON=YesPlease compile-time testing option added in my
      bb946bba ("i18n: add GETTEXT_POISON to simulate unfriendly
      translator", 2011-02-22) has been slowly bitrotting as strings have
      been marked for translation, and new tests have been added without
      running it.
      
      I brought this up on the list ("[BUG] test suite broken with
      GETTEXT_POISON=YesPlease", [1]) asking whether this mode was useful at
      all anymore. At least one person occasionally uses it, and Lars
      Schneider offered to change one of the the Travis builds to run in
      this mode, so fix up the failing ones.
      
      My test setup runs most of the tests, with the notable exception of
      skipping all the p4 tests, so it's possible that there's still some
      lurking regressions I haven't fixed.
      
      1. <CACBZZX62+acvi1dpkknadTL827mtCm_QesGSZ=6+UnyeMpg8+Q@mail.gmail.com>
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0d75bfe6
  3. 23 3月, 2017 1 次提交
  4. 27 1月, 2017 1 次提交
  5. 13 1月, 2017 1 次提交
  6. 11 8月, 2016 1 次提交
    • S
      t7406: fix breakage on OSX · 967d7f89
      Stefan Beller 提交于
      On OSX `wc` prefixes the output of numbers with whitespace, such
      that the `commit_count` would be "SP <NUMBER>". When using that in
      
          git submodule update --init --depth=$commit_count
      
      the depth would be empty and the number is interpreted as the
      pathspec.  Fix this by not using `wc` and rather instruct rev-list
      to count.
      
      Another way to fix this is to remove the `=` sign after the
      `--depth` argument as then we are allowed to have more than just one
      whitespace between `--depth` and the actual number.  Prefer the
      solution of rev-list counting as that is expected to be slightly
      faster and more self-contained within Git.
      Reported-by: NLars Schneider <larsxschneider@gmail.com>
      Helped-by: Junio C Hamano <gitster@pobox.com>,
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      967d7f89
  7. 04 8月, 2016 1 次提交
    • S
      submodule update: allow '.' for branch value · 4d7bc52b
      Stefan Beller 提交于
      Gerrit has a "superproject subscription" feature[1], that triggers a
      commit in a superproject that is subscribed to its submodules.
      Conceptually this Gerrit feature can be done on the client side with
      Git via (except for raciness, error handling etc):
      
        while [ true ]; do
          git -C <superproject> submodule update --remote --force
          git -C <superproject> commit -a -m "Update submodules"
          git -C <superproject> push
        done
      
      for each branch in the superproject. To ease the configuration in Gerrit
      a special value of "." has been introduced for the submodule.<name>.branch
      to mean the same branch as the superproject[2], such that you can create a
      new branch on both superproject and the submodule and this feature
      continues to work on that new branch.
      
      Now we find projects in the wild with such a .gitmodules file.
      The .gitmodules used in these Gerrit projects do not conform
      to Gits understanding of how .gitmodules should look like.
      This teaches Git to deal gracefully with this syntax as well.
      
      The redefinition of "." does no harm to existing projects unaware of
      this change, as "." is an invalid branch name in Git, so we do not
      expect such projects to exist.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4d7bc52b
  8. 02 8月, 2016 2 次提交
  9. 18 6月, 2016 1 次提交
    • V
      tests: use test_i18n* functions to suppress false positives · 1edbaac3
      Vasco Almeida 提交于
      The test functions test_i18ncmp and test_i18ngrep pretend success if run
      under GETTEXT_POISON. By using those functions to test output which is
      correctly marked as translatable, enables one to detect if the strings
      newly marked for translation are from plumbing output. If they are
      indeed from plumbing, the test would fail, and the string should be
      unmarked, since it is not seen by users.
      
      Thus, it is productive to not have false positives when running the test
      under GETTEXT_POISON. This commit replaces normal test functions by
      their i18n aware variants in use-cases know to be correctly marked for
      translation, suppressing false positives.
      Signed-off-by: NVasco Almeida <vascomalmeida@sapo.pt>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1edbaac3
  10. 04 5月, 2016 1 次提交
    • S
      submodule init: redirect stdout to stderr · c66410ed
      Stefan Beller 提交于
      Reroute the output of stdout to stderr as it is just informative
      messages, not to be consumed by machines.
      
      This should not regress any scripts that try to parse the
      current output, as the output is already internationalized
      and therefore unstable.
      
      We want to init submodules from the helper for `submodule update`
      in a later patch and the stdout output of said helper is consumed
      by the parts of `submodule update` which are still written in shell.
      So we have to be careful which messages are on stdout.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c66410ed
  11. 31 3月, 2016 3 次提交
  12. 02 3月, 2016 2 次提交
  13. 09 1月, 2016 1 次提交
    • E
      t/t7406-submodule-update.sh: use the $( ... ) construct for command substitution · 848351b2
      Elia Pinto 提交于
      The Git CodingGuidelines prefer the $(...) construct for command
      substitution instead of using the backquotes `...`.
      
      The backquoted form is the traditional method for command
      substitution, and is supported by POSIX.  However, all but the
      simplest uses become complicated quickly.  In particular, embedded
      command substitutions and/or the use of double quotes require
      careful escaping with the backslash character.
      
      The patch was generated by:
      
      for _f in $(find . -name "*.sh")
      do
      	perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg'  "${_f}"
      done
      
      and then carefully proof-read.
      Signed-off-by: NElia Pinto <gitter.spiros@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      848351b2
  14. 21 3月, 2015 1 次提交
  15. 03 4月, 2014 1 次提交
  16. 25 2月, 2014 1 次提交
    • W
      submodule: explicit local branch creation in module_clone · 23d25e48
      W. Trevor King 提交于
      The previous code only checked out branches in cmd_add.  This commit
      moves the branch-checkout logic into module_clone, where it can be
      shared by cmd_add and cmd_update.  I also update the initial checkout
      command to use 'reset' to preserve branches setup during module_clone.
      
      With this change, folks cloning submodules for the first time via:
      
        $ git submodule update ...
      
      will get a local branch instead of a detached HEAD, unless they are
      using the default checkout-mode updates.  This is a change from the
      previous situation where cmd_update always used checkout-mode logic
      (regardless of the requested update mode) for updates that triggered
      an initial clone, which always resulted in a detached HEAD.
      
      This commit does not change the logic for updates after the initial
      clone, which will continue to create detached HEADs for checkout-mode
      updates, and integrate remote work with the local HEAD (detached or
      not) in other modes.
      
      The motivation for the change is that developers doing local work
      inside the submodule are likely to select a non-checkout-mode for
      updates so their local work is integrated with upstream work.
      Developers who are not doing local submodule work stick with
      checkout-mode updates so any apparently local work is blown away
      during updates.  For example, if upstream rolls back the remote branch
      or gitlinked commit to an earlier version, the checkout-mode developer
      wants their old submodule checkout to be rolled back as well, instead
      of getting a no-op merge/rebase with the rolled-back reference.
      
      By using the update mode to distinguish submodule developers from
      black-box submodule consumers, we can setup local branches for the
      developers who will want local branches, and stick with detached HEADs
      for the developers that don't care.
      
      Testing
      =======
      
      In t7406, just-cloned checkouts now update to the gitlinked hash with
      'reset', to preserve the local branch for situations where we're not
      on a detached HEAD.
      
      I also added explicit tests to t7406 for HEAD attachement after
      cloning updates, showing that it depends on their update mode:
      
      * Checkout-mode updates get detached HEADs
      * Everyone else gets a local branch, matching the configured
        submodule.<name>.branch and defaulting to master.
      
      The 'initial-setup' tag makes it easy to reset the superproject to a
      known state, as several earlier tests commit to submodules and commit
      the changed gitlinks to the superproject, but don't push the new
      submodule commits to the upstream subprojects.  This makes it
      impossible to checkout the current super master, because it references
      submodule commits that don't exist in the upstream subprojects.  For a
      specific example, see the tests that currently generate the
      'two_new_submodule_commits' commits.
      
      Documentation
      =============
      
      I updated the docs to describe the 'submodule update' modes in detail.
      The old documentation did not distinguish between cloning and
      non-cloning updates and lacked clarity on which operations would lead
      to detached HEADs, and which would not.  The new documentation
      addresses these issues while updating the docs to reflect the changes
      introduced by this commit's explicit local branch creation in
      module_clone.
      
      I also add '--checkout' to the usage summary and group the update-mode
      options into a single set.
      Signed-off-by: NW. Trevor King <wking@tremily.us>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      23d25e48
  17. 03 12月, 2013 1 次提交
    • J
      submodule: do not copy unknown update mode from .gitmodules · ac1fbbda
      Junio C Hamano 提交于
      When submodule.$name.update is given as hint from the upstream in
      the .gitmodules file, we used to blindly copy it to .git/config,
      unless there already is a value defined for the submodule.
      
      However, there is no reason to expect that the update mode hinted by
      the upstream is available in the version of Git the user is using,
      and a really custom "!cmd" prepared by an upstream person running on
      Linux may not even be available to a user on Windows.  It is simply
      irresponsible to copy the setting blindly and to attempt to use it
      during a later "submodule update" without validating it first.
      
      Just show the suggested value to the diagnostic output, and set the
      value to 'none' in the configuration, if it is not one of the ones
      that are known to be supported by this version of Git.
      Helped-by: NJens Lehmann <Jens.Lehmann@web.de>
      Helped-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ac1fbbda
  18. 12 11月, 2013 1 次提交
    • J
      submodule update: remove unnecessary orig_flags variable · 36141282
      Jens Lehmann 提交于
      cmd_update() in the submodule script tries to preserve the options given
      on the command line in the "orig_flags" variable to pass them on into the
      recursion when the '--recursive' option is given. But this isn't necessary
      because all the variables set by the options will be seen in the recursion
      too as that is achieved by executing "eval cmd_update".
      
      The same has already been done for cmd_status() in e15bec0e, so let's
      clean up cmd_update() likewise. Also add a test to make sure that a
      submodule name given on the command line is not passed into the recursion
      (which was the goal of adding the orig_flags variable in 98dbe63d).
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      36141282
  19. 18 9月, 2013 1 次提交
  20. 04 7月, 2013 2 次提交
  21. 18 6月, 2013 1 次提交
    • J
      submodule: drop the top-level requirement · 091a6eb0
      John Keeping 提交于
      Use the new rev-parse --prefix option to process all paths given to the
      submodule command, dropping the requirement that it be run from the
      top-level of the repository.
      
      Since the interpretation of a relative submodule URL depends on whether
      or not "remote.origin.url" is configured, explicitly block relative URLs
      in "git submodule add" when not at the top level of the working tree.
      Signed-off-by: NJohn Keeping <john@keeping.me.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      091a6eb0
  22. 17 3月, 2013 1 次提交
  23. 04 3月, 2013 1 次提交
  24. 05 1月, 2013 1 次提交
  25. 20 12月, 2012 1 次提交
    • W
      submodule update: add --remote for submodule's upstream changes · 06b1abb5
      W. Trevor King 提交于
      The current `update` command incorporates the superproject's gitlinked
      SHA-1 ($sha1) into the submodule HEAD ($subsha1).  Depending on the
      options you use, it may checkout $sha1, rebase the $subsha1 onto
      $sha1, or merge $sha1 into $subsha1.  This helps you keep up with
      changes in the upstream superproject.
      
      However, it's also useful to stay up to date with changes in the
      upstream subproject.  Previous workflows for incorporating such
      changes include the ungainly:
      
        $ git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) && git pull'
      
      With this patch, all of the useful functionality for incorporating
      superproject changes can be reused to incorporate upstream subproject
      updates.  When you specify --remote, the target $sha1 is replaced with
      a $sha1 of the submodule's origin/master tracking branch.  If you want
      to merge a different tracking branch, you can configure the
      `submodule.<name>.branch` option in `.gitmodules`.  You can override
      the `.gitmodules` configuration setting for a particular superproject
      by configuring the option in that superproject's default configuration
      (using the usual configuration hierarchy, e.g. `.git/config`,
      `~/.gitconfig`, etc.).
      
      Previous use of submodule.<name>.branch
      =======================================
      
      Because we're adding a new configuration option, it's a good idea to
      check if anyone else is already using the option.  The foreach-pull
      example above was described by Ævar in
      
        commit f030c96d
        Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
        Date:   Fri May 21 16:10:10 2010 +0000
      
          git-submodule foreach: Add $toplevel variable
      
      Gerrit uses the same interpretation for the setting, but because
      Gerrit has direct access to the subproject repositories, it updates
      the superproject repositories automatically when a subproject changes.
      Gerrit also accepts the special value '.', which it expands into the
      superproject's branch name.
      
      Although the --remote functionality is using `submodule.<name>.branch`
      slightly differently, the effect is the same.  The foreach-pull
      example uses the option to record the name of the local branch to
      checkout before pulls.  The tracking branch to be pulled is recorded
      in `.git/modules/<name>/config`, which was initialized by the module
      clone during `submodule add` or `submodule init`.  Because the branch
      name stored in `submodule.<name>.branch` was likely the same as the
      branch name used during the initial `submodule add`, the same branch
      will be pulled in each workflow.
      
      Implementation details
      ======================
      
      In order to ensure a current tracking branch state, `update --remote`
      fetches the submodule's remote repository before calculating the
      SHA-1.  However, I didn't change the logic guarding the existing fetch:
      
        if test -z "$nofetch"
        then
          # Run fetch only if $sha1 isn't present or it
          # is not reachable from a ref.
          (clear_local_git_env; cd "$path" &&
            ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
             test -z "$rev") || git-fetch)) ||
          die "$(eval_gettext "Unable to fetch in submodule path '\$path'")"
        fi
      
      There will not be a double-fetch, because the new $sha1 determined
      after the `--remote` triggered fetch should always exist in the
      repository.  If it doesn't, it's because some racy process removed it
      from the submodule's repository and we *should* be re-fetching.
      Signed-off-by: NW. Trevor King <wking@tremily.us>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      06b1abb5
  26. 01 10月, 2012 1 次提交
    • J
      submodule add: Fail when .git/modules/<name> already exists unless forced · 4b7c286e
      Jens Lehmann 提交于
      When adding a new submodule it can happen that .git/modules/<name> already
      contains a submodule repo, e.g. when a submodule is removed from the work
      tree and another submodule is added at the same path. But then the work
      tree of the submodule will be populated using the existing repository and
      not the one the user provided, which results in an incorrect work tree. On
      the other hand the user might reactivate a submodule removed earlier, then
      reusing that .git directory is the Right Thing to do.
      
      As git can't decide what is the case, error out and tell the user she
      should use either use a different name for the submodule with the "--name"
      option or can reuse the .git directory for the newly added submodule by
      providing the --force option (which only makes sense when the upstream
      matches, so the error message lists all remotes of .git/modules/<name>).
      
      In one test in t7406 the --force option had to be added to "git submodule
      add", as that test re-adds a formerly removed submodule.
      Reported-by: NJonathan Johnson <me@jondavidjohn.com>
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4b7c286e
  27. 25 8月, 2012 1 次提交
  28. 31 7月, 2012 1 次提交
    • J
      t7406: fix misleading "rev-parse --max-count=1 HEAD" · ad6a599c
      Junio C Hamano 提交于
      The test happened to use "rev-parse --max-count=1 HEAD" consistently
      to prepare the expected output and the actual output, so the
      comparison between them gave us a correct success/failure because
      both output had irrelevant "--max-count=1" in it.
      
      But that is not an excuse to keep it broken.  Replace it a more
      meaningful construct "rev-parse --verify HEAD".
      
      Noticed by Daniel Graña while working on his submodule tests.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ad6a599c
  29. 13 7月, 2012 1 次提交
    • J
      submodules: don't stumble over symbolic links when cloning recursively · 6eafa6d0
      Jens Lehmann 提交于
      Since 69c30517 (submodules: refactor computation of relative gitdir path)
      cloning a submodule recursively fails for nested submodules when a
      symbolic link is part of the path to the work tree of the superproject.
      
      This happens when module_clone() tries to find the relative paths between
      the work tree and the git dir. When a symbolic link in current $PWD points
      to a directory that is at a different level, then determining the number
      of "../" needed to traverse to the superproject's work tree leads to a
      wrong result.
      
      As there is no portable way to say "pwd -P", use cd_to_toplevel to remove
      the link from $PWD, which fixes this problem.
      
      A test for this issue has been added to t7406.
      Reported-by: NBob Halley <halley@play-bow.org>
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6eafa6d0
  30. 05 3月, 2012 1 次提交
    • J
      submodules: refactor computation of relative gitdir path · 69c30517
      Jens Lehmann 提交于
      In module_clone() the rel_gitdir variable was computed differently when
      "git rev-parse --git-dir" returned a relative path than when it returned
      an absolute path. This is not optimal, as different code paths are used
      depending on the return value of that command.
      
      Fix that by reusing the differing path components computed for setting the
      core.worktree config setting, which leaves a single code path for setting
      both instead of having three and makes the code much shorter.
      
      This also fixes the bug that in the computation of how many directories
      have to be traversed up to hit the root directory of the submodule the
      name of the submodule was used where the path should have been used. This
      lead to problems after renaming submodules into another directory level.
      
      Even though the "(cd $somewhere && pwd)" approach breaks the flexibility
      of symlinks, that is no issue here as we have to have one relative path
      pointing from the work tree to the gitdir and another pointing back, which
      will never work anyway when a symlink along one of those paths is changed
      because the directory it points to was moved.
      
      Also add a test moving a submodule into a deeper directory to catch any
      future breakage here and to document what has to be done when a submodule
      needs to be moved until git mv learns to do that. Simply moving it to the
      new location doesn't work, as the core.worktree and possibly the gitfile
      setting too will be wrong. So it has to be removed from filesystem and
      index, then the new location has to be added into the index and the
      .gitmodules file has to be updated. After that a git submodule update will
      check out the submodule at the new location.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      69c30517
  31. 25 1月, 2012 1 次提交
    • J
      submodule add: fix breakage when re-adding a deep submodule · 1017c1ab
      Jens Lehmann 提交于
      Since recently a submodule with name <name> has its git directory in the
      .git/modules/<name> directory of the superproject while the work tree
      contains a gitfile pointing there.
      
      When the same submodule is added on a branch where it wasn't present so
      far (it is not found in the .gitmodules file), the name is not initialized
      from the path as it should. This leads to a wrong path entered in the
      gitfile when the .git/modules/<name> directory is found, as this happily
      uses the - now empty - name. It then always points only a single directory
      up, even if we have a path deeper in the directory hierarchy.
      
      Fix that by initializing the name of the submodule early in module_clone()
      if module_name() returned an empty name and add a test to catch that bug.
      Reported-by: NJehan Bing <jehan@orb.com>
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1017c1ab
  32. 23 8月, 2011 1 次提交
    • F
      Move git-dir for submodules · 501770e1
      Fredrik Gustafsson 提交于
      Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of
      the superproject. This is a step towards being able to delete submodule
      directories without loosing the information from their .git directory
      as that is now stored outside the submodules work tree.
      
      This is done relying on the already existent .git-file functionality.
      When adding or updating a submodule whose git directory is found under
      $GIT_DIR/modules/[name_of_submodule], don't clone it again but simply
      point the .git-file to it and remove the now stale index file from it.
      The index will be recreated by the following checkout.
      
      This patch will not affect already cloned submodules at all.
      
      Tests that rely on .git being a directory have been fixed.
      Signed-off-by: NFredrik Gustafsson <iveqy@iveqy.com>
      Mentored-by: NJens Lehmann <Jens.Lehmann@web.de>
      Mentored-by: NHeiko Voigt <hvoigt@hvoigt.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      501770e1
  33. 12 8月, 2011 1 次提交
  34. 14 6月, 2011 1 次提交
    • F
      submodule update: continue when a checkout fails · 15ffb7cd
      Fredrik Gustafsson 提交于
      "git submodule update" stops at the first error and gives control
      back to the user. Only after the user fixes the problematic
      submodule and runs "git submodule update" again, the second error
      is found. And the user needs to repeat until all the problems are
      found and fixed one by one. This is tedious.
      
      Instead, the command can remember which submodules it had trouble with,
      continue updating the ones it can, and report which ones had errors at
      the end. The user can run "git submodule update", find all the ones that
      need minor fixing (e.g. working tree was dirty) to fix them in a single
      pass. Then another "git submodule update" can be run to update all.
      
      Note that the problematic submodules are skipped only when they are to
      be integrated with a safer value of submodule.<name>.update option,
      namely "checkout". Fixing a failure in a submodule that uses "rebase" or
      "merge" may need an involved conflict resolution by the user, and
      leaving too many submodules in states that need resolution would not
      reduce the mental burden on the user.
      Signed-off-by: NFredrik Gustafsson <iveqy@iveqy.com>
      Mentored-by: NJens Lehmann <Jens.Lehmann@web.de>
      Mentored-by: NHeiko Voigt <hvoigt@hvoigt.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      15ffb7cd
  35. 22 5月, 2011 1 次提交