git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git tag output order is incorrect (IMHO)
@ 2013-07-18 15:27 Rahul Bansal
  2013-07-18 15:51 ` Duy Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Rahul Bansal @ 2013-07-18 15:27 UTC (permalink / raw)
  To: git

I am posting here first time, so please excuse me if this is not right place to send something like this.

Please check - http://stackoverflow.com/questions/6091306/can-i-make-git-print-x-y-z-style-tag-names-in-a-sensible-order

And also - https://github.com/gitlabhq/gitlabhq/issues/4565

IMHO "git tag" is expected to show tag-list ordered by versions. 

It may be case, that people do not follow same version numbering convention. Most people after x.9.x increment major version (that is why they may not be affected because of this)

Another option like "git tag --date-asc" can be added which will print tags by creation date. (As long as people do not create backdated tag, this will work).

Thanks,
-Rahul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:27 Git tag output order is incorrect (IMHO) Rahul Bansal
@ 2013-07-18 15:51 ` Duy Nguyen
  2013-07-18 15:56   ` Duy Nguyen
  2013-07-18 15:57   ` Rahul Bansal
  2013-07-18 17:42 ` Andreas Schwab
  2013-09-08 22:49 ` Felipe Contreras
  2 siblings, 2 replies; 16+ messages in thread
From: Duy Nguyen @ 2013-07-18 15:51 UTC (permalink / raw)
  To: Rahul Bansal; +Cc: Git Mailing List

On Thu, Jul 18, 2013 at 10:27 PM, Rahul Bansal <rahul.bansal@rtcamp.com> wrote:
> I am posting here first time, so please excuse me if this is not right place to send something like this.
>
> Please check - http://stackoverflow.com/questions/6091306/can-i-make-git-print-x-y-z-style-tag-names-in-a-sensible-order
>
> And also - https://github.com/gitlabhq/gitlabhq/issues/4565
>
> IMHO "git tag" is expected to show tag-list ordered by versions.
>
> It may be case, that people do not follow same version numbering convention. Most people after x.9.x increment major version (that is why they may not be affected because of this)
>
> Another option like "git tag --date-asc" can be added which will print tags by creation date. (As long as people do not create backdated tag, this will work).

Try

git for-each-ref --sort=committerdate --format='%(refname:short)' refs/tags
--
Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:51 ` Duy Nguyen
@ 2013-07-18 15:56   ` Duy Nguyen
  2013-07-18 15:58     ` Rahul Bansal
  2013-07-18 15:57   ` Rahul Bansal
  1 sibling, 1 reply; 16+ messages in thread
From: Duy Nguyen @ 2013-07-18 15:56 UTC (permalink / raw)
  To: Rahul Bansal; +Cc: Git Mailing List

On Thu, Jul 18, 2013 at 10:51 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> Try
>
> git for-each-ref --sort=committerdate --format='%(refname:short)' refs/tags

And I wondered why it did not seem right. Use this one instead

git for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags

make it --sort=-taggerdate to reverse sort order.
--
Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:51 ` Duy Nguyen
  2013-07-18 15:56   ` Duy Nguyen
@ 2013-07-18 15:57   ` Rahul Bansal
  2013-07-18 16:14     ` Duy Nguyen
  1 sibling, 1 reply; 16+ messages in thread
From: Rahul Bansal @ 2013-07-18 15:57 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Hi Day,

I am aware of that command as well.

I think `git tag` current default order is string-based sorting. I
felt version-number based sorting and/or create-date based sorting
will be more appropriate.

--
Rahul Bansal | Founder & CEO | rtCamp Solutions Pvt. Ltd.
Skype: rahul286 | Twitter: @rahul286 | Web: http://rtcamp.com/


On Thu, Jul 18, 2013 at 9:21 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>
> On Thu, Jul 18, 2013 at 10:27 PM, Rahul Bansal <rahul.bansal@rtcamp.com>
> wrote:
> > I am posting here first time, so please excuse me if this is not right
> > place to send something like this.
> >
> > Please check -
> > http://stackoverflow.com/questions/6091306/can-i-make-git-print-x-y-z-style-tag-names-in-a-sensible-order
> >
> > And also - https://github.com/gitlabhq/gitlabhq/issues/4565
> >
> > IMHO "git tag" is expected to show tag-list ordered by versions.
> >
> > It may be case, that people do not follow same version numbering
> > convention. Most people after x.9.x increment major version (that is why
> > they may not be affected because of this)
> >
> > Another option like "git tag --date-asc" can be added which will print
> > tags by creation date. (As long as people do not create backdated tag, this
> > will work).
>
> Try
>
> git for-each-ref --sort=committerdate --format='%(refname:short)'
> refs/tags
> --
> Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:56   ` Duy Nguyen
@ 2013-07-18 15:58     ` Rahul Bansal
  0 siblings, 0 replies; 16+ messages in thread
