threads / patch / 6451

patch--walk-reflogs: actually find the right commit by date.

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

## tl;dr

8 messages between Jan 20, 2007 and Jan 21, 2007. Diffs are folded; open one to read it.

replies: 7people: 2as markdown or json

Johannes Schindelin· Jan 20, 2007, 09:49 UTC · lore
Embarassing thinko.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 reflog-walk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to reflog-walk.c +1 −1
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
Junio C Hamano· Jan 20, 2007, 10:11 UTC · re: Johannes Schindelin · lore

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

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· Jan 20, 2007, 21:36 UTC · re: Junio C Hamano · lore

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

Hi,
On Sat, 20 Jan 2007, Junio C Hamano wrote:
Show 13 quoted lines
> 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· Jan 21, 2007, 07:09 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 19 quoted lines
> 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· Jan 21, 2007, 10:53 UTC · re: Junio C Hamano · lore

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

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· Jan 21, 2007, 11:19 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
> 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· Jan 21, 2007, 18:14 UTC · re: Junio C Hamano · lore

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

Hi,
On Sun, 21 Jan 2007, Junio C Hamano wrote:
Show 5 quoted lines
> 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

← back to recent threads