# gitweb, updating 'last changed' column on the project page

10 messages from 2007-11-10 to 2007-11-10. Participants: Jon Smirl, Jakub Narebski, Lars Hjemli, Johannes Schindelin.
Thread: https://gitlist.dev/t/10779

## Jon Smirl, 2007-11-10 01:09

Subject: gitweb, updating 'last changed' column on the project page
Message-ID: <9e4733910711091709k173bf23flf2824673f82de9bb@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910711091709k173bf23flf2824673f82de9bb%40mail.gmail.com

```
At http://git.digispeaker.com/ the 'last change' column is not getting updated.

mpc5200b.git
	DigiSpeaker for Freescale MPC5200B.
	Jon Smirl
	5 weeks ago
	summary | shortlog | log | tree

It still says 5 weeks ago, but if I click on the project last change is today.

What controls this? I tried running update-server-info

-- 
Jon Smirl
jonsmirl@gmail.com

```

## Jakub Narebski, 2007-11-10 01:58

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <fh337a$ggp$1@ger.gmane.org>
URL: https://gitlist.dev/e/fh337a%24ggp%241%40ger.gmane.org
In-Reply-To: <9e4733910711091709k173bf23flf2824673f82de9bb@mail.gmail.com>

```
Jon Smirl wrote:

> At http://git.digispeaker.com/ the 'last change' column is not getting updated.
> 
> mpc5200b.git
>       DigiSpeaker for Freescale MPC5200B.
>       Jon Smirl
>       5 weeks ago
>       summary | shortlog | log | tree
> 
> It still says 5 weeks ago, but if I click on the project last change is today.
> 
> What controls this? I tried running update-server-info

What does

  git for-each-ref --format="%(refname):%09%(committer)" --sort=-committerdate
      refs/heads

return? Does adding --count select proper branch, with proper update
date?

Which gitweb version is this?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Jon Smirl, 2007-11-10 06:01

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <9e4733910711092201n5aaeeb7cvfd0e76e43170d481@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910711092201n5aaeeb7cvfd0e76e43170d481%40mail.gmail.com
In-Reply-To: <fh337a$ggp$1@ger.gmane.org>

```
On 11/9/07, Jakub Narebski <jnareb@gmail.com> wrote:
> Jon Smirl wrote:
>
> > At http://git.digispeaker.com/ the 'last change' column is not getting updated.
> >
> > mpc5200b.git
> >       DigiSpeaker for Freescale MPC5200B.
> >       Jon Smirl
> >       5 weeks ago
> >       summary | shortlog | log | tree
> >
> > It still says 5 weeks ago, but if I click on the project last change is today.
> >
> > What controls this? I tried running update-server-info
>
> What does
>
>   git for-each-ref --format="%(refname):%09%(committer)" --sort=-committerdate
>       refs/heads

[daedalus]$ git for-each-ref --format="%(refname):%09%(committer)"
--sort=-committerdate refs/heads
refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194585780 -0500

>
> return? Does adding --count select proper branch, with proper update
> date?

Is it looking for master, and just picking the first branch instead?

>
> Which gitweb version is this?

<!-- git web interface version 1.5.3.5.605.g79fa-dirty, (C) 2005-2006,
Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
<!-- git core binaries version 1.5.3.5.605.g79fa-dirty -->

>
> --
> Jakub Narebski
> Warsaw, Poland
> ShadeHawk on #git
>
>
> -
> 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
>


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Jon Smirl, 2007-11-10 06:10

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <9e4733910711092210o65759276sd6970af5d29f2f32@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910711092210o65759276sd6970af5d29f2f32%40mail.gmail.com
In-Reply-To: <9e4733910711092201n5aaeeb7cvfd0e76e43170d481@mail.gmail.com>

