# [PATCH] --walk-reflogs: actually find the right commit by date.

8 messages from 2007-01-20 to 2007-01-21. Participants: Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/6451

## Johannes Schindelin, 2007-01-20 09:49

Subject: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <Pine.LNX.4.63.0701201048560.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701201048560.22628%40wbgn013.biozentrum.uni-wuerzburg.de

```

Embarassing thinko.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 reflog-walk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/reflog-walk.c b/reflog-walk.c
index d4b49c7..d58ff9b 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -70,7 +70,7 @@ static int get_reflog_recno_by_time(struct complete_reflogs *array,
 	unsigned long timestamp)
 {
 	int i;
-	for (i = array->nr - 1; i >= 0; i++)
+	for (i = array->nr - 1; i >= 0; i--)
 		if (timestamp >= array->items[i].timestamp)
 			return i;
 	return -1;
-- 
1.5.0.rc1.gd85c

```

## Johannes Schindelin, 2007-01-20 09:52

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <Pine.LNX.4.63.0701201051320.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701201051320.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <Pine.LNX.4.63.0701201048560.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
Hi,

On Sat, 20 Jan 2007, Johannes Schindelin wrote:

> Embarassing thinko.

BTW this fixes your "git-log --walk-reflogs -1 --pretty=s master@{1.day}" 
bug.

Ciao,
Dscho

```

## Junio C Hamano, 2007-01-20 10:11

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <7vhcum80u4.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhcum80u4.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0701201048560.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Embarassing thinko.

Aha, progress ;-).  But it still seems to pick up entry that is
less than specified number of hours if I do:

	$ git log --walk-reflogs -4 master@{1.hour} | head -2
        commit 33dd19c2a9c0b114436f53d86fc1c2c5e00c26bb
        Reflog: master@{Sat, 20 Jan 2007 00:01:35 -0800} (Junio C Ham

It is Jan 20th 02:10 now and the master was not pointing at that
commit 1 hour ago.

Anyway, I am done for the night -- I haven't finished testing
the updated 'master' and 'next', so I'll push out the tip of
'pu' (which contains all of the tentitive 'master' and 'next'
changes I haven't verified yet) and call it a day.

```

## Johannes Schindelin, 2007-01-20 21:36

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <Pine.LNX.4.63.0701202225020.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701202225020.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vhcum80u4.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Sat, 20 Jan 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Embarassing thinko.
> 
> Aha, progress ;-).  But it still seems to pick up entry that is
> less than specified number of hours if I do:
> 
> 	$ git log --walk-reflogs -4 master@{1.hour} | head -2
>         commit 33dd19c2a9c0b114436f53d86fc1c2c5e00c26bb
>         Reflog: master@{Sat, 20 Jan 2007 00:01:35 -0800} (Junio C Ham
> 
> It is Jan 20th 02:10 now and the master was not pointing at that
> commit 1 hour ago.

I tried to reproduce this effect, but so far no luck. I even let the 
function get_reflog_recno_by_time() output what it does, and it picks 
exactly the right commit. Do you have a time skew?

Ciao,
Dscho

```

## Junio C Hamano, 2007-01-21 07:09

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <7vhcuk500j.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhcuk500j.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0701202225020.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi,
>
> On Sat, 20 Jan 2007, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> 
>> > Embarassing thinko.
>> 
>> Aha, progress ;-).  But it still seems to pick up entry that is
>> less than specified number of hours if I do:
>> 
>> 	$ git log --walk-reflogs -4 master@{1.hour} | head -2
>>         commit 33dd19c2a9c0b114436f53d86fc1c2c5e00c26bb
>>         Reflog: master@{Sat, 20 Jan 2007 00:01:35 -0800} (Junio C Ham
>> 
>> It is Jan 20th 02:10 now and the master was not pointing at that
>> commit 1 hour ago.
>
> I tried to reproduce this effect, but so far no luck.

Sorry, I was reading the timestamp wrong.  That is one minute
thirty-five seconds past midnight, not thirty five minute past
one o'clock.

```

## Johannes Schindelin, 2007-01-21 10:53

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <Pine.LNX.4.63.0701211152400.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701211152400.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vhcuk500j.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Sat, 20 Jan 2007, Junio C Hamano wrote:

> Sorry, I was reading the timestamp wrong.  That is one minute 
> thirty-five seconds past midnight, not thirty five minute past one 
> o'clock.

Wow! I missed that completely!

Ciao,
Dscho

```

## Junio C Hamano, 2007-01-21 11:19

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <7vac0c39uw.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vac0c39uw.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0701211152400.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Sat, 20 Jan 2007, Junio C Hamano wrote:
>
>> Sorry, I was reading the timestamp wrong.  That is one minute 
>> thirty-five seconds past midnight, not thirty five minute past one 
>> o'clock.
>
> Wow! I missed that completely!

Sorry for that.  It was late and I was tired.

By the way, "git log --walk-reflog master@{now}" seems to give
me one non-reflog entry output for me at the end (which is I
think the parent of the oldest reflog entry which itself does
not have the record of being at the tip of the ref in
question).  Other than that I think we are Ok.

Also doesn't --walk-reflog sound too long?

```

## Johannes Schindelin, 2007-01-21 18:14

Subject: Re: [PATCH] --walk-reflogs: actually find the right commit by date.
Message-ID: <Pine.LNX.4.63.0701211913060.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701211913060.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vac0c39uw.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Sun, 21 Jan 2007, Junio C Hamano wrote:

> By the way, "git log --walk-reflog master@{now}" seems to give me one 
> non-reflog entry output for me at the end (which is I think the parent 
> of the oldest reflog entry which itself does not have the record of 
> being at the tip of the ref in question).  Other than that I think we 
> are Ok.

Yes, I realized that. It might bear some information, but if you don't 
like it, I can change that.

> Also doesn't --walk-reflog sound too long?

Yes. Suggestions? (--reflog is already taken :-( )

Ciao,
Dscho

```
