git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Improving git branch
@ 2014-12-17 11:10 John Tapsell
  2014-12-17 11:28 ` Michael J Gruber
  2014-12-17 20:51 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: John Tapsell @ 2014-12-17 11:10 UTC (permalink / raw)
  To: Git List

Hi all,

  I'm interested in putting in some time and effort into improving the
output of "git branch".

  What I'm thinking is an output like this:

$ git branch

2014-12-17 * (detached from origin/master)     deaba04 Do stuff
2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
2014-12-14   master                                          8537316
[origin/master: ahead 1, behind 16] Some stuff
2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
2014-12-03   john.ta/container                           e9fd4e5 This
branch is a test bed for containers


(These columns are supposed to be all aligned nicely..)

So, features:

1. Show the date of the last commit
2. Sort by date.  Most recently used branches at the top
3. Show the branch name, including your current "branch", with a * to
indicate that it's checked out.
4. Show the sha
5. Show the branch DESCRIPTION - and if that's not available, show the
short-line of the most recent commit.

There is also a small amount of color here that I can't paste here, to
follow the coloring in the current git branch.

Before I start making patches etc, what do people think?  Would I have
a chance of getting this in?  Should I change some aspects etc?

Thanks,

John Tapsell

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

* Re: Improving git branch
  2014-12-17 11:10 Improving git branch John Tapsell
@ 2014-12-17 11:28 ` Michael J Gruber
  2014-12-17 11:51   ` John Tapsell
  2014-12-17 20:53   ` Junio C Hamano
  2014-12-17 20:51 ` Junio C Hamano
  1 sibling, 2 replies; 9+ messages in thread
From: Michael J Gruber @ 2014-12-17 11:28 UTC (permalink / raw)
  To: John Tapsell, Git List

John Tapsell schrieb am 17.12.2014 um 12:10:
> Hi all,
> 
>   I'm interested in putting in some time and effort into improving the
> output of "git branch".
> 
>   What I'm thinking is an output like this:
> 
> $ git branch
> 
> 2014-12-17 * (detached from origin/master)     deaba04 Do stuff
> 2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
> 2014-12-14   master                                          8537316
> [origin/master: ahead 1, behind 16] Some stuff
> 2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
> 2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
> 2014-12-03   john.ta/container                           e9fd4e5 This
> branch is a test bed for containers
> 
> 
> (These columns are supposed to be all aligned nicely..)
> 
> So, features:
> 
> 1. Show the date of the last commit
> 2. Sort by date.  Most recently used branches at the top
> 3. Show the branch name, including your current "branch", with a * to
> indicate that it's checked out.
> 4. Show the sha
> 5. Show the branch DESCRIPTION - and if that's not available, show the
> short-line of the most recent commit.
> 
> There is also a small amount of color here that I can't paste here, to
> follow the coloring in the current git branch.
> 
> Before I start making patches etc, what do people think?  Would I have
> a chance of getting this in?  Should I change some aspects etc?
> 
> Thanks,
> 
> John Tapsell
> 

I support the general goal, we have quite some way to go there.

As to the method: "git branch" in list mode, "git tag" in list mode and
"git for-each-ref" all do similar things and are in turn not dissimilar
from "git log --no-walk" with appropriate formatting and rev options.

Rather than extending "git branch" any further[*], I suggest a bolder
strategy:

- unify/merge for-each-ref and pretty formats (and code) as far as possible
- leverage that for the list modes of branch and tag

That would allow everyone to get their favourite listing, just like for
logs. Otherwise it would be very difficult to agree on *the* proper
format for an extended branch or tag list.

Michael


[*] I know I'm a sinner, too.

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

* Re: Improving git branch
  2014-12-17 11:28 ` Michael J Gruber
@ 2014-12-17 11:51   ` John Tapsell
  2014-12-17 12:23     ` Michael J Gruber
  2014-12-17 20:53   ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: John Tapsell @ 2014-12-17 11:51 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Git List

I don't fully understand - if I did that, then what difference would
an average user actually see?