From: Rahul Bansal @ 2013-07-18 15:58 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Thanks again Duy. :-)

Sorry for misspelling your name in earlier email.
--
Rahul Bansal | Founder & CEO | rtCamp Solutions Pvt. Ltd.
Skype: rahul286 | Twitter: @rahul286 | Web: http://rtcamp.com/


On Thu, Jul 18, 2013 at 9:26 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Thu, Jul 18, 2013 at 10:51 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>> Try
>>
>> git for-each-ref --sort=committerdate --format='%(refname:short)' refs/tags
>
> And I wondered why it did not seem right. Use this one instead
>
> git for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags
>
> make it --sort=-taggerdate to reverse sort order.
> --
> Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:57   ` Rahul Bansal
@ 2013-07-18 16:14     ` Duy Nguyen
  0 siblings, 0 replies; 16+ messages in thread
From: Duy Nguyen @ 2013-07-18 16:14 UTC (permalink / raw)
  To: Rahul Bansal; +Cc: Git Mailing List

On Thu, Jul 18, 2013 at 10:57 PM, Rahul Bansal <rahul.bansal@rtcamp.com> wrote:
> Hi Day,
>
> I am aware of that command as well.
>
> I think `git tag` current default order is string-based sorting. I
> felt version-number based sorting and/or create-date based sorting
> will be more appropriate.

ok you mean the _default_ order? What about other non-version tags
(even temporary ones just to mark something then removed)?
--
Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:27 Git tag output order is incorrect (IMHO) Rahul Bansal
  2013-07-18 15:51 ` Duy Nguyen
@ 2013-07-18 17:42 ` Andreas Schwab
  2013-07-19 19:40   ` Junio C Hamano
  2013-09-08 22:49 ` Felipe Contreras
  2 siblings, 1 reply; 16+ messages in thread
From: Andreas Schwab @ 2013-07-18 17:42 UTC (permalink / raw)
  To: Rahul Bansal; +Cc: git

Rahul Bansal <rahul.bansal@rtcamp.com> writes:

> IMHO "git tag" is expected to show tag-list ordered by versions. 

A git tag can be anything, not related to versions at all.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 17:42 ` Andreas Schwab
@ 2013-07-19 19:40   ` Junio C Hamano
  2013-07-20  0:22     ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2013-07-19 19:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Rahul Bansal, git

Andreas Schwab <schwab@linux-m68k.org> writes:

> Rahul Bansal <rahul.bansal@rtcamp.com> writes:
>
>> IMHO "git tag" is expected to show tag-list ordered by versions. 
>
> A git tag can be anything, not related to versions at all.

Correct.