```
On 11/10/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 11/9/07, Jakub Narebski <jnareb@gmail.com> wrote:
> > Jon Smirl wrote:
> >
> > > At http://git.digispeaker.com/ the 'last change' column is not getting updated.
> > >
> > > mpc5200b.git
> > >       DigiSpeaker for Freescale MPC5200B.
> > >       Jon Smirl
> > >       5 weeks ago
> > >       summary | shortlog | log | tree
> > >
> > > It still says 5 weeks ago, but if I click on the project last change is today.
> > >
> > > What controls this? I tried running update-server-info
> >
> > What does
> >
> >   git for-each-ref --format="%(refname):%09%(committer)" --sort=-committerdate
> >       refs/heads
>
> [daedalus]$ git for-each-ref --format="%(refname):%09%(committer)"
> --sort=-committerdate refs/heads
> refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
> refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
> refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
> refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
> refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194585780 -0500


It appears to be using the first head instead of the most recent date.


>
> >
> > return? Does adding --count select proper branch, with proper update
> > date?
>
> Is it looking for master, and just picking the first branch instead?
>
> >
> > Which gitweb version is this?
>
> <!-- git web interface version 1.5.3.5.605.g79fa-dirty, (C) 2005-2006,
> Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
> <!-- git core binaries version 1.5.3.5.605.g79fa-dirty -->
>
> >
> > --
> > Jakub Narebski
> > Warsaw, Poland
> > ShadeHawk on #git
> >
> >
> > -
> > 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
> >
>
>
> --
> Jon Smirl
> jonsmirl@gmail.com
>


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Jakub Narebski, 2007-11-10 09:34

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <200711101034.47861.jnareb@gmail.com>
URL: https://gitlist.dev/e/200711101034.47861.jnareb%40gmail.com
In-Reply-To: <9e4733910711092210o65759276sd6970af5d29f2f32@mail.gmail.com>

```
On Saturday, 10 November 2007, Jon Smirl wrote:
> On 11/10/07, Jon Smirl <jonsmirl@gmail.com> wrote:
>> On 11/9/07, Jakub Narebski <jnareb@gmail.com> wrote:
>>> Jon Smirl wrote:
>>>
>>>> At http://git.digispeaker.com/ the 'last change' column is not getting updated.
>>>>
>>>> mpc5200b.git
>>>>       DigiSpeaker for Freescale MPC5200B.
>>>>       Jon Smirl
>>>>       5 weeks ago
>>>>       summary | shortlog | log | tree
>>>>
>>>> It still says 5 weeks ago, but if I click on the project last change is today.
>>>>
>>>> What controls this? I tried running update-server-info
>>>
>>> What does
>>>
>>>   git for-each-ref --format="%(refname):%09%(committer)" --sort=-committerdate
>>>       refs/heads
>>
>> [daedalus]$ git for-each-ref --format="%(refname):%09%(committer)" \
>> --sort=-committerdate refs/heads
>> refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
>> refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
>> refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
>> refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
>> refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194585780 -0500
> 
> It appears to be using the first head instead of the most recent date.

It appears to not _sort_ the output by committerdate, as it should with
'--sort=-committerdate'.

1442:[gitweb/web!git]$ git for-each-ref --format="%(refname):%09%(committer)" \
  --sort=-committerdate refs/heads
refs/heads/gitweb/web:  Jakub Narebski <jnareb@gmail.com> 1194616779 +0100
refs/heads/man: Junio C Hamano <junio@hera.kernel.org> 1194602628 +0000
refs/heads/html:        Junio C Hamano <junio@hera.kernel.org> 1194602626 +0000
refs/heads/origin:      Junio C Hamano <gitster@pobox.com> 1194602274 -0800
[...]
refs/heads/gitweb-snapshot+navbar:      Sven Verdoolaege <skimo@kotnet.org> 1134765981 +0100

1443:[gitweb/web!git]$ git --version
git version 1.5.3.5


Note that git-for-each-ref with those options returns most recent head
first, sorting output by date of commit (date of adding to repository)

>>>
>>> return? Does adding --count select proper branch, with proper update
>>> date?
>>
>> Is it looking for master, and just picking the first branch instead?

Gitweb should not (and I think does not) have 'master' hardcoded
anywhere. It might use HEAD in some cases you don't want it to...

>>>
>>> Which gitweb version is this?
>>
>> <!-- git web interface version 1.5.3.5.605.g79fa-dirty, (C) 2005-2006,
>> Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
>> <!-- git core binaries version 1.5.3.5.605.g79fa-dirty -->

Older version of gitweb used HEAD branch for'last changed' info on
the projects list page. That is why I asked about gitweb version.

But this is not the case of your problem:
1. Your gitweb is new enough to use git-for-each-ref. It use
   git for-each-ref --format="%(committer)" --sort=-committerdate 
                    --count=1 refs/heads
2. Looking at 'heads' view (or 'heads' part of summary view) one can see
   that m29 is current branch (HEAD), and it is most recent.

Strange...
-- 
Jakub Narebski
Poland