On 17 December 2014 at 11:28, Michael J Gruber <git@drmicha.warpmail.net> wrote:
> John Tapsell schrieb am 17.12.2014 um 12:10:
>> Hi all,
>>
>>   I'm interested in putting in some time and effort into improving the
>> output of "git branch".
>>
>>   What I'm thinking is an output like this:
>>
>> $ git branch
>>
>> 2014-12-17 * (detached from origin/master)     deaba04 Do stuff
>> 2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
>> 2014-12-14   master                                          8537316
>> [origin/master: ahead 1, behind 16] Some stuff
>> 2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
>> 2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
>> 2014-12-03   john.ta/container                           e9fd4e5 This
>> branch is a test bed for containers
>>
>>
>> (These columns are supposed to be all aligned nicely..)
>>
>> So, features:
>>
>> 1. Show the date of the last commit
>> 2. Sort by date.  Most recently used branches at the top
>> 3. Show the branch name, including your current "branch", with a * to
>> indicate that it's checked out.
>> 4. Show the sha
>> 5. Show the branch DESCRIPTION - and if that's not available, show the
>> short-line of the most recent commit.
>>
>> There is also a small amount of color here that I can't paste here, to
>> follow the coloring in the current git branch.
>>
>> Before I start making patches etc, what do people think?  Would I have
>> a chance of getting this in?  Should I change some aspects etc?
>>
>> Thanks,
>>
>> John Tapsell
>>
>
> I support the general goal, we have quite some way to go there.
>
> As to the method: "git branch" in list mode, "git tag" in list mode and
> "git for-each-ref" all do similar things and are in turn not dissimilar
> from "git log --no-walk" with appropriate formatting and rev options.
>
> Rather than extending "git branch" any further[*], I suggest a bolder
> strategy:
>
> - unify/merge for-each-ref and pretty formats (and code) as far as possible
> - leverage that for the list modes of branch and tag
>
> That would allow everyone to get their favourite listing, just like for
> logs. Otherwise it would be very difficult to agree on *the* proper
> format for an extended branch or tag list.
>
> Michael
>
>
> [*] I know I'm a sinner, too.

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

* Re: Improving git branch
  2014-12-17 11:51   ` John Tapsell
@ 2014-12-17 12:23     ` Michael J Gruber
  0 siblings, 0 replies; 9+ messages in thread
From: Michael J Gruber @ 2014-12-17 12:23 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

Also, please don't top-post here.

That would allow everyone to get their favourite listing, just like for
logs.

John Tapsell schrieb am 17.12.2014 um 12:51:
> I don't fully understand - if I did that, then what difference would
> an average user actually see?
> 
> On 17 December 2014 at 11:28, Michael J Gruber <git@drmicha.warpmail.net> wrote:
>> John Tapsell schrieb am 17.12.2014 um 12:10:
>>> Hi all,
>>>
>>>   I'm interested in putting in some time and effort into improving the
>>> output of "git branch".
>>>
>>>   What I'm thinking is an output like this:
>>>
>>> $ git branch
>>>
>>> 2014-12-17 * (detached from origin/master)     deaba04 Do stuff
>>> 2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
>>> 2014-12-14   master                                          8537316
>>> [origin/master: ahead 1, behind 16] Some stuff
>>> 2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
>>> 2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
>>> 2014-12-03   john.ta/container                           e9fd4e5 This
>>> branch is a test bed for containers
>>>
>>>
>>> (These columns are supposed to be all aligned nicely..)
>>>
>>> So, features:
>>>
>>> 1. Show the date of the last commit
>>> 2. Sort by date.  Most recently used branches at the top
>>> 3. Show the branch name, including your current "branch", with a * to
>>> indicate that it's checked out.
>>> 4. Show the sha
>>> 5. Show the branch DESCRIPTION - and if that's not available, show the
>>> short-line of the most recent commit.
>>>
>>> There is also a small amount of color here that I can't paste here, to
>>> follow the coloring in the current git branch.
>>>
>>> Before I start making patches etc, what do people think?  Would I have
>>> a chance of getting this in?  Should I change some aspects etc?
>>>
>>> Thanks,
>>>
>>> John Tapsell
>>>
>>
>> I support the general goal, we have quite some way to go there.
>>
>> As to the method: "git branch" in list mode, "git tag" in list mode and
>> "git for-each-ref" all do similar things and are in turn not dissimilar
>> from "git log --no-walk" with appropriate formatting and rev options.
>>
>> Rather than extending "git branch" any further[*], I suggest a bolder
>> strategy:
>>
>> - unify/merge for-each-ref and pretty formats (and code) as far as possible
>> - leverage that for the list modes of branch and tag
>>
>> That would allow everyone to get their favourite listing, just like for
>> logs. Otherwise it would be very difficult to agree on *the* proper
>> format for an extended branch or tag list.
>>
>> Michael
>>
>>
>> [*] I know I'm a sinner, too.

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

