<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/remote.c, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-05-08T15:37:26Z</updated>
<entry>
<title>Merge branch 'dr/ref-filter-push-track-fix'</title>
<updated>2019-05-08T15:37:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-05-08T15:37:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f560a4d1598106258f43d0d5cc04cae3e6aa93e2'/>
<id>urn:sha1:f560a4d1598106258f43d0d5cc04cae3e6aa93e2</id>
<content type='text'>
%(push:track) token used in the --format option to "git
for-each-ref" and friends was not showing the right branch, which
has been fixed.

* dr/ref-filter-push-track-fix:
  ref-filter: use correct branch for %(push:track)
</content>
</entry>
<entry>
<title>ref-filter: use correct branch for %(push:track)</title>
<updated>2019-04-18T00:17:41Z</updated>
<author>
<name>Damien Robert</name>
<email>damien.olivier.robert+git@gmail.com</email>
</author>
<published>2019-04-16T12:16:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c646d0934ec2056d816ad1ecc23f6620aba2c6da'/>
<id>urn:sha1:c646d0934ec2056d816ad1ecc23f6620aba2c6da</id>
<content type='text'>
In ref-filter.c, when processing the atom %(push:track), the
ahead/behind values are computed using `stat_tracking_info` which refers
to the upstream branch.

Fix that by introducing a new flag `for_push` in `stat_tracking_info`
in remote.c, which does the same thing but for the push branch.
Update the few callers of `stat_tracking_info` to handle this flag. This
ensure that whenever we use this function in the future, we are careful
to specify is this should apply to the upstream or the push branch.

This bug was not detected in t/t6300-for-each-ref.sh because in the test
for push:track, both the upstream and the push branches were behind by 1
from the local branch. Change the test so that the upstream branch is
behind by 1 while the push branch is ahead by 1. This allows us to test
that %(push:track) refers to the correct branch.

This changes the expected value of some following tests (by introducing
new references), so update them too.

Signed-off-by: Damien Robert &lt;damien.olivier.robert+git@gmail.com&gt;
Reviewed-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote.c: make singular free_ref() public</title>
<updated>2019-04-15T05:00:52Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-04-13T05:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1027186fdd3bb55b2149693550542e0647feb7a3'/>
<id>urn:sha1:1027186fdd3bb55b2149693550542e0647feb7a3</id>
<content type='text'>
We provide a free_refs() function to free a list, but there's no easy
way for a caller to free a single ref. Let's make our singular
free_ref() function public. Since its name is so similar to the
list-freeing free_refs(), and because both of those functions have the
same signature, it might be easy to accidentally use the wrong one.
Let's call the singular version the more verbose "free_one_ref()" to
distinguish it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/remote-insteadof-cleanup'</title>
<updated>2019-01-29T20:47:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-01-29T20:47:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=424a6658a7472f746ec97c7818605a4f208db63f'/>
<id>urn:sha1:424a6658a7472f746ec97c7818605a4f208db63f</id>
<content type='text'>
Code clean-up.

* jk/remote-insteadof-cleanup:
  remote: check config validity before creating rewrite struct
