* Teach "approxidate" about weekday syntax @ 2005-11-17 20:36 Linus Torvalds 2005-11-17 21:27 ` Nicolas Pitre ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-17 20:36 UTC (permalink / raw) To: Junio C Hamano, Git Mailing List This allows people to use syntax like "last thursday" for the approxidate. (Or, indeed, more complex "three thursdays ago", but I suspect that would be pretty unusual). NOTE! The parsing is strictly sequential, so if you do "one day before last thursday" it will _not_ do what you think it does. It will take the current time, subtract one day, and then go back to the thursday before that. So to get what you want, you'd have to write it the other way around: "last thursday and one day before" which is insane (it's usually the same as "last wednesday" _except_ if today is Thursday, in which case "last wednesday" is yesterday, and "last thursday and one day before" is eight days ago). Similarly, "last thursday one month ago" will first go back to last thursday, and then go back one month from there, not the other way around. I doubt anybody would ever use insane dates like that, but I thought I'd point out that the approxidate parsing is not exactly "standard English". Side note 2: if you want to avoid spaces (because of quoting issues), you can use any non-alphanumberic character instead. So git log --since=2.days.ago works without any quotes. Signed-off-by: Linus Torvalds <torvalds@osdl.org> --- diff --git a/date.c b/date.c index 73c063b..d2a67cc 100644 --- a/date.c +++ b/date.c @@ -34,7 +34,7 @@ static const char *month_names[] = { }; static const char *weekday_names[] = { - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" + "Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays" }; /* @@ -531,6 +531,22 @@ static const char *approxidate_alpha(con tl++; } + for (i = 0; i < 7; i++) { + int match = match_string(date, weekday_names[i]); + if (match >= 3) { + int diff, n = *num -1; + *num = 0; + + diff = tm->tm_wday - i; + if (diff <= 0) + n++; + diff += 7*n; + + update_tm(tm, diff * 24 * 60 * 60); + return end; + } + } + if (match_string(date, "months") >= 5) { int n = tm->tm_mon - *num; *num = 0; ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 20:36 Teach "approxidate" about weekday syntax Linus Torvalds @ 2005-11-17 21:27 ` Nicolas Pitre 2005-11-17 21:44 ` Johannes Schindelin 2005-11-17 22:54 ` Junio C Hamano 2005-11-17 23:18 ` H. Peter Anvin 2 siblings, 1 reply; 26+ messages in thread From: Nicolas Pitre @ 2005-11-17 21:27 UTC (permalink / raw) To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List On Thu, 17 Nov 2005, Linus Torvalds wrote: > NOTE! The parsing is strictly sequential, so if you do > > "one day before last thursday" > > it will _not_ do what you think it does. It will take the current time, > subtract one day, and then go back to the thursday before that. Maybe if you applied the different time units in decreasing size that would do the trick? e.g. months have precedence over weeks, weeks over weekdays, weekdays over days, etc. Nicolas ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 21:27 ` Nicolas Pitre @ 2005-11-17 21:44 ` Johannes Schindelin 0 siblings, 0 replies; 26+ messages in thread From: Johannes Schindelin @ 2005-11-17 21:44 UTC (permalink / raw) To: Nicolas Pitre; +Cc: Linus Torvalds, Junio C Hamano, Git Mailing List Hi, On Thu, 17 Nov 2005, Nicolas Pitre wrote: > On Thu, 17 Nov 2005, Linus Torvalds wrote: > > > NOTE! The parsing is strictly sequential, so if you do > > > > "one day before last thursday" > > > > it will _not_ do what you think it does. It will take the current time, > > subtract one day, and then go back to the thursday before that. > > Maybe if you applied the different time units in decreasing size that > would do the trick? e.g. months have precedence over weeks, weeks over > weekdays, weekdays over days, etc. Or even better: make it relative until you find an absolute reference. I.e. "one day" will be 1 * 86400, and if you then parse "before", it will get negative, then "last thursday" will be the absolute reference. 'f course, "one day before last thursday in september" will be a PITA. Ciao, Dscho ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 20:36 Teach "approxidate" about weekday syntax Linus Torvalds 2005-11-17 21:27 ` Nicolas Pitre @ 2005-11-17 22:54 ` Junio C Hamano 2005-11-17 23:18 ` Linus Torvalds 2005-11-17 23:18 ` H. Peter Anvin 2 siblings, 1 reply; 26+ messages in thread From: Junio C Hamano @ 2005-11-17 22:54 UTC (permalink / raw) To: Linus Torvalds; +Cc: git Linus Torvalds <torvalds@osdl.org> writes: > ..., you'd have to write it the other way around: > > "last thursday and one day before" > > which is insane (it's usually the same as "last wednesday" _except_ if > today is Thursday, in which case "last wednesday" is yesterday, and "last > thursday and one day before" is eight days ago). > ... > I doubt anybody would ever use insane dates like that, but I thought I'd > point out that the approxidate parsing is not exactly "standard English". It is not English but Gittish, which is fine, but it somehow reminds me of the funny way users make themselves understood by IF parsers ;-). I am afraid you started small but now are going towards the same insanity of gnudate (it has insane yacc grammar to grok these things), and I suspect we'd better draw a line somewhere. > Side note 2: if you want to avoid spaces (because of quoting issues), you > can use any non-alphanumberic character instead. So > > git log --since=2.days.ago > > works without any quotes. I think this is a useful change. Thanks. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 22:54 ` Junio C Hamano @ 2005-11-17 23:18 ` Linus Torvalds 2005-11-17 23:23 ` Linus Torvalds 2005-11-17 23:32 ` Johannes Schindelin 0 siblings, 2 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-17 23:18 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On Thu, 17 Nov 2005, Junio C Hamano wrote: > > It is not English but Gittish, which is fine, but it somehow > reminds me of the funny way users make themselves understood by > IF parsers ;-). I am afraid you started small but now are going > towards the same insanity of gnudate (it has insane yacc grammar > to grok these things), and I suspect we'd better draw a line > somewhere. I think I'm done. The multi-week "3 sundays ago" part came for free, but the "last sunday" was actually something I liked. Seriously, I can't imagine what else we'd want. It parses exact dates (thanks to the old date-parsing code), and it now parses all the normal "lazy dates" I can think of. The fact that you can combine "last saturday" with "three days ago" is really not a feature as much as a result of the algorithm being so simple that it just doesn't care, and the combination just happens to work. My examples were a bit silly as a result. In real life, you'd probably never use any combinations, but simply use "December 5th" "last sunday" "yesterday" "two days ago" "12 hours ago" and the fact that then some (but definitely not all) combinations of the above all work is really just an accident and not something that people should necessarily even depend on. > > Side note 2: if you want to avoid spaces (because of quoting issues), you > > can use any non-alphanumberic character instead. So > > > > git log --since=2.days.ago > > > > works without any quotes. > > I think this is a useful change. Thanks. That's actually not a new change, the approxidate thing always worked that way, but I thought I'd point it out. Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 23:18 ` Linus Torvalds @ 2005-11-17 23:23 ` Linus Torvalds 2005-11-18 12:12 ` David Roundy 2005-11-17 23:32 ` Johannes Schindelin 1 sibling, 1 reply; 26+ messages in thread From: Linus Torvalds @ 2005-11-17 23:23 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On Thu, 17 Nov 2005, Linus Torvalds wrote: > > I think I'm done. The only thing I might want to do is add some support for time-of-day to the thing. Notably "noon" and "midnight". Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 23:23 ` Linus Torvalds @ 2005-11-18 12:12 ` David Roundy 2005-11-18 13:20 ` Johannes Schindelin 2005-11-18 16:56 ` Linus Torvalds 0 siblings, 2 replies; 26+ messages in thread From: David Roundy @ 2005-11-18 12:12 UTC (permalink / raw) To: git On Thu, Nov 17, 2005 at 03:23:00PM -0800, Linus Torvalds wrote: > On Thu, 17 Nov 2005, Linus Torvalds wrote: > > > > I think I'm done. > > The only thing I might want to do is add some support for time-of-day to > the thing. Notably "noon" and "midnight". Don't forget "high noon"! (and perhaps "tea time"?) :) -- David Roundy http://www.darcs.net ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 12:12 ` David Roundy @ 2005-11-18 13:20 ` Johannes Schindelin 2005-11-18 16:08 ` Randy.Dunlap 2005-11-18 18:08 ` H. Peter Anvin 2005-11-18 16:56 ` Linus Torvalds 1 sibling, 2 replies; 26+ messages in thread From: Johannes Schindelin @ 2005-11-18 13:20 UTC (permalink / raw) To: David Roundy; +Cc: git Hi, On Fri, 18 Nov 2005, David Roundy wrote: > Don't forget "high noon"! (and perhaps "tea time"?) :) How about "dooms day"? I would like to do this: git-whatchanged -p --until="dooms day" Hmm? Ciao, Dscho ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 13:20 ` Johannes Schindelin @ 2005-11-18 16:08 ` Randy.Dunlap 2005-11-18 17:00 ` Linus Torvalds 2005-11-18 18:07 ` Matthias Urlichs 2005-11-18 18:08 ` H. Peter Anvin 1 sibling, 2 replies; 26+ messages in thread From: Randy.Dunlap @ 2005-11-18 16:08 UTC (permalink / raw) To: Johannes Schindelin; +Cc: David Roundy, git On Fri, 18 Nov 2005, Johannes Schindelin wrote: > On Fri, 18 Nov 2005, David Roundy wrote: > > > Don't forget "high noon"! (and perhaps "tea time"?) :) > > How about "dooms day"? I would like to do this: > > git-whatchanged -p --until="dooms day" > > Hmm? Sure, and throw in "ides" (15th afaik) and moon phases while you are at it. -- ~Randy [who would just use ISO standard date format] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 16:08 ` Randy.Dunlap @ 2005-11-18 17:00 ` Linus Torvalds 2005-11-19 0:00 ` Junio C Hamano 2005-11-18 18:07 ` Matthias Urlichs 1 sibling, 1 reply; 26+ messages in thread From: Linus Torvalds @ 2005-11-18 17:00 UTC (permalink / raw) To: Randy.Dunlap; +Cc: Johannes Schindelin, David Roundy, git On Fri, 18 Nov 2005, Randy.Dunlap wrote: > > ~Randy [who would just use ISO standard date format] That actually _does_ work, and has done so since the beginning: [torvalds@g5 git]$ ./test-date "2005-11-02 14:45:00" 2005-11-02 14:45:00 -> 1130971500 -0800 -> Wed Nov 2 14:45:00 2005 2005-11-02 14:45:00 -> Wed Nov 2 14:45:00 2005 ie both the exact and the fuzzy date parsing will happily accept ISO standard date format and exact times. But when you want to know what happened since high tea yesterday, the fuzzy format is unbeatable. Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 17:00 ` Linus Torvalds @ 2005-11-19 0:00 ` Junio C Hamano 2005-11-19 0:07 ` Andreas Ericsson 0 siblings, 1 reply; 26+ messages in thread From: Junio C Hamano @ 2005-11-19 0:00 UTC (permalink / raw) To: Linus Torvalds; +Cc: git Linus Torvalds <torvalds@osdl.org> writes: > On Fri, 18 Nov 2005, Randy.Dunlap wrote: >> >> ~Randy [who would just use ISO standard date format] > > That actually _does_ work, and has done so since the beginning: > > [torvalds@g5 git]$ ./test-date "2005-11-02 14:45:00" Doesn't ISO spell that as "2005-11-02T14:45:00"? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-19 0:00 ` Junio C Hamano @ 2005-11-19 0:07 ` Andreas Ericsson 2005-11-19 0:28 ` Randal L. Schwartz 2005-11-19 0:48 ` Linus Torvalds 0 siblings, 2 replies; 26+ messages in thread From: Andreas Ericsson @ 2005-11-19 0:07 UTC (permalink / raw) To: Junio C Hamano; +Cc: Linus Torvalds, git Junio C Hamano wrote: > Linus Torvalds <torvalds@osdl.org> writes: > > >>On Fri, 18 Nov 2005, Randy.Dunlap wrote: >> >>>~Randy [who would just use ISO standard date format] >> >>That actually _does_ work, and has done so since the beginning: >> >> [torvalds@g5 git]$ ./test-date "2005-11-02 14:45:00" > > > Doesn't ISO spell that as "2005-11-02T14:45:00"? > nox!exon:~$ date --iso-8601=seconds 2005-11-19T01:04:56+0100 No human will spell it with T though. -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-19 0:07 ` Andreas Ericsson @ 2005-11-19 0:28 ` Randal L. Schwartz 2005-11-19 0:48 ` Linus Torvalds 1 sibling, 0 replies; 26+ messages in thread From: Randal L. Schwartz @ 2005-11-19 0:28 UTC (permalink / raw) To: Andreas Ericsson; +Cc: Junio C Hamano, Linus Torvalds, git >>>>> "Andreas" == Andreas Ericsson <ae@op5.se> writes: >>> [torvalds@g5 git]$ ./test-date "2005-11-02 14:45:00" >> Doesn't ISO spell that as "2005-11-02T14:45:00"? >> Andreas> nox!exon:~$ date --iso-8601=seconds Andreas> 2005-11-19T01:04:56+0100 Andreas> No human will spell it with T though. But they might be getting it out of another tool like that. And, let me apologize for derailing Linus for a week. Sorry. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-19 0:07 ` Andreas Ericsson 2005-11-19 0:28 ` Randal L. Schwartz @ 2005-11-19 0:48 ` Linus Torvalds 1 sibling, 0 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-19 0:48 UTC (permalink / raw) To: Andreas Ericsson; +Cc: Junio C Hamano, git On Sat, 19 Nov 2005, Andreas Ericsson wrote: > > nox!exon:~$ date --iso-8601=seconds > 2005-11-19T01:04:56+0100 > > No human will spell it with T though. Git doesn't care. ./test-date 2005-11-19T01:04:56+0100 results in 2005-11-19T01:04:56+0100 -> 1132358696 +0100 -> Fri Nov 18 16:04:56 2005 which should be correct: I'm in PST, test-date shows the "git time" (seconds since the epoch plus TZ) and then the local time in human-readable ascii. The "T" to the git date parser is just a superfluous character that just happens to be a perfectly valid way to separate out the numbers ;) Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 16:08 ` Randy.Dunlap 2005-11-18 17:00 ` Linus Torvalds @ 2005-11-18 18:07 ` Matthias Urlichs 2005-11-20 23:36 ` Johannes Schindelin 1 sibling, 1 reply; 26+ messages in thread From: Matthias Urlichs @ 2005-11-18 18:07 UTC (permalink / raw) To: git Randy.Dunlap wrote: > ~Randy [who would just use ISO standard date format] You can't just use non-confusing dates. People used to confusion would be confused. Speaking of which ..: Linus Torvalds wrote: >> 5 months with 73 days each; Chaos, Discord, Confusion, Bureaucracy, The >> Aftermath > I'm sorry, but having "git log --since=confusion" would just be > irresponsible. > Possibly, but on the other hand there'd be a lot more truth in these than in our current month names. (November hasn't been the ninth month for *some* time now...) -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de - - While there's life, there's hope. -- Publius Terentius Afer (Terence) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 18:07 ` Matthias Urlichs @ 2005-11-20 23:36 ` Johannes Schindelin 0 siblings, 0 replies; 26+ messages in thread From: Johannes Schindelin @ 2005-11-20 23:36 UTC (permalink / raw) To: Matthias Urlichs; +Cc: git Hi, On Fri, 18 Nov 2005, Matthias Urlichs wrote: > Linus Torvalds wrote: > > I'm sorry, but having "git log --since=confusion" would just be > > irresponsible. > > > Possibly, but on the other hand there'd be a lot more truth in these than > in our current month names. (November hasn't been the ninth month for > *some* time now...) Well, I know a girl who gave birth to her child in November. And I guess she's not the only one. Hth, Dscho ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 13:20 ` Johannes Schindelin 2005-11-18 16:08 ` Randy.Dunlap @ 2005-11-18 18:08 ` H. Peter Anvin 1 sibling, 0 replies; 26+ messages in thread From: H. Peter Anvin @ 2005-11-18 18:08 UTC (permalink / raw) To: Johannes Schindelin; +Cc: David Roundy, git Johannes Schindelin wrote: > Hi, > > On Fri, 18 Nov 2005, David Roundy wrote: > > >>Don't forget "high noon"! (and perhaps "tea time"?) :) > > > How about "dooms day"? I would like to do this: > > git-whatchanged -p --until="dooms day" > Domesday was some time in August 1086, right? -hpa ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 12:12 ` David Roundy 2005-11-18 13:20 ` Johannes Schindelin @ 2005-11-18 16:56 ` Linus Torvalds 2005-11-18 17:26 ` Andreas Ericsson 1 sibling, 1 reply; 26+ messages in thread From: Linus Torvalds @ 2005-11-18 16:56 UTC (permalink / raw) To: David Roundy; +Cc: git On Fri, 18 Nov 2005, David Roundy wrote: > > Don't forget "high noon"! (and perhaps "tea time"?) :) Done. [torvalds@g5 git]$ ./test-date "now" "midnight" "high noon" "tea-time" now -> bad -> Wed Dec 31 16:00:00 1969 now -> Fri Nov 18 08:50:54 2005 midnight -> bad -> Wed Dec 31 16:00:00 1969 midnight -> Fri Nov 18 00:00:00 2005 high noon -> bad -> Wed Dec 31 16:00:00 1969 high noon -> Thu Nov 17 12:00:00 2005 tea-time -> bad -> Wed Dec 31 16:00:00 1969 tea-time -> Thu Nov 17 17:00:00 2005 Thanks for pointing out tea-time. This is also written to easily extended to allow people to add their own important dates like Christmas and their own birthdays. Signed-off-by: Linus Torvalds <torvalds@osdl.org> --- diff --git a/date.c b/date.c index d2a67cc..3e11500 100644 --- a/date.c +++ b/date.c @@ -468,12 +468,52 @@ static void update_tm(struct tm *tm, uns localtime_r(&n, tm); } +static void date_yesterday(struct tm *tm, int *num) +{ + update_tm(tm, 24*60*60); +} + +static void date_time(struct tm *tm, int hour) +{ + if (tm->tm_hour < hour) + date_yesterday(tm, NULL); + tm->tm_hour = hour; + tm->tm_min = 0; + tm->tm_sec = 0; +} + +static void date_midnight(struct tm *tm, int *num) +{ + date_time(tm, 0); +} + +static void date_noon(struct tm *tm, int *num) +{ + date_time(tm, 12); +} + +static void date_tea(struct tm *tm, int *num) +{ + date_time(tm, 17); +} + +static const struct special { + const char *name; + void (*fn)(struct tm *, int *); +} special[] = { + { "yesterday", date_yesterday }, + { "noon", date_noon }, + { "midnight", date_midnight }, + { "tea", date_tea }, + { NULL } +}; + static const char *number_name[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", }; -static struct typelen { +static const struct typelen { const char *type; int length; } typelen[] = { @@ -487,7 +527,8 @@ static struct typelen { static const char *approxidate_alpha(const char *date, struct tm *tm, int *num) { - struct typelen *tl; + const struct typelen *tl; + const struct special *s; const char *end = date; int n = 1, i; @@ -502,9 +543,12 @@ static const char *approxidate_alpha(con } } - if (match_string(date, "yesterday") > 8) { - update_tm(tm, 24*60*60); - return end; + for (s = special; s->name; s++) { + int len = strlen(s->name); + if (match_string(date, s->name) == len) { + s->fn(tm, num); + return end; + } } if (!*num) { ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 16:56 ` Linus Torvalds @ 2005-11-18 17:26 ` Andreas Ericsson 2005-11-18 17:33 ` Linus Torvalds 0 siblings, 1 reply; 26+ messages in thread From: Andreas Ericsson @ 2005-11-18 17:26 UTC (permalink / raw) To: Linus Torvalds; +Cc: David Roundy, git Linus Torvalds wrote: > > On Fri, 18 Nov 2005, David Roundy wrote: > >>Don't forget "high noon"! (and perhaps "tea time"?) :) > > > Done. > What about Discordian dates? You seem to be having so much fun and I'd hate to spoil it for you. :) It should be easier than Gregorian ones too. 5 months with 73 days each; Chaos, Discord, Confusion, Bureaucracy, The Aftermath 5 days: Sweetmorn, Boomtime, Pungenday, Prickle-Prickle, Setting Orange February 29 is "St. Tibs day". For years, just tack on 1166 and you're good to go. It'd be just lovely to be able to say git whatchanged --since=chaos Incidentally, git was first released in "Discord" which seems somehow appropriate. :) -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 17:26 ` Andreas Ericsson @ 2005-11-18 17:33 ` Linus Torvalds 0 siblings, 0 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-18 17:33 UTC (permalink / raw) To: Andreas Ericsson; +Cc: David Roundy, git On Fri, 18 Nov 2005, Andreas Ericsson wrote: > > 5 months with 73 days each; Chaos, Discord, Confusion, Bureaucracy, The > Aftermath > 5 days: Sweetmorn, Boomtime, Pungenday, Prickle-Prickle, Setting Orange > > February 29 is "St. Tibs day". I'm sorry, but having "git log --since=confusion" would just be irresponsible. Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 23:18 ` Linus Torvalds 2005-11-17 23:23 ` Linus Torvalds @ 2005-11-17 23:32 ` Johannes Schindelin 2005-11-18 1:40 ` Martin Langhoff 1 sibling, 1 reply; 26+ messages in thread From: Johannes Schindelin @ 2005-11-17 23:32 UTC (permalink / raw) To: Linus Torvalds; +Cc: Junio C Hamano, git Hi, On Thu, 17 Nov 2005, Linus Torvalds wrote: > Seriously, I can't imagine what else we'd want. An error when there's a chance the result is unexpected? Ciao, Dscho ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 23:32 ` Johannes Schindelin @ 2005-11-18 1:40 ` Martin Langhoff 2005-11-18 2:38 ` Linus Torvalds 2005-11-18 2:53 ` Johannes Schindelin 0 siblings, 2 replies; 26+ messages in thread From: Martin Langhoff @ 2005-11-18 1:40 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Linus Torvalds, Junio C Hamano, git On 11/18/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > On Thu, 17 Nov 2005, Linus Torvalds wrote: > > Seriously, I can't imagine what else we'd want. > An error when there's a chance the result is unexpected? That'd be even harder to define -- I'd rather have it spit out what it interpreted so that porcelains can display it to the user. The user can tell at a glance if the parser is off -- for it will be off by a mile. m ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 1:40 ` Martin Langhoff @ 2005-11-18 2:38 ` Linus Torvalds 2005-11-18 2:53 ` Johannes Schindelin 1 sibling, 0 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-18 2:38 UTC (permalink / raw) To: Martin Langhoff; +Cc: Johannes Schindelin, Junio C Hamano, git On Fri, 18 Nov 2005, Martin Langhoff wrote: > > That'd be even harder to define -- I'd rather have it spit out what it > interpreted so that porcelains can display it to the user. The user > can tell at a glance if the parser is off -- for it will be off by a > mile. Well, quite frankly, almost always it's pretty damn obvious. We could make it less so: the most common mistake when it doesn't parse sanely is that it doesn't parse anything at all, but it saw a number somewhere, and thought it was a day of the month. For example, "last janurary" will silently parse to just "1" (miss-spelled "january"), which will be interpreted as the "first of this month". And we could make _that_ be an error. If you want the first of this month, you'd have to spell out the month, ie write "Nov 1" instead of just "1". Apart from that parsign error, pretty much everything else will tend to parse correctly or just give "now" (which is pretty obvious when you ask for a log "since now", and get an empty answer back). But quite frankly, I don't think the approximate date-parsing is serious enough to even worry about these kinds of things. I actually use it, but I don't think anybody _depends_ on it. It's useful to do gitk --since=last.week just as a way to speed up the startup (if you're just interested in the top of the tree, the kernel history is so big that it's just pointless to do a full gitk, and doing the "since last week" is a quick way to just limit the history enough that it makes the graph cleaner). And if you get that wrong, who cares? It's not a big deal. The approxidate parsing is one of those "hey, that's nice" features, but it's definitely not important. Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-18 1:40 ` Martin Langhoff 2005-11-18 2:38 ` Linus Torvalds @ 2005-11-18 2:53 ` Johannes Schindelin 1 sibling, 0 replies; 26+ messages in thread From: Johannes Schindelin @ 2005-11-18 2:53 UTC (permalink / raw) To: Martin Langhoff; +Cc: Linus Torvalds, Junio C Hamano, git Hi, On Fri, 18 Nov 2005, Martin Langhoff wrote: > On 11/18/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > On Thu, 17 Nov 2005, Linus Torvalds wrote: > > > Seriously, I can't imagine what else we'd want. > > An error when there's a chance the result is unexpected? > > That'd be even harder to define -- I'd rather have it spit out what it > interpreted so that porcelains can display it to the user. The user > can tell at a glance if the parser is off -- for it will be off by a > mile. Yes, it may be off by a mile. But if there exists a feature to specify a date that comfortably, people don't RTFM, but use it. Now comes the rub: if nothing is displayed, they take it that everything was fine. *If* something was displayed, one knew that the code parsed yesterday when last year was meant. But *if not*, nobody knows. This is dangerous. It is wrong, but does not say so. Hth, Dscho ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 20:36 Teach "approxidate" about weekday syntax Linus Torvalds 2005-11-17 21:27 ` Nicolas Pitre 2005-11-17 22:54 ` Junio C Hamano @ 2005-11-17 23:18 ` H. Peter Anvin 2005-11-17 23:30 ` Linus Torvalds 2 siblings, 1 reply; 26+ messages in thread From: H. Peter Anvin @ 2005-11-17 23:18 UTC (permalink / raw) To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List Linus Torvalds wrote: > This allows people to use syntax like "last thursday" for the approxidate. > > (Or, indeed, more complex "three thursdays ago", but I suspect that would > be pretty unusual). > > NOTE! The parsing is strictly sequential, so if you do > > "one day before last thursday" > > it will _not_ do what you think it does. It will take the current time, > subtract one day, and then go back to the thursday before that. So to get > what you want, you'd have to write it the other way around: > > "last thursday and one day before" > > which is insane (it's usually the same as "last wednesday" _except_ if > today is Thursday, in which case "last wednesday" is yesterday, and "last > thursday and one day before" is eight days ago). > > Similarly, > > "last thursday one month ago" > > will first go back to last thursday, and then go back one month from > there, not the other way around. > > I doubt anybody would ever use insane dates like that, but I thought I'd > point out that the approxidate parsing is not exactly "standard English". > I believe English would always parse from right to left, it might be the right thing to do... -hpa ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Teach "approxidate" about weekday syntax 2005-11-17 23:18 ` H. Peter Anvin @ 2005-11-17 23:30 ` Linus Torvalds 0 siblings, 0 replies; 26+ messages in thread From: Linus Torvalds @ 2005-11-17 23:30 UTC (permalink / raw) To: H. Peter Anvin; +Cc: Junio C Hamano, Git Mailing List On Thu, 17 Nov 2005, H. Peter Anvin wrote: > > I believe English would always parse from right to left, it might be the right > thing to do... I'll try if that makes any difference. It would have some other advantages (ie it would make it easy to actually differentiate between "ago" and "from now"). Linus ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2005-11-20 23:36 UTC | newest] Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-11-17 20:36 Teach "approxidate" about weekday syntax Linus Torvalds 2005-11-17 21:27 ` Nicolas Pitre 2005-11-17 21:44 ` Johannes Schindelin 2005-11-17 22:54 ` Junio C Hamano 2005-11-17 23:18 ` Linus Torvalds 2005-11-17 23:23 ` Linus Torvalds 2005-11-18 12:12 ` David Roundy 2005-11-18 13:20 ` Johannes Schindelin 2005-11-18 16:08 ` Randy.Dunlap 2005-11-18 17:00 ` Linus Torvalds 2005-11-19 0:00 ` Junio C Hamano 2005-11-19 0:07 ` Andreas Ericsson 2005-11-19 0:28 ` Randal L. Schwartz 2005-11-19 0:48 ` Linus Torvalds 2005-11-18 18:07 ` Matthias Urlichs 2005-11-20 23:36 ` Johannes Schindelin 2005-11-18 18:08 ` H. Peter Anvin 2005-11-18 16:56 ` Linus Torvalds 2005-11-18 17:26 ` Andreas Ericsson 2005-11-18 17:33 ` Linus Torvalds 2005-11-17 23:32 ` Johannes Schindelin 2005-11-18 1:40 ` Martin Langhoff 2005-11-18 2:38 ` Linus Torvalds 2005-11-18 2:53 ` Johannes Schindelin 2005-11-17 23:18 ` H. Peter Anvin 2005-11-17 23:30 ` Linus Torvalds
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).