* Re: Improving git branch
  2014-12-17 11:10 Improving git branch John Tapsell
  2014-12-17 11:28 ` Michael J Gruber
@ 2014-12-17 20:51 ` Junio C Hamano
  1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2014-12-17 20:51 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

John Tapsell <johnflux@gmail.com> writes:

>   I'm interested in putting in some time and effort into improving the
> output of "git branch".
>
>   What I'm thinking is an output like this:
>
> $ git branch
>
> 2014-12-17 * (detached from origin/master)     deaba04 Do stuff
> 2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
> 2014-12-14   master                                          8537316
> [origin/master: ahead 1, behind 16] Some stuff
> 2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
> 2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
> 2014-12-03   john.ta/container                           e9fd4e5 This
> branch is a test bed for containers
>
>
> (These columns are supposed to be all aligned nicely..)
>
> So, features:
>
> 1. Show the date of the last commit
> 2. Sort by date.  Most recently used branches at the top
> 3. Show the branch name, including your current "branch", with a * to
> indicate that it's checked out.
> 4. Show the sha
> 5. Show the branch DESCRIPTION - and if that's not available, show the
> short-line of the most recent commit.
>
> There is also a small amount of color here that I can't paste here, to
> follow the coloring in the current git branch.
>
> Before I start making patches etc, what do people think?  Would I have
> a chance of getting this in?  Should I change some aspects etc?

Three random points:

 * A single output format can never be favourite of everybody, so
   this needs to be more like

	$ git branch --format='%(committerdate) %(refname) %(subject)'

   optionally with branch.format configuration variable to let the
   user specify the default.

 * I am not sure if the "current" marker should be anywhere but the
   frontmost column in the recommended default.  The output from the
   command obviously is not meant for machine processing
   (e.g. sorting or grepping), so this point is minor, though.

 * I do not think the object name should take valuable screen real
   estate, again in the built-in default (I wouldn't mind people
   hurting themselves with their configuration at all ;-).  After
   looking at "git branch --pretty-long" output, people can give any
   command john.ta/bugfixes instead of e15c95e, no?

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

* Re: Improving git branch
  2014-12-17 11:28 ` Michael J Gruber
  2014-12-17 11:51   ` John Tapsell
@ 2014-12-17 20:53   ` Junio C Hamano
  2014-12-17 21:01     ` Jeff King
  2014-12-18 10:05     ` Michael J Gruber
  1 sibling, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2014-12-17 20:53 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: John Tapsell, Git List, Jeff King

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Rather than extending "git branch" any further[*], I suggest a bolder
> strategy:
>
> - unify/merge for-each-ref and pretty formats (and code) as far as possible
> - leverage that for the list modes of branch and tag
>
> That would allow everyone to get their favourite listing, just like for
> logs. Otherwise it would be very difficult to agree on *the* proper
> format for an extended branch or tag list.
>
> Michael
>
>
> [*] I know I'm a sinner, too.

Actually this is not a "bolder" strategy, but the unification has
been discussed and agreed to be the longer-term direction for quite
a while, I think.  Didn't Peff have this in his "things to do when
absolutely bored" box?

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

* Re: Improving git branch
  2014-12-17 20:53   ` Junio C Hamano
@ 2014-12-17 21:01     ` Jeff King
  2014-12-21 16:36       ` Moritz Neeb
  2014-12-18 10:05     ` Michael J Gruber
  1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2014-12-17 21:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael J Gruber, John Tapsell, Git List

On Wed, Dec 17, 2014 at 12:53:49PM -0800, Junio C Hamano wrote:

> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
> > Rather than extending "git branch" any further[*], I suggest a bolder
> > strategy:
> >
> > - unify/merge for-each-ref and pretty formats (and code) as far as possible
> > - leverage that for the list modes of branch and tag
> >
> > That would allow everyone to get their favourite listing, just like for
> > logs. Otherwise it would be very difficult to agree on *the* proper
> > format for an extended branch or tag list.
> >
> > Michael
> >
> >
> > [*] I know I'm a sinner, too.
> 
> Actually this is not a "bolder" strategy, but the unification has
> been discussed and agreed to be the longer-term direction for quite
> a while, I think.  Didn't Peff have this in his "things to do when
> absolutely bored" box?

Yes. It is not even in my "absolutely bored" box, but rather the "I
would like to work on this but somehow other crap keeps coming up" box.

The last blocker I ran into was that we need to unify the "--contains"
implementation for "git tag" and "git branch". If anybody wants to push
this forward, I think that is the best place to start. I can dig up
references if anybody is interested.

-Peff

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

* Re: Improving git branch
  2014-12-17 20:53   ` Junio C Hamano
  2014-12-17 21:01     ` Jeff King
@ 2014-12-18 10:05     ` Michael J Gruber
  1 sibling, 0 replies; 9+ messages in thread
