summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7c6ef2f)
raw | patch | inline | side by side (parent: 7c6ef2f)
author | Linus Torvalds <torvalds@osdl.org> | |
Tue, 20 Sep 2005 21:13:24 +0000 (14:13 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 21 Sep 2005 01:10:32 +0000 (18:10 -0700) |
This adds the options "--since=date" and "--before=date" to git-rev-parse,
which knows how to translate them into seconds since the epoch for
git-rev-list.
With this, you can do
git log --since="2 weeks ago"
or
git log --until=yesterday
to show the commits that have happened in the last two weeks or are
older than 24 hours, respectively.
The flags "--after=" and "--before" are synonyms for --since and --until,
and you can combine them, so
git log --after="Aug 5" --before="Aug 10"
is a valid (but strange) thing to do.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
which knows how to translate them into seconds since the epoch for
git-rev-list.
With this, you can do
git log --since="2 weeks ago"
or
git log --until=yesterday
to show the commits that have happened in the last two weeks or are
older than 24 hours, respectively.
The flags "--after=" and "--before" are synonyms for --since and --until,
and you can combine them, so
git log --after="Aug 5" --before="Aug 10"
is a valid (but strange) thing to do.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
rev-parse.c | patch | blob | history |
diff --git a/rev-parse.c b/rev-parse.c
index 0f5630f95c4dc9ac257ea6c3b2f0e178af667ae5..507b531dce781133946da04cb27fa2ff6d3832a9 100644 (file)
--- a/rev-parse.c
+++ b/rev-parse.c
#include "cache.h"
#include "commit.h"
#include "refs.h"
+#include "quote.h"
#define DO_REVS 1
#define DO_NOREV 2
return 0;
}
+static void show_datestring(const char *flag, const char *datestr)
+{
+ FILE *date;
+ static char buffer[100];
+ static char cmd[1000];
+ int len;
+
+ /* date handling requires both flags and revs */
+ if ((filter & (DO_FLAGS | DO_REVS)) != (DO_FLAGS | DO_REVS))
+ return;
+ len = strlen(flag);
+ memcpy(buffer, flag, len);
+
+ snprintf(cmd, sizeof(cmd), "date --date=%s +%%s", sq_quote(datestr));
+ date = popen(cmd, "r");
+ if (!date || !fgets(buffer + len, sizeof(buffer) - len, date))
+ die("git-rev-list: bad date string");
+ pclose(date);
+ len = strlen(buffer);
+ if (buffer[len-1] == '\n')
+ buffer[--len] = 0;
+ show(buffer);
+}
+
int main(int argc, char **argv)
{
int i, as_is = 0, verify = 0;
printf("%s/.git\n", cwd);
continue;
}
+ if (!strncmp(arg, "--since=", 8)) {
+ show_datestring("--max-age=", arg+8);
+ continue;
+ }
+ if (!strncmp(arg, "--after=", 8)) {
+ show_datestring("--max-age=", arg+8);
+ continue;
+ }
+ if (!strncmp(arg, "--before=", 9)) {
+ show_datestring("--min-age=", arg+9);
+ continue;
+ }
+ if (!strncmp(arg, "--until=", 8)) {
+ show_datestring("--min-age=", arg+8);
+ continue;
+ }
if (verify)
die("Needed a single revision");
show_flag(arg);