All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] --walk-reflogs: disallow uninteresting commits
Date: Sat, 20 Jan 2007 01:39:39 -0800	[thread overview]
Message-ID: <7vr6tq82as.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0701201029400.22628@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Sat, 20 Jan 2007 10:32:16 +0100 (CET)")

Here is what I have at the top of the topic (after a few fixups,
so it might not apply directly).

-- >8 --
[PATCH] Fix --walk-reflog with --pretty=oneline

Now, "git log --abbrev-commit --pretty=o --walk-reflogs HEAD" is
reasonably pleasant to use.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Documentation/git-rev-list.txt |    4 +++-
 log-tree.c                     |    3 ++-
 reflog-walk.c                  |   33 ++++++++++++++++++++++-----------
 reflog-walk.h                  |    2 +-
 4 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index fcc540b..a996f6c 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -27,6 +27,7 @@ SYNOPSIS
 	     [ \--pretty | \--header ]
 	     [ \--bisect ]
 	     [ \--merge ]
+	     [ \--walk-reflogs ]
 	     <commit>... [ \-- <paths>... ]
 
 DESCRIPTION
@@ -203,7 +204,8 @@ this causes the output to have two extra lines of information
 taken from the reflog.  By default, 'commit@{Nth}' notation is
 used in the output.  When the starting commit is specified as
 'commit@{now}', output also uses 'commit@{timestamp}' notation
-instead.
+instead.  Under '\--pretty=oneline', the commit message is
+prefixed with this information on the same line.
 
 --merge::
 
diff --git a/log-tree.c b/log-tree.c
index f043ad3..c0fa096 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -225,7 +225,8 @@ void show_log(struct rev_info *opt, const char *sep)
 		       diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
 		putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
 		if (opt->reflog_info)
-			show_reflog_message(opt->reflog_info);
+			show_reflog_message(opt->reflog_info,
+				    opt->commit_format == CMIT_FMT_ONELINE);;
 	}
 
 	/*
diff --git a/reflog-walk.c b/reflog-walk.c
index 989a7ae..8ccbe97 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -219,21 +219,32 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
 	commit->object.flags &= ~(ADDED | SEEN | SHOWN);
 }
 
-void show_reflog_message(struct reflog_walk_info* info)
+void show_reflog_message(struct reflog_walk_info* info, int oneline)
 {
 	if (info && info->last_commit_reflog) {
 		struct commit_reflog *commit_reflog = info->last_commit_reflog;
 		struct reflog_info *info;
 
-		printf("Reflog: %s@{", commit_reflog->reflogs->ref);
-		info = &commit_reflog->reflogs->items[commit_reflog->recno + 1];
-		if (commit_reflog->flag)
-			printf("%s", show_rfc2822_date(info->timestamp,
-						info->tz));
-		else
-			printf("%d", commit_reflog->reflogs->nr
-					- 2 - commit_reflog->recno);
-		printf("} (%s)\nReflog message: %s",
-			info->email, info->message);
+		info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
+		if (oneline) {
+			printf("%s@{", commit_reflog->reflogs->ref);
+			if (commit_reflog->flag)
+				printf("%s", show_date(info->timestamp, 0, 1));
+			else
+				printf("%d", commit_reflog->reflogs->nr
+				       - 2 - commit_reflog->recno);
+			printf("}: ");
+		}
+		else {
+			printf("Reflog: %s@{", commit_reflog->reflogs->ref);
+			if (commit_reflog->flag)
+				printf("%s", show_rfc2822_date(info->timestamp,
+							       info->tz));
+			else
+				printf("%d", commit_reflog->reflogs->nr
+				       - 2 - commit_reflog->recno);
+			printf("} (%s)\nReflog message: %s",
+			       info->email, info->message);
+		}
 	}
 }
diff --git a/reflog-walk.h b/reflog-walk.h
index 787996b..e63d867 100644
--- a/reflog-walk.h
+++ b/reflog-walk.h
@@ -6,6 +6,6 @@ extern void add_reflog_for_walk(struct reflog_walk_info *info,
 		struct commit *commit, const char *name);
 extern void fake_reflog_parent(struct reflog_walk_info *info,
 		struct commit *commit);
-extern void show_reflog_message(struct reflog_walk_info* info);
+extern void show_reflog_message(struct reflog_walk_info *info, int);
 
 #endif
-- 
1.5.0.rc1.g33dd1

      reply	other threads:[~2007-01-20  9:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 23:51 [PATCH 3/3] show-branch --reflog: show the reflog message at the top Junio C Hamano
2007-01-20  0:16 ` Johannes Schindelin
2007-01-20  0:23   ` Junio C Hamano
2007-01-20  0:42     ` Johannes Schindelin
2007-01-20  0:53       ` Junio C Hamano
2007-01-20  1:19         ` Johannes Schindelin
2007-01-20  1:32           ` Junio C Hamano
2007-01-20  2:28             ` [PATCH] --walk-reflogs: disallow uninteresting commits Johannes Schindelin
2007-01-20  7:21               ` Junio C Hamano
2007-01-20  9:32                 ` Johannes Schindelin
2007-01-20  9:39                   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr6tq82as.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.