From: Michael J Gruber @ 2014-12-18 10:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: John Tapsell, Git List, Jeff King

Junio C Hamano schrieb am 17.12.2014 um 21:53:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> Rather than extending "git branch" any further[*], I suggest a bolder
>> strategy:
>>
>> - unify/merge for-each-ref and pretty formats (and code) as far as possible
>> - leverage that for the list modes of branch and tag
>>
>> That would allow everyone to get their favourite listing, just like for
>> logs. Otherwise it would be very difficult to agree on *the* proper
>> format for an extended branch or tag list.
>>
>> Michael
>>
>>
>> [*] I know I'm a sinner, too.
> 
> Actually this is not a "bolder" strategy, but the unification has
> been discussed and agreed to be the longer-term direction for quite
> a while, I think.  Didn't Peff have this in his "things to do when
> absolutely bored" box?
> 

If "waiting for Peff to be bored" is not a bold strategy then I don't
know what would be one ;)

Seriously, I didn't feel bold enough to claim that this is agreed upon
but I am more than happy that it is!

If I can squeeze out some more git time from my other obligations I'll
try and help.

Michael

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

* Re: Improving git branch
  2014-12-17 21:01     ` Jeff King
@ 2014-12-21 16:36       ` Moritz Neeb
  0 siblings, 0 replies; 9+ messages in thread
From: Moritz Neeb @ 2014-12-21 16:36 UTC (permalink / raw)
  To: git

Jeff King <peff <at> peff.net> writes:

> 
> On Wed, Dec 17, 2014 at 12:53:49PM -0800, Junio C Hamano wrote:
> 
> > Michael J Gruber <git <at> drmicha.warpmail.net> writes:
> > 
> > > Rather than extending "git branch" any further[*], I suggest a bolder
> > > strategy:
> > >
> > > - unify/merge for-each-ref and pretty formats (and code) as far as
possible
> > > - leverage that for the list modes of branch and tag
> > >
> > > That would allow everyone to get their favourite listing, just like for
> > > logs. Otherwise it would be very difficult to agree on *the* proper
> > > format for an extended branch or tag list.
> > >
> > > Michael
> > >
> > >
> > > [*] I know I'm a sinner, too.
> > 
> > Actually this is not a "bolder" strategy, but the unification has
> > been discussed and agreed to be the longer-term direction for quite
> > a while, I think.  Didn't Peff have this in his "things to do when
> > absolutely bored" box?
> 
> Yes. It is not even in my "absolutely bored" box, but rather the "I
> would like to work on this but somehow other crap keeps coming up" box.

Is this box public somewhere?

> The last blocker I ran into was that we need to unify the "--contains"
> implementation for "git tag" and "git branch". If anybody wants to push
> this forward, I think that is the best place to start. I can dig up
> references if anybody is interested.
> 

Yes, I would be interested in references. I already found something in
Junio's leftover bits [1] that seems related:
  "git tag --contains" should not consider a tag as the anchor point to
  describe the commit, when it can reach another tag that can also be used
  to describe the commit. Cf. [2]

Regards,
Moritz

[1] http://git-blame.blogspot.fr/p/leftover-bits.html
[2] http://thread.gmane.org/gmane.comp.version-control.git/246381/focus=246423

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

end of thread, other threads:[~2014-12-21 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 11:10 Improving git branch John Tapsell
2014-12-17 11:28 ` Michael J Gruber
2014-12-17 11:51   ` John Tapsell
2014-12-17 12:23     ` Michael J Gruber
2014-12-17 20:53   ` Junio C Hamano
2014-12-17 21:01     ` Jeff King
2014-12-21 16:36       ` Moritz Neeb
2014-12-18 10:05     ` Michael J Gruber
2014-12-17 20:51 ` Junio C Hamano

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 NNTP newsgroup(s).