summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eaf6459)
raw | patch | inline | side by side (parent: eaf6459)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 20 Jan 2007 22:04:02 +0000 (23:04 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 21 Jan 2007 07:46:53 +0000 (23:46 -0800) |
The option --reverse reverses the order of the commits.
[jc: with comments on rev_info.reverse from Simon 'corecode' Schubert.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
[jc: with comments on rev_info.reverse from Simon 'corecode' Schubert.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-rev-list.txt | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
index a996f6cb1e4e9e94dbf3ccfb383990267a1cb819..beb090651b62f45851edd89a2217d4208397cc92 100644 (file)
[ \--pretty | \--header ]
[ \--bisect ]
[ \--merge ]
+ [ \--reverse ]
[ \--walk-reflogs ]
<commit>... [ \-- <paths>... ]
parent comes before all of its children, but otherwise things
are still ordered in the commit timestamp order.
+--reverse::
+
+ Output the commits in reverse order.
+
Object Traversal
~~~~~~~~~~~~~~~~
diff --git a/revision.c b/revision.c
index ebd025064c82a3f6190a83e808e8bcf73478dacc..6726f736ed7b487e0f11dc5295ffb9a186327ce3 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -1057,6 +1057,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
git_log_output_encoding = "";
continue;
}
+ if (!strcmp(arg, "--reverse")) {
+ revs->reverse ^= 1;
+ continue;
+ }
opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
if (opts > 0) {
{
struct commit *c = NULL;
+ if (revs->reverse) {
+ struct commit_list *list;
+
+ /*
+ * rev_info.reverse is used to note the fact that we
+ * want to output the list of revisions in reverse
+ * order. To accomplish this goal, reverse can have
+ * different values:
+ *
+ * 0 do nothing
+ * 1 reverse the list
+ * 2 internal use: we have already obtained and
+ * reversed the list, now we only need to yield
+ * its items.
+ */
+
+ if (revs->reverse == 1) {
+ revs->reverse = 0;
+ list = NULL;
+ while ((c = get_revision(revs)))
+ commit_list_insert(c, &list);
+ revs->commits = list;
+ revs->reverse = 2;
+ }
+
+ if (!revs->commits)
+ return NULL;
+ c = revs->commits->item;
+ list = revs->commits->next;
+ free(revs->commits);
+ revs->commits = list;
+ return c;
+ }
+
if (0 < revs->skip_count) {
while ((c = get_revision_1(revs)) != NULL) {
if (revs->skip_count-- <= 0)
diff --git a/revision.h b/revision.h
index d93481f68f53a657fe4b174e4a12777efe6a74bb..5fec1846f366f1aadabc6f57edcfd17828afa8ee 100644 (file)
--- a/revision.h
+++ b/revision.h
unpacked:1, /* see also ignore_packed below */
boundary:1,
left_right:1,
- parents:1;
+ parents:1,
+ reverse:2;
/* Diff flags */
unsigned int diff:1,