But that does not prevent somebody to add "git tag --sort=X" option
to the command, just like "git for-each-ref" has "--sort=X" option.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-19 19:40   ` Junio C Hamano
@ 2013-07-20  0:22     ` Jeff King
  2013-08-20 15:12       ` Antoine Pelisse
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff King @ 2013-07-20  0:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Andreas Schwab, Rahul Bansal

On Fri, Jul 19, 2013 at 12:40:55PM -0700, Junio C Hamano wrote:

> Andreas Schwab <schwab@linux-m68k.org> writes:
> 
> > Rahul Bansal <rahul.bansal@rtcamp.com> writes:
> >
> >> IMHO "git tag" is expected to show tag-list ordered by versions. 
> >
> > A git tag can be anything, not related to versions at all.
> 
> Correct.
> 
> But that does not prevent somebody to add "git tag --sort=X" option
> to the command, just like "git for-each-ref" has "--sort=X" option.

A while ago I started on (but did not get very far on) unifying the ref
selection code for for-each-ref, tag, and branch. It would be nice if
they all supported the same set of --contains/--points-at/--merged/--sort,
etc.

I do plan to finish it eventually, but if anyone else feels like picking
it up, I'd be glad to review patches and/or share my work-in-progress as
a starting point.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-20  0:22     ` Jeff King
@ 2013-08-20 15:12       ` Antoine Pelisse
  2013-09-08  8:03         ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Antoine Pelisse @ 2013-08-20 15:12 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano, Andreas Schwab, Rahul Bansal

On Sat, Jul 20, 2013 at 2:22 AM, Jeff King <peff@peff.net> wrote:
> I do plan to finish it eventually, but if anyone else feels like picking
> it up, I'd be glad to review patches and/or share my work-in-progress as
> a starting point.

Hi Jeff,
I have some free time to come, and would like to work on that feature.
Does the offer still hold ?
If it does, I would be interested in your patches.

Cheers,

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-08-20 15:12       ` Antoine Pelisse
@ 2013-09-08  8:03         ` Jeff King
  2013-10-16 17:56           ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff King @ 2013-09-08  8:03 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: git

On Tue, Aug 20, 2013 at 05:12:47PM +0200, Antoine Pelisse wrote:

> On Sat, Jul 20, 2013 at 2:22 AM, Jeff King <peff@peff.net> wrote:
> > I do plan to finish it eventually, but if anyone else feels like picking
> > it up, I'd be glad to review patches and/or share my work-in-progress as
> > a starting point.
> 
> I have some free time to come, and would like to work on that feature.
> Does the offer still hold ?
> If it does, I would be interested in your patches.

I'm sorry I have taken so long to get back to you on this. I was hoping
to revisit the topic and make sure the patches were in a sensible state
for showing to somebody. But it took me some time to get around to it,
and now that I have, they're really not looking very good.

My general strategy was to factor out all of the "which refs to select"
code from git-tag (which knows --contains and --points-at) and
git-branch (which knows --merged, --no-merged, and --contains), and then
make them all available in a library-ish way to both commands, as well
as for-each-ref (which also knows name matching, which all 3 should
know, too). You can see my messy in-progress commit (that does not even
compile) at:

  git://github.com/peff/git.git jk/contains-wip

Part of the complication is that the filters have to happen at different
times (you can efficiently ask "--contains" for each ref as you see it,
but asking "--merged" must happen after you have collected each one).

I do not recall at this point what other issues led me to stop working
on it (it may simply have been time for dinner, and I never came back to
it). So the patches there may or may not actually be helpful to you.

Sorry I can't be more helpful. I'd be happy to discuss or review if you
want to work on it.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-07-18 15:27 Git tag output order is incorrect (IMHO) Rahul Bansal
  2013-07-18 15:51 ` Duy Nguyen
  2013-07-18 17:42 ` Andreas Schwab
@ 2013-09-08 22:49 ` Felipe Contreras
  2013-09-11 13:42   ` Phil Hord
  2 siblings, 1 reply; 16+ messages in thread
From: Felipe Contreras @ 2013-09-08 22:49 UTC (permalink / raw)
  To: Rahul Bansal; +Cc: git

On Thu, Jul 18, 2013 at 10:27 AM, Rahul Bansal <rahul.bansal@rtcamp.com> wrote:
> I am posting here first time, so please excuse me if this is not right place to send something like this.
>
> Please check - http://stackoverflow.com/questions/6091306/can-i-make-git-print-x-y-z-style-tag-names-in-a-sensible-order
>
> And also - https://github.com/gitlabhq/gitlabhq/issues/4565
>
> IMHO "git tag" is expected to show tag-list ordered by versions.
>
> It may be case, that people do not follow same version numbering convention. Most people after x.9.x increment major version (that is why they may not be affected because of this)
>
> Another option like "git tag --date-asc" can be added which will print tags by creation date. (As long as people do not create backdated tag, this will work).

I completely agree, and there was a proposal to an option like this a
long time ago:

http://article.gmane.org/gmane.comp.version-control.git/111032

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-09-08 22:49 ` Felipe Contreras
@ 2013-09-11 13:42   ` Phil Hord
  2013-09-11 17:54     ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Phil Hord @ 2013-09-11 13:42 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Rahul Bansal, git@vger.kernel.org

Someone at $work asked me this week how to find the current and
previous tags on his branch so he could generate release notes.  I
just need "last two tags on head in topo-order". I was surprised by
how complicated this turned out to be. I ended up with this:

  git log --decorate=full --pretty=format:'%d' HEAD |
    sed -n -e 's-^.* refs/tags/\(.*\)[ )].*$-\1-p' |
    head -2

Surely there's a cleaner way, right?

Phil



On Sun, Sep 8, 2013 at 6:49 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> On Thu, Jul 18, 2013 at 10:27 AM, Rahul Bansal <rahul.bansal@rtcamp.com> wrote:
>> I am posting here first time, so please excuse me if this is not right place to send something like this.
>>
>> Please check - http://stackoverflow.com/questions/6091306/can-i-make-git-print-x-y-z-style-tag-names-in-a-sensible-order
>>
>> And also - https://github.com/gitlabhq/gitlabhq/issues/4565
>>
>> IMHO "git tag" is expected to show tag-list ordered by versions.
>>
>> It may be case, that people do not follow same version numbering convention. Most people after x.9.x increment major version (that is why they may not be affected because of this)
>>
>> Another option like "git tag --date-asc" can be added which will print tags by creation date. (As long as people do not create backdated tag, this will work).
>
> I completely agree, and there was a proposal to an option like this a
> long time ago:
>
> http://article.gmane.org/gmane.comp.version-control.git/111032
>
> --
> Felipe Contreras
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-09-11 13:42   ` Phil Hord
@ 2013-09-11 17:54     ` Junio C Hamano
  0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2013-09-11 17:54 UTC (permalink / raw)
  To: Phil Hord; +Cc: git

Phil Hord <phil.hord@gmail.com> writes:

> Someone at $work asked me this week how to find the current and
> previous tags on his branch so he could generate release notes.  I
> just need "last two tags on head in topo-order". I was surprised by
> how complicated this turned out to be. I ended up with this:
>
>   git log --decorate=full --pretty=format:'%d' HEAD |
>     sed -n -e 's-^.* refs/tags/\(.*\)[ )].*$-\1-p' |
>     head -2
>
> Surely there's a cleaner way, right?

That looks clean enough (I would have used "head -n 2" though) and
in line with the way how you can exercise the flexibility of the
system, at least to me ;-).

Joking aside, I agree that a "--merged X" primitive, i.e. "what refs
can be reachable from commit X?", in the listing mode of "git tag"
or "git for-each-ref" would have helped.  As the sorting and
formatting primitives are already there in for-each-ref, it would
have been

	git for-each-ref \
            --format='%(refname:short)' \
            --sort='-*committerdate' \
            --count=2 \
            --merged my-branch \
            refs/tags/

or something like that.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-09-08  8:03         ` Jeff King
@ 2013-10-16 17:56           ` Jeff King
  2013-10-16 18:06             ` Antoine Pelisse
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff King @ 2013-10-16 17:56 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: git