```

## Jon Smirl, 2007-11-10 13:05

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <9e4733910711100505n78459612xdaa12eaa880773d8@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910711100505n78459612xdaa12eaa880773d8%40mail.gmail.com
In-Reply-To: <200711101034.47861.jnareb@gmail.com>

```
On 11/10/07, Jakub Narebski <jnareb@gmail.com> wrote:
> On Saturday, 10 November 2007, Jon Smirl wrote:
> > On 11/10/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> >> On 11/9/07, Jakub Narebski <jnareb@gmail.com> wrote:
> >>> Jon Smirl wrote:
> >>>
> >>>> At http://git.digispeaker.com/ the 'last change' column is not getting updated.
> >>>>
> >>>> mpc5200b.git
> >>>>       DigiSpeaker for Freescale MPC5200B.
> >>>>       Jon Smirl
> >>>>       5 weeks ago
> >>>>       summary | shortlog | log | tree
> >>>>
> >>>> It still says 5 weeks ago, but if I click on the project last change is today.
> >>>>
> >>>> What controls this? I tried running update-server-info
> >>>
> >>> What does
> >>>
> >>>   git for-each-ref --format="%(refname):%09%(committer)" --sort=-committerdate
> >>>       refs/heads
> >>
> >> [daedalus]$ git for-each-ref --format="%(refname):%09%(committer)" \
> >> --sort=-committerdate refs/heads
> >> refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
> >> refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
> >> refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
> >> refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
> >> refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194585780 -0500
> >
> > It appears to be using the first head instead of the most recent date.
> It appears to not _sort_ the output by committerdate, as it should with
> '--sort=-committerdate'.

It is sorted by committerdate, the sort is ascending. Did you expect
it to be descending, pick off the last entry instead of the first?

>
> 1442:[gitweb/web!git]$ git for-each-ref --format="%(refname):%09%(committer)" \
>   --sort=-committerdate refs/heads
> refs/heads/gitweb/web:  Jakub Narebski <jnareb@gmail.com> 1194616779 +0100
> refs/heads/man: Junio C Hamano <junio@hera.kernel.org> 1194602628 +0000
> refs/heads/html:        Junio C Hamano <junio@hera.kernel.org> 1194602626 +0000
> refs/heads/origin:      Junio C Hamano <gitster@pobox.com> 1194602274 -0800
> [...]
> refs/heads/gitweb-snapshot+navbar:      Sven Verdoolaege <skimo@kotnet.org> 1134765981 +0100
>
> 1443:[gitweb/web!git]$ git --version
> git version 1.5.3.5
>
>
> Note that git-for-each-ref with those options returns most recent head
> first, sorting output by date of commit (date of adding to repository)
>
> >>>
> >>> return? Does adding --count select proper branch, with proper update
> >>> date?
> >>
> >> Is it looking for master, and just picking the first branch instead?
>
> Gitweb should not (and I think does not) have 'master' hardcoded
> anywhere. It might use HEAD in some cases you don't want it to...
>
> >>>
> >>> Which gitweb version is this?
> >>
> >> <!-- git web interface version 1.5.3.5.605.g79fa-dirty, (C) 2005-2006,
> >> Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
> >> <!-- git core binaries version 1.5.3.5.605.g79fa-dirty -->
>
> Older version of gitweb used HEAD branch for'last changed' info on
> the projects list page. That is why I asked about gitweb version.
>
> But this is not the case of your problem:
> 1. Your gitweb is new enough to use git-for-each-ref. It use
>    git for-each-ref --format="%(committer)" --sort=-committerdate
>                     --count=1 refs/heads
> 2. Looking at 'heads' view (or 'heads' part of summary view) one can see
>    that m29 is current branch (HEAD), and it is most recent.
>
> Strange...
> --
> Jakub Narebski
> Poland
>


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Jakub Narebski, 2007-11-10 13:27

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <200711101427.18215.jnareb@gmail.com>
URL: https://gitlist.dev/e/200711101427.18215.jnareb%40gmail.com
In-Reply-To: <9e4733910711100505n78459612xdaa12eaa880773d8@mail.gmail.com>

```
Jon Smirl wrote:
> On 11/10/07, Jakub Narebski <jnareb@gmail.com> wrote:
>> On Saturday, 10 November 2007, Jon Smirl wrote:
>>> On 11/10/07, Jon Smirl <jonsmirl@gmail.com> wrote:
>>>
>>>> [daedalus]$ git for-each-ref --format="%(refname):%09%(committer)" \
>>>> --sort=-committerdate refs/heads
>>>> refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
>>>> refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
>>>> refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
>>>> refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
>>>> refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194585780 -0500
>>>
>>> It appears to be using the first head instead of the most recent date.
>>
>> It appears to not _sort_ the output by committerdate, as it should with
>> '--sort=-committerdate'.
> 
> It is sorted by committerdate, the sort is ascending. Did you expect
> it to be descending, pick off the last entry instead of the first?

Excerpts from git-for-each-ref(1):

  git-for-each-ref [--count=<count>]* (...) [--sort=<key>]* (...)

  <count>
          By  default  the  command  shows all refs that match <pattern>. This
          option makes it stop after showing that many refs.

   <key>  A field name to sort on. Prefix - to sort in descending order of the
          value.  When  unspecified,  refname is used. More than one sort keys
          can be given.

So I expect --sort=-committerdate to sort by date of committing, 
descending, and --count=1 pick first one, which means most recent.

It looks like "your" gitweb sorts ascending instead... strange...


How does git_get_last_activity subroutine in your gitweb.cgi looks like?
Does it have '--sort=-commiterdate'? If it has, then I think it is some
strange bug in git, if it doesn't it is strange modification of gitweb.

HTH
-- 
Jakub Narebski
Poland

```

