1. 09 4月, 2018 1 次提交
  2. 08 11月, 2017 1 次提交
    • J
      for-each-ref: let upstream/push report the remote ref name · 9700fae5
      J Wyman 提交于
      There are times when scripts want to know not only the name of the
      push branch on the remote, but also the name of the branch as known
      by the remote repository.
      
      An example of this is when a tool wants to push to the very same branch
      from which it would pull automatically, i.e. the `<remote>` and the `<to>`
      in `git push <remote> <from>:<to>` would be provided by
      `%(upstream:remotename)` and `%(upstream:remoteref)`, respectively.
      
      This patch offers the new suffix :remoteref for the `upstream` and `push`
      atoms, allowing to show exactly that. Example:
      
      	$ cat .git/config
      	...
      	[remote "origin"]
      		url = https://where.do.we.come/from
      		fetch = refs/heads/*:refs/remote/origin/*
      	[branch "master"]
      		remote = origin
      		merge = refs/heads/master
      	[branch "develop/with/topics"]
      		remote = origin
      		merge = refs/heads/develop/with/topics
      	...
      
      	$ git for-each-ref \
      		--format='%(push) %(push:remoteref)' \
      		refs/heads
      	refs/remotes/origin/master refs/heads/master
      	refs/remotes/origin/develop/with/topics refs/heads/develop/with/topics
      Signed-off-by: NJ Wyman <jwyman@microsoft.com>
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9700fae5
  3. 10 10月, 2017 1 次提交
    • J
      for-each-ref: let upstream/push optionally report the remote name · cc72385f
      Johannes Schindelin 提交于
      There are times when e.g. scripts want to know not only the name of the
      upstream branch on the remote repository, but also the name of the
      remote.
      
      This patch offers the new suffix :remotename for the upstream and for
      the push atoms, allowing to show exactly that. Example:
      
      	$ cat .git/config
      	...
      	[remote "origin"]
      		url = https://where.do.we.come/from
      		fetch = refs/heads/*:refs/remote/origin/*
      	[remote "hello-world"]
      		url = https://hello.world/git
      		fetch = refs/heads/*:refs/remote/origin/*
      		pushURL = hello.world:git
      		push = refs/heads/*:refs/heads/*
      	[branch "master"]
      		remote = origin
      		pushRemote = hello-world
      	...
      
      	$ git for-each-ref \
      	  --format='%(upstream) %(upstream:remotename) %(push:remotename)' \
      	  refs/heads/master
      	refs/remotes/origin/master origin hello-world
      
      The implementation chooses *not* to DWIM the push remote if no explicit
      push remote was configured; The reason is that it is possible to DWIM this
      by using
      
      	%(if)%(push:remotename)%(then)
      		%(push:remotename)
      	%(else)
      		%(upstream:remotename)
      	%(end)
      
      while it would be impossible to "un-DWIM" the information in case the
      caller is really only interested in explicit push remotes.
      
      While `:remote` would be shorter, it would also be a bit more ambiguous,
      and it would also shut the door e.g. for `:remoteref` (which would
      obviously refer to the corresponding ref in the remote repository).
      
      Note: the dashless, non-CamelCased form `:remotename` follows the
      example of the `:trackshort` example.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cc72385f
  4. 04 10月, 2017 1 次提交
    • J
      provide --color option for all ref-filter users · 0c88bf50
      Jeff King 提交于
      When ref-filter learned about want_color() in 11b087ad
      (ref-filter: consult want_color() before emitting colors,
      2017-07-13), it became useful to be able to turn colors off
      and on for specific commands. For git-branch, you can do so
      with --color/--no-color.
      
      But for git-for-each-ref and git-tag, the other users of
      ref-filter, you have no option except to tweak the
      "color.ui" config setting. Let's give both of these commands
      the usual color command-line options.
      
      This is a bit more obvious as a method for overriding the
      config. And it also prepares us for the behavior of "always"
      changing (so that we are still left with a way of forcing
      color when our output goes to a non-terminal).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0c88bf50
  5. 02 10月, 2017 3 次提交
  6. 12 9月, 2017 2 次提交
  7. 19 8月, 2017 2 次提交
  8. 14 7月, 2017 1 次提交
    • J
      docs/for-each-ref: update pointer to color syntax · 5d3d0681
      Jeff King 提交于
      The documentation for the %(color) placeholder refers to the
      color.branch.* config for more details. But those details
      moved to their own section in b92c1a28
      (Documentation/config.txt: describe 'color' value type in
      the "Values" section, 2015-03-03).  Let's update our
      pointer. We can steal the text from 30cfe72d (pretty: fix
      document link for color specification, 2016-10-11), which
      fixed the same problem in a different place.
      
      While we're at it, let's give an example, which makes the
      syntax much more clear than just the text.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5d3d0681
  9. 25 3月, 2017 1 次提交
    • Æ
      ref-filter: add --no-contains option to tag/branch/for-each-ref · ac3f5a34
      Ævar Arnfjörð Bjarmason 提交于
      Change the tag, branch & for-each-ref commands to have a --no-contains
      option in addition to their longstanding --contains options.
      
      This allows for finding the last-good rollout tag given a known-bad
      <commit>. Given a hypothetically bad commit cf5c7253, the git
      version to revert to can be found with this hacky two-liner:
      
          (git tag -l 'v[0-9]*'; git tag -l --contains cf5c7253 'v[0-9]*') |
              sort | uniq -c | grep -E '^ *1 ' | awk '{print $2}' | tail -n 10
      
      With this new --no-contains option the same can be achieved with:
      
          git tag -l --no-contains cf5c7253 'v[0-9]*' | sort | tail -n 10
      
      As the filtering machinery is shared between the tag, branch &
      for-each-ref commands, implement this for those commands too. A
      practical use for this with "branch" is e.g. finding branches which
      were branched off between v2.8.0 and v2.10.0:
      
          git branch --contains v2.8.0 --no-contains v2.10.0
      
      The "describe" command also has a --contains option, but its semantics
      are unrelated to what tag/branch/for-each-ref use --contains for. A
      --no-contains option for "describe" wouldn't make any sense, other
      than being exactly equivalent to not supplying --contains at all,
      which would be confusing at best.
      
      Add a --without option to "tag" as an alias for --no-contains, for
      consistency with --with and --contains.  The --with option is
      undocumented, and possibly the only user of it is
      Junio (<xmqqefy71iej.fsf@gitster.mtv.corp.google.com>). But it's
      trivial to support, so let's do that.
      
      The additions to the the test suite are inverse copies of the
      corresponding --contains tests. With this change --no-contains for
      tag, branch & for-each-ref is just as well tested as the existing
      --contains option.
      
      In addition to those tests, add a test for "tag" which asserts that
      --no-contains won't find tree/blob tags, which is slightly
      unintuitive, but consistent with how --contains works & is documented.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ac3f5a34
  10. 22 3月, 2017 1 次提交
  11. 08 2月, 2017 1 次提交
    • J
      ref-filter: resurrect "strip" as a synonym to "lstrip" · 44a6b6ce
      Junio C Hamano 提交于
      We forgot that "strip" was introduced at 0571979b ("tag: do not
      show ambiguous tag names as "tags/foo"", 2016-01-25) as part of Git
      2.8 (and 2.7.1) when we started calling this "lstrip" to make it
      easier to explain the new "rstrip" operation.
      
      We shouldn't have renamed the existing one; "lstrip" should have
      been a new synonym that means the same thing as "strip".  Scripts
      in the wild are surely using the original form already.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      44a6b6ce
  12. 01 2月, 2017 2 次提交
  13. 11 1月, 2017 9 次提交
  14. 12 12月, 2016 1 次提交
  15. 06 12月, 2016 1 次提交
    • N
      tag, branch, for-each-ref: add --ignore-case for sorting and filtering · 3bb16a8b
      Nguyễn Thái Ngọc Duy 提交于
      This options makes sorting ignore case, which is great when you have
      branches named bug-12-do-something, Bug-12-do-some-more and
      BUG-12-do-what and want to group them together. Sorting externally may
      not be an option because we lose coloring and column layout from
      git-branch and git-tag.
      
      The same could be said for filtering, but it's probably less important
      because you can always go with the ugly pattern [bB][uU][gG]-* if you're
      desperate.
      
      You can't have case-sensitive filtering and case-insensitive sorting (or
      the other way around) with this though. For branch and tag, that should
      be no problem. for-each-ref, as a plumbing, might want finer control.
      But we can always add --{filter,sort}-ignore-case when there is a need
      for it.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3bb16a8b
  16. 28 6月, 2016 1 次提交
  17. 10 5月, 2016 1 次提交
    • J
      Documentation: fix linkgit references · 1cca17df
      Junio C Hamano 提交于
      There are a handful of incorrect "linkgit:<page>[<section>]"
      instances in our documentation set.
      
       * Some have an extra colon after "linkgit:"; fix them by removing
         the extra colon;
      
       * Some refer to a page outside the Git suite, namely curl(1); fix
         them by using the `curl(1)` that already appears on the same page
         for the same purpose of referring the readers to its manual page.
      
       * Some spell the name of the page incorrectly, e.g. "rev-list" when
         they mean "git-rev-list"; fix them.
      
       * Some list the manual section incorrectly; fix them to make sure
         they match what is at the top of the target of the link.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1cca17df
  18. 31 3月, 2016 1 次提交
  19. 18 2月, 2016 1 次提交
  20. 27 1月, 2016 1 次提交
    • J
      tag: do not show ambiguous tag names as "tags/foo" · 0571979b
      Jeff King 提交于
      Since b7cc53e9 (tag.c: use 'ref-filter' APIs, 2015-07-11),
      git-tag has started showing tags with ambiguous names (i.e.,
      when both "heads/foo" and "tags/foo" exists) as "tags/foo"
      instead of just "foo". This is both:
      
        - pointless; the output of "git tag" includes only
          refs/tags, so we know that "foo" means the one in
          "refs/tags".
      
      and
      
        - ambiguous; in the original output, we know that the line
          "foo" means that "refs/tags/foo" exists. In the new
          output, it is unclear whether we mean "refs/tags/foo" or
          "refs/tags/tags/foo".
      
      The reason this happens is that commit b7cc53e9 switched
      git-tag to use ref-filter's "%(refname:short)" output
      formatting, which was adapted from for-each-ref. This more
      general code does not know that we care only about tags, and
      uses shorten_unambiguous_ref to get the short-name. We need
      to tell it that we care only about "refs/tags/", and it
      should shorten with respect to that value.
      
      In theory, the ref-filter code could figure this out by us
      passing FILTER_REFS_TAGS. But there are two complications
      there:
      
        1. The handling of refname:short is deep in formatting
           code that does not even have our ref_filter struct, let
           alone the arguments to the filter_ref struct.
      
        2. In git v2.7.0, we expose the formatting language to the
           user. If we follow this path, it will mean that
           "%(refname:short)" behaves differently for "tag" versus
           "for-each-ref" (including "for-each-ref refs/tags/"),
           which can lead to confusion.
      
      Instead, let's add a new modifier to the formatting
      language, "strip", to remove a specific set of prefix
      components. This fixes "git tag", and lets users invoke the
      same behavior from their own custom formats (for "tag" or
      "for-each-ref") while leaving ":short" with its same
      consistent meaning in all places.
      
      We introduce a test in t7004 for "git tag", which fails
      without this patch. We also add a similar test in t3203 for
      "git branch", which does not actually fail. But since it is
      likely that "branch" will eventually use the same formatting
      code, the test helps defend against future regressions.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0571979b
  21. 06 1月, 2016 1 次提交
  22. 18 9月, 2015 3 次提交
  23. 04 9月, 2015 1 次提交
  24. 04 8月, 2015 2 次提交