1. 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
  2. 10 1月, 2017 1 次提交
    • S
      pathspec: give better message for submodule related pathspec error · 2d81c48f
      Stefan Beller 提交于
      Every once in a while someone complains to the mailing list to have
      run into this weird assertion[1]. The usual response from the mailing
      list is link to old discussions[2], and acknowledging the problem
      stating it is known.
      
      This patch accomplishes two things:
      
        1. Switch assert() to die("BUG") to give a more readable message.
      
        2. Take one of the cases where we hit a BUG and turn it into a normal
           "there was something wrong with the input" message.
      
           This assertion triggered for cases where there wasn't a programming
           bug, but just bogus input. In particular, if the user asks for a
           pathspec that is inside a submodule, we shouldn't assert() or
           die("BUG"); we should tell the user their request is bogus.
      
           The only reason we did not check for it, is the expensive nature
           of such a check, so callers avoid setting the flag
           PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE. However when we die due
           to bogus input, the expense of CPU cycles spent outweighs the user
           wondering what went wrong, so run that check unconditionally before
           dying with a more generic error message.
      
      Note: There is a case (e.g. "git -C submodule add .") in which we call
      strip_submodule_slash_expensive, as git-add requests it via the flag
      PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE, but the assert used to
      trigger nevertheless, because the flag PATHSPEC_LITERAL was not set,
      such that we executed
      
      	if (item->nowildcard_len < prefixlen)
      		item->nowildcard_len = prefixlen;
      
      and prefixlen was not adapted (e.g. it was computed from "submodule/")
      So in the die_inside_submodule_path function we also need handle paths,
      that were stripped before, i.e. are the exact submodule path. This
      is why the conditions in die_inside_submodule_path are slightly
      different than in strip_submodule_slash_expensive.
      
      [1] https://www.google.com/search?q=item-%3Enowildcard_len
      [2] http://git.661346.n2.nabble.com/assert-failed-in-submodule-edge-case-td7628687.html
          https://www.spinics.net/lists/git/msg249473.htmlHelped-by: NJeff King <peff@peff.net>
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2d81c48f