## Jon Smirl, 2007-11-10 14:10

Subject: Re: gitweb, updating 'last changed' column on the project page
Message-ID: <9e4733910711100610y478c62cend1d9af84e0ecc08b@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910711100610y478c62cend1d9af84e0ecc08b%40mail.gmail.com
In-Reply-To: <200711101427.18215.jnareb@gmail.com>

```
On 11/10/07, Jakub Narebski <jnareb@gmail.com> wrote:
> > It is sorted by committerdate, the sort is ascending. Did you expect
> > it to be descending, pick off the last entry instead of the first?
>
> Excerpts from git-for-each-ref(1):
>
>   git-for-each-ref [--count=<count>]* (...) [--sort=<key>]* (...)
>
>   <count>
>           By  default  the  command  shows all refs that match <pattern>. This
>           option makes it stop after showing that many refs.
>
>    <key>  A field name to sort on. Prefix - to sort in descending order of the
>           value.  When  unspecified,  refname is used. More than one sort keys
>           can be given.
>
> So I expect --sort=-committerdate to sort by date of committing,
> descending, and --count=1 pick first one, which means most recent.

git has a bug, it is not implementing the - prefix. I am using git head.

jonsmirl@terra:~$ cd mpc5200b
jonsmirl@terra:~/mpc5200b$ git for-each-ref
--format="%(refname):%09%(committer)" --sort=-committerdate refs/heads
refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194674673 -0500
jonsmirl@terra:~/mpc5200b$ git for-each-ref
--format="%(refname):%09%(committer)" --sort=committerdate refs/heads
refs/heads/m24: Jon Smirl <jonsmirl@gmail.com> 1191362799 -0400
refs/heads/m25: Jon Smirl <jonsmirl@gmail.com> 1191472422 -0400
refs/heads/m26: Jon Smirl <jonsmirl@gmail.com> 1194382038 -0500
refs/heads/m28: Jon Smirl <jonsmirl@gmail.com> 1194385071 -0500
refs/heads/m29: Jon Smirl <jonsmirl@gmail.com> 1194674673 -0500
jonsmirl@terra:~/mpc5200b$ git --version
git version 1.5.3.5.1651.g30bf
jonsmirl@terra:~/mpc5200b$


>
> It looks like "your" gitweb sorts ascending instead... strange...
>
>
> How does git_get_last_activity subroutine in your gitweb.cgi looks like?
> Does it have '--sort=-commiterdate'? If it has, then I think it is some
> strange bug in git, if it doesn't it is strange modification of gitweb.
>
> HTH
> --
> Jakub Narebski
> Poland
>


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Lars Hjemli, 2007-11-10 16:07

Subject: [PATCH] for-each-ref: fix setup of option-parsing for --sort
Message-ID: <1194710863-22868-1-git-send-email-hjemli@gmail.com>
URL: https://gitlist.dev/e/1194710863-22868-1-git-send-email-hjemli%40gmail.com
In-Reply-To: <9e4733910711100610y478c62cend1d9af84e0ecc08b@mail.gmail.com>

```
The option value for --sort is already a pointer to a pointer to struct
ref_sort, so just use it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 builtin-for-each-ref.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index da8c794..e909e66 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -847,7 +847,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
 		OPT_GROUP(""),
 		OPT_INTEGER( 0 , "count", &maxcount, "show only <n> matched refs"),
 		OPT_STRING(  0 , "format", &format, "format", "format to use for the output"),
-		OPT_CALLBACK(0 , "sort", &sort_tail, "key",
+		OPT_CALLBACK(0 , "sort", sort_tail, "key",
 		            "field name to sort on", &opt_parse_sort),
 		OPT_END(),
 	};
-- 
1.5.3.5.623.g0a1d

```

## Johannes Schindelin, 2007-11-10 16:25

Subject: Re: [PATCH] for-each-ref: fix setup of option-parsing for --sort
Message-ID: <Pine.LNX.4.64.0711101625050.4362@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711101625050.4362%40racer.site
In-Reply-To: <1194710863-22868-1-git-send-email-hjemli@gmail.com>

```
Hi,

On Sat, 10 Nov 2007, Lars Hjemli wrote:

> The option value for --sort is already a pointer to a pointer to struct
> ref_sort, so just use it.

Could you add a test for that too, please?

Thanks,
Dscho

```