</content>
</entry>
<entry>
<title>remote: check config validity before creating rewrite struct</title>
<updated>2019-01-12T02:35:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-22T17:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=54e8c1121574fca675438ac0bbd7f6a375b92520'/>
<id>urn:sha1:54e8c1121574fca675438ac0bbd7f6a375b92520</id>
<content type='text'>
When parsing url.foo.insteadOf, we call make_rewrite() and only then
check to make sure the config value is a string (and return an error if
it isn't). This isn't quite a leak, because the struct we allocate is
part of a global array, but it does leave a funny half-finished struct.

In practice, it doesn't make much difference because we exit soon after
due to the config error anyway. But let's flip the order here to avoid
leaving a trap for somebody in the future.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/push-dwim-dst'</title>
<updated>2019-01-04T21:33:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-01-04T21:33:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0a84724bf8ed1240b61e2401aec8a6cab93111b1'/>
<id>urn:sha1:0a84724bf8ed1240b61e2401aec8a6cab93111b1</id>
<content type='text'>
"git push $there $src:$dst" rejects when $dst is not a fully
qualified refname and not clear what the end user meant.  The
codepath has been taught to give a clearer error message, and also
guess where the push should go by taking the type of the pushed
object into account (e.g. a tag object would want to go under
refs/tags/).

* ab/push-dwim-dst:
  push doc: document the DWYM behavior pushing to unqualified &lt;dst&gt;
  push: test that &lt;src&gt; doesn't DWYM if &lt;dst&gt; is unqualified
  push: add an advice on unqualified &lt;dst&gt; push
  push: move unqualified refname error into a function
  push: improve the error shown on unqualified &lt;dst&gt; push
  i18n: remote.c: mark error(...) messages for translation
  remote.c: add braces in anticipation of a follow-up change
</content>
</entry>
<entry>
<title>Merge branch 'nd/i18n'</title>
<updated>2019-01-04T21:33:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-01-04T21:33:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3813a89faee3ecb111aa206f68b46618ec853e4e'/>
<id>urn:sha1:3813a89faee3ecb111aa206f68b46618ec853e4e</id>
<content type='text'>
More _("i18n") markings.

* nd/i18n:
  fsck: mark strings for translation
  fsck: reduce word legos to help i18n
  parse-options.c: mark more strings for translation
  parse-options.c: turn some die() to BUG()
  parse-options: replace opterror() with optname()
  repack: mark more strings for translation
  remote.c: mark messages for translation
  remote.c: turn some error() or die() to BUG()
  reflog: mark strings for translation
  read-cache.c: add missing colon separators
  read-cache.c: mark more strings for translation
  read-cache.c: turn die("internal error") to BUG()
  attr.c: mark more string for translation
  archive.c: mark more strings for translation
  alias.c: mark split_cmdline_strerror() strings for translation
  git.c: mark more strings for translation
</content>
</entry>
<entry>
<title>push: add an advice on unqualified &lt;dst&gt; push</title>
<updated>2018-11-14T06:27:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-11-13T19:52:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dd8dd300c636bf0a1352379aed88d9434a6ac7bb'/>
<id>urn:sha1:dd8dd300c636bf0a1352379aed88d9434a6ac7bb</id>
<content type='text'>
Add an advice to the recently improved error message added in
f8aae12034 ("push: allow unqualified dest refspecs to DWIM",
2008-04-23).

Now with advice.pushUnqualifiedRefName=true (on by default) we show a
hint about how to proceed:

    $ ./git-push avar v2.19.0^{commit}:newbranch -n
    error: The destination you provided is not a full refname (i.e.,
    starting with "refs/"). We tried to guess what you meant by:

    - Looking for a ref that matches 'newbranch' on the remote side.
    - Checking if the &lt;src&gt; being pushed ('v2.19.0^{commit}')
      is a ref in "refs/{heads,tags}/". If so we add a corresponding
      refs/{heads,tags}/ prefix on the remote side.

    Neither worked, so we gave up. You must fully qualify the ref.
    hint: The &lt;src&gt; part of the refspec is a commit object.
    hint: Did you mean to create a new branch by pushing to
    hint: 'v2.19.0^{commit}:refs/heads/newbranch'?
    error: failed to push some refs to 'git@github.com:avar/git.git'

When trying to push a tag, tree or a blob we suggest that perhaps the
user meant to push them to refs/tags/ instead.

The if/else duplication for all of OBJ_{COMMIT,TAG,TREE,BLOB} is
unfortunate, but is required to correctly mark the messages for
translation. See the discussion in
&lt;87r2gxebsi.fsf@evledraar.gmail.com&gt; about that.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>push: move unqualified refname error into a function</title>
<updated>2018-11-14T06:27:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-11-13T19:52:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=04d17287a0e0161e5a0accd8ab781135bd672c98'/>
<id>urn:sha1:04d17287a0e0161e5a0accd8ab781135bd672c98</id>
<content type='text'>
A follow-up change will extend this error message with the advice
facility. Doing so would make the indentation too deeply nested for
comfort. So let's split this into a helper function.

There's no changes to the wording here. Just code moving &amp;
re-indentation, and re-flowing the "TRANSLATORS" comment.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>push: improve the error shown on unqualified &lt;dst&gt; push</title>
<updated>2018-11-14T06:27:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-11-13T19:52:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c83cca3f74f3fcc28b9742a92720bea8a1c3915c'/>
<id>urn:sha1:c83cca3f74f3fcc28b9742a92720bea8a1c3915c</id>
<content type='text'>
Improve the error message added in f8aae12034 ("push: allow
unqualified dest refspecs to DWIM", 2008-04-23), which before this
change looks like this:

    $ git push avar v2.19.0^{commit}:newbranch -n
    error: unable to push to unqualified destination: newbranch
    The destination refspec neither matches an existing ref on the remote nor
    begins with refs/, and we are unable to guess a prefix based on the source ref.
    error: failed to push some refs to 'git@github.com:avar/git.git'

This message needed to be read very carefully to spot how to fix the
error, i.e. to push to refs/heads/newbranch. Now the message will look
like this instead:

    $ ./git-push avar v2.19.0^{commit}:newbranch -n
    error: The destination you provided is not a full refname (i.e.,
    starting with "refs/"). We tried to guess what you meant by:

    - Looking for a ref that matches 'newbranch' on the remote side.
    - Checking if the &lt;src&gt; being pushed ('v2.19.0^{commit}')
      is a ref in "refs/{heads,tags}/". If so we add a corresponding
      refs/{heads,tags}/ prefix on the remote side.

    Neither worked, so we gave up. You must fully qualify the ref.
    error: failed to push some refs to 'git@github.com:avar/git.git'

This improvement is the result of on-list discussion in [1] and [2],
as well as my own fixes / reformatting / phrasing on top.

The suggestion by Jeff on-list was to make that second bullet point
"Looking at the refname of the local source.". The version being added
here is more verbose, but also more accurate. saying "local source"
could refer to any ref in the local refstore, including something in
refs/remotes/*. A later change will teach guess_ref() to infer a ref
type from remote-tracking refs, so let's not confuse the two.

While I'm at it, add a "TRANSLATORS" comment since the message has
gotten more complex and it's not as clear what the two %s's refer to.

1. https://public-inbox.org/git/20181010205505.GB12949@sigill.intra.peff.net/
2. https://public-inbox.org/git/xmqqbm81lb7c.fsf@gitster-ct.c.googlers.com/

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