On Sun, Sep 08, 2013 at 04:03:11AM -0400, Jeff King wrote:

> > I have some free time to come, and would like to work on that feature.
> > Does the offer still hold ?
> > If it does, I would be interested in your patches.
> 
> I'm sorry I have taken so long to get back to you on this. I was hoping
> to revisit the topic and make sure the patches were in a sensible state
> for showing to somebody. But it took me some time to get around to it,
> and now that I have, they're really not looking very good.

Hi Antoine,

Since I haven't heard anything, I assume you haven't been working on
this. But in case you have, I wanted to let you know I found some time
and moved the topic forward a bit. It's not quite ready to share with
the list, but I wanted to notify you so we didn't duplicate effort.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Git tag output order is incorrect (IMHO)
  2013-10-16 17:56           ` Jeff King
@ 2013-10-16 18:06             ` Antoine Pelisse
  0 siblings, 0 replies; 16+ messages in thread
From: Antoine Pelisse @ 2013-10-16 18:06 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Wed, Oct 16, 2013 at 7:56 PM, Jeff King <peff@peff.net> wrote:
> On Sun, Sep 08, 2013 at 04:03:11AM -0400, Jeff King wrote:
>
>> > I have some free time to come, and would like to work on that feature.
>> > Does the offer still hold ?
>> > If it does, I would be interested in your patches.
>>
>> I'm sorry I have taken so long to get back to you on this. I was hoping
>> to revisit the topic and make sure the patches were in a sensible state
>> for showing to somebody. But it took me some time to get around to it,
>> and now that I have, they're really not looking very good.
>
> Hi Antoine,
>
> Since I haven't heard anything, I assume you haven't been working on
> this. But in case you have, I wanted to let you know I found some time
> and moved the topic forward a bit. It's not quite ready to share with
> the list, but I wanted to notify you so we didn't duplicate effort.

Unfortunately, I didn't have as much time as expected to work on this topic.
I'm glad to hear that it's moving forward and will definitely have a
look when you send the patches to the list.
Thank you for letting me know,

Cheers,
Antoine

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-10-16 18:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-18 15:27 Git tag output order is incorrect (IMHO) Rahul Bansal
2013-07-18 15:51 ` Duy Nguyen
2013-07-18 15:56   ` Duy Nguyen
2013-07-18 15:58     ` Rahul Bansal
2013-07-18 15:57   ` Rahul Bansal
2013-07-18 16:14     ` Duy Nguyen
2013-07-18 17:42 ` Andreas Schwab
2013-07-19 19:40   ` Junio C Hamano
2013-07-20  0:22     ` Jeff King
2013-08-20 15:12       ` Antoine Pelisse
2013-09-08  8:03         ` Jeff King
2013-10-16 17:56           ` Jeff King
2013-10-16 18:06             ` Antoine Pelisse
2013-09-08 22:49 ` Felipe Contreras
2013-09-11 13:42   ` Phil Hord
2013-09-11 17:54     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).