{"thread":{"id":"57981","subject":"Should `git remote show` display excluded branches as to-be-fetched?","startedAt":"2022-06-10T12:59:24Z","lastAt":"2022-06-25T16:06:28Z","messageCount":6,"participants":["Pavel Rappo","Junio C Hamano","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"457019","messageId":"CAChcVumTgNqRTt=EtThXiw9ga=W9WC-uS0XOkz7T+TbtGKeU+w@mail.gmail.com","threadId":"57981","inReplyTo":null,"subject":"Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Pavel Rappo","fromEmail":"pavel.rappo@gmail.com","sentAt":"2022-06-10T12:59:03Z","receivedAt":"2022-06-10T12:59:24Z","isPatch":false,"sender":{"key":"pavel.rappo@gmail.com","avatar":null},"body":"Here's a console session:\n\n  % git config --get-all remote.jdk19.fetch\n  +refs/heads/*:refs/remotes/jdk19/*\n  ^refs/heads/pr/*\n\n  % git remote show jdk19\n\n  * remote jdk19\n    Fetch URL: git@github.com:openjdk/jdk19.git\n    Push  URL: git@github.com:openjdk/jdk19.git\n    HEAD branch: master\n    Remote branches:\n      master tracked\n      pr/1   new (next fetch will store in remotes/jdk19)\n      pr/2   new (next fetch will store in remotes/jdk19)\n      pr/3   new (next fetch will store in remotes/jdk19)\n    Local ref configured for 'git push':\n      master pushes to master (fast-forwardable)\n\nI would naively expect the pr/1, pr/2, and pr/3 branches to be either:\n\n- not displayed, or better\n- displayed with a hint that they won't be fetched (since they match a\n_negative_ refspec, which is the second line in the `git config`\noutput above)\n\nThanks,\n-Pavel\n"},{"id":"457035","messageId":"xmqq1qvwfntm.fsf@gitster.g","threadId":"57981","inReplyTo":"CAChcVumTgNqRTt=EtThXiw9ga=W9WC-uS0XOkz7T+TbtGKeU+w@mail.gmail.com","subject":"Re: Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-06-10T17:08:53Z","receivedAt":"2022-06-10T17:08:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Rappo <pavel.rappo@gmail.com> writes:\n\n> Here's a console session:\n>\n>   % git config --get-all remote.jdk19.fetch\n>   +refs/heads/*:refs/remotes/jdk19/*\n>   ^refs/heads/pr/*\n\nThanks\n\n\"Negative refspecs\" is relatively new feature introduced in c0192df6\n(refspec: add support for negative refspecs, 2020-09-30), so it\nwould not be so surprising if it still had some surprising behaviour\n;-)\n\nJacob, care to take a look?\n\n>   % git remote show jdk19\n>\n>   * remote jdk19\n>     Fetch URL: git@github.com:openjdk/jdk19.git\n>     Push  URL: git@github.com:openjdk/jdk19.git\n>     HEAD branch: master\n>     Remote branches:\n>       master tracked\n>       pr/1   new (next fetch will store in remotes/jdk19)\n>       pr/2   new (next fetch will store in remotes/jdk19)\n>       pr/3   new (next fetch will store in remotes/jdk19)\n>     Local ref configured for 'git push':\n>       master pushes to master (fast-forwardable)\n>\n> I would naively expect the pr/1, pr/2, and pr/3 branches to be either:\n>\n> - not displayed, or better\n> - displayed with a hint that they won't be fetched (since they match a\n> _negative_ refspec, which is the second line in the `git config`\n> output above)\n>\n> Thanks,\n> -Pavel\n"},{"id":"457077","messageId":"CA+P7+xqfthRZkn76FxG8xuGU670k0zyCCTe0d26_pe1HVTkXpQ@mail.gmail.com","threadId":"57981","inReplyTo":"xmqq1qvwfntm.fsf@gitster.g","subject":"Re: Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2022-06-12T06:36:00Z","receivedAt":"2022-06-12T06:41:05Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Jun 10, 2022 at 10:08 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Pavel Rappo <pavel.rappo@gmail.com> writes:\n>\n> > Here's a console session:\n> >\n> >   % git config --get-all remote.jdk19.fetch\n> >   +refs/heads/*:refs/remotes/jdk19/*\n> >   ^refs/heads/pr/*\n>\n> Thanks\n>\n> \"Negative refspecs\" is relatively new feature introduced in c0192df6\n> (refspec: add support for negative refspecs, 2020-09-30), so it\n> would not be so surprising if it still had some surprising behaviour\n> ;-)\n>\n> Jacob, care to take a look?\n>\n> >   % git remote show jdk19\n> >\n> >   * remote jdk19\n> >     Fetch URL: git@github.com:openjdk/jdk19.git\n> >     Push  URL: git@github.com:openjdk/jdk19.git\n> >     HEAD branch: master\n> >     Remote branches:\n> >       master tracked\n> >       pr/1   new (next fetch will store in remotes/jdk19)\n> >       pr/2   new (next fetch will store in remotes/jdk19)\n> >       pr/3   new (next fetch will store in remotes/jdk19)\n> >     Local ref configured for 'git push':\n> >       master pushes to master (fast-forwardable)\n> >\n> > I would naively expect the pr/1, pr/2, and pr/3 branches to be either:\n> >\n> > - not displayed, or better\n> > - displayed with a hint that they won't be fetched (since they match a\n> > _negative_ refspec, which is the second line in the `git config`\n> > output above)\n> >\n> > Thanks,\n> > -Pavel\n\nThis is almost certainly an oversight in that the particular code path\ndoes not process negative refspecs. I can hopefully take a closer look\nat this next week.\n"},{"id":"457152","messageId":"CA+P7+xrfkApv_r_YQqOt-LiaC=Ctb2px0UuaSwqU_ua_qmH4OA@mail.gmail.com","threadId":"57981","inReplyTo":"xmqq1qvwfntm.fsf@gitster.g","subject":"Re: Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2022-06-13T23:20:28Z","receivedAt":"2022-06-13T23:20:46Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Jun 10, 2022 at 10:08 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Pavel Rappo <pavel.rappo@gmail.com> writes:\n>\n> > Here's a console session:\n> >\n> >   % git config --get-all remote.jdk19.fetch\n> >   +refs/heads/*:refs/remotes/jdk19/*\n> >   ^refs/heads/pr/*\n>\n> Thanks\n>\n> \"Negative refspecs\" is relatively new feature introduced in c0192df6\n> (refspec: add support for negative refspecs, 2020-09-30), so it\n> would not be so surprising if it still had some surprising behaviour\n> ;-)\n>\n> Jacob, care to take a look?\n>\n\nOk, so this looks like its caused by the fact that get_fetch_map in\nbuiltin/remote.c ignores all negative refspecs. I think what we really\nwant to do is check if a given ref matches any negative ref and then\nmaybe move it from the new listing into a separate skipped listing.\n\nFiguring out the best way to do this is a little bit of a challenge.\nIt looks like maybe we need to use one of the functions in remote.c\njust after the get_fetch_map call in get_ref_states. But exactly what\nhas so far eluded me after a bit of digging.\n\nI'm still looking at this, but help would be appreciated if anyone\nelse has a suggestion.\n\nThanks,\nJake\n\n> >   % git remote show jdk19\n> >\n> >   * remote jdk19\n> >     Fetch URL: git@github.com:openjdk/jdk19.git\n> >     Push  URL: git@github.com:openjdk/jdk19.git\n> >     HEAD branch: master\n> >     Remote branches:\n> >       master tracked\n> >       pr/1   new (next fetch will store in remotes/jdk19)\n> >       pr/2   new (next fetch will store in remotes/jdk19)\n> >       pr/3   new (next fetch will store in remotes/jdk19)\n> >     Local ref configured for 'git push':\n> >       master pushes to master (fast-forwardable)\n> >\n> > I would naively expect the pr/1, pr/2, and pr/3 branches to be either:\n> >\n> > - not displayed, or better\n> > - displayed with a hint that they won't be fetched (since they match a\n> > _negative_ refspec, which is the second line in the `git config`\n> > output above)\n> >\n> > Thanks,\n> > -Pavel\n"},{"id":"457158","messageId":"CA+P7+xrwapFU6z9P7HOKmcGUVFiAn20PVahGG=SC=KSDTv0hNw@mail.gmail.com","threadId":"57981","inReplyTo":"CA+P7+xrfkApv_r_YQqOt-LiaC=Ctb2px0UuaSwqU_ua_qmH4OA@mail.gmail.com","subject":"Re: Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2022-06-14T00:34:23Z","receivedAt":"2022-06-14T00:34:37Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Mon, Jun 13, 2022 at 4:20 PM Jacob Keller <jacob.keller@gmail.com> wrote:\n>\n> On Fri, Jun 10, 2022 at 10:08 AM Junio C Hamano <gitster@pobox.com> wrote:\n> >\n> > Pavel Rappo <pavel.rappo@gmail.com> writes:\n> >\n> > > Here's a console session:\n> > >\n> > >   % git config --get-all remote.jdk19.fetch\n> > >   +refs/heads/*:refs/remotes/jdk19/*\n> > >   ^refs/heads/pr/*\n> >\n> > Thanks\n> >\n> > \"Negative refspecs\" is relatively new feature introduced in c0192df6\n> > (refspec: add support for negative refspecs, 2020-09-30), so it\n> > would not be so surprising if it still had some surprising behaviour\n> > ;-)\n> >\n> > Jacob, care to take a look?\n> >\n>\n> Ok, so this looks like its caused by the fact that get_fetch_map in\n> builtin/remote.c ignores all negative refspecs. I think what we really\n> want to do is check if a given ref matches any negative ref and then\n> maybe move it from the new listing into a separate skipped listing.\n>\n> Figuring out the best way to do this is a little bit of a challenge.\n> It looks like maybe we need to use one of the functions in remote.c\n> just after the get_fetch_map call in get_ref_states. But exactly what\n> has so far eluded me after a bit of digging.\n>\n> I'm still looking at this, but help would be appreciated if anyone\n> else has a suggestion.\n>\n> Thanks,\n> Jake\n>\n> > >   % git remote show jdk19\n> > >\n> > >   * remote jdk19\n> > >     Fetch URL: git@github.com:openjdk/jdk19.git\n> > >     Push  URL: git@github.com:openjdk/jdk19.git\n> > >     HEAD branch: master\n> > >     Remote branches:\n> > >       master tracked\n> > >       pr/1   new (next fetch will store in remotes/jdk19)\n> > >       pr/2   new (next fetch will store in remotes/jdk19)\n> > >       pr/3   new (next fetch will store in remotes/jdk19)\n> > >     Local ref configured for 'git push':\n> > >       master pushes to master (fast-forwardable)\n> > >\n> > > I would naively expect the pr/1, pr/2, and pr/3 branches to be either:\n> > >\n> > > - not displayed, or better\n> > > - displayed with a hint that they won't be fetched (since they match a\n> > > _negative_ refspec, which is the second line in the `git config`\n> > > output above)\n> > >\n> > > Thanks,\n> > > -Pavel\n\nI found a working solution, but I don't really like the\nimplementation, so perhaps someone with more knowledge of the struct\nrefspec, struct refspec_item, etc would help me figure out if I am\ndoing it in a good way. I just posted it.\n\nThanks,\nJake\n"},{"id":"457869","messageId":"CAChcVu=HRECdUCjgNywiG=o+S8DvAtqYd7TjzrvFiZZq80Xaog@mail.gmail.com","threadId":"57981","inReplyTo":"CA+P7+xrwapFU6z9P7HOKmcGUVFiAn20PVahGG=SC=KSDTv0hNw@mail.gmail.com","subject":"Re: Should `git remote show` display excluded branches as to-be-fetched?","fromName":"Pavel Rappo","fromEmail":"pavel.rappo@gmail.com","sentAt":"2022-06-25T16:06:12Z","receivedAt":"2022-06-25T16:06:28Z","isPatch":false,"sender":{"key":"pavel.rappo@gmail.com","avatar":null},"body":"On Tue, Jun 14, 2022 at 1:34 AM Jacob Keller <jacob.keller@gmail.com> wrote:\n\n> I found a working solution, but I don't really like the\n> implementation, so perhaps someone with more knowledge of the struct\n> refspec, struct refspec_item, etc would help me figure out if I am\n> doing it in a good way. I just posted it.\n\nThanks, Jake. Does Git project have an issue tracker we could enter\nthis bug into?\n"}]}