git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Improve git-prune -n output
@ 2006-10-26 10:38 Andy Parkins
  2006-10-26 17:21 ` Junio C Hamano
  2006-10-26 17:33 ` Andy Whitcroft
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Parkins @ 2006-10-26 10:38 UTC (permalink / raw)
  To: git

prune_object() in show_only mode would previously just show the path to the
object that would be deleted.  The path the object is stored in shouldn't be
shown to users, they only know about sha1 identifiers so show that instead.

Further, the sha1 alone isn't that useful for examining what is going to be
deleted.  This patch also adds the object type to the output, which makes it
easy to pick out, say, the commits and use git-show to display them.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 builtin-prune.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-prune.c b/builtin-prune.c
index 7290e6d..e3bcf5f 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -16,8 +16,13 @@ static struct rev_info revs;
 
 static int prune_object(char *path, const char *filename, const unsigned char *sha1)
 {
+	char type[20];
+
 	if (show_only) {
-		printf("would prune %s/%s\n", path, filename);
+		if (sha1_object_info(sha1, type, NULL)) {
+			strcpy( type, "unknown type" );
+		}
+		printf("would prune %s %s\n", sha1_to_hex( sha1 ), type );
 		return 0;
 	}
 	unlink(mkpath("%s/%s", path, filename));
-- 
1.4.2.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] Improve git-prune -n output
@ 2006-11-02 11:12 Andy Parkins
  2006-11-03  2:40 ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Parkins @ 2006-11-02 11:12 UTC (permalink / raw)
  To: git

prune_object() in show_only mode would previously just show the path to the
object that would be deleted.  The path the object is stored in shouldn't be
shown to users, they only know about sha1 identifiers so show that instead.

Further, the sha1 alone isn't that useful for examining what is going to be
deleted.  This patch also adds the object type to the output, which makes it
easy to pick out, say, the commits and use git-show to display them.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 builtin-prune.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin-prune.c b/builtin-prune.c
index d853902..286a94c 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -16,8 +16,14 @@ static struct rev_info revs;
 
 static int prune_object(char *path, const char *filename, const unsigned char *sha1)
 {
+	char buf[20];
+	const char *type;
+
 	if (show_only) {
-		printf("would prune %s/%s\n", path, filename);
+		type = buf;
+		if (sha1_object_info(sha1, type, NULL))
+			type = "unknown";
+		printf("%s %s\n", sha1_to_hex(sha1), type );
 		return 0;
 	}
 	unlink(mkpath("%s/%s", path, filename));
-- 
1.4.3.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-11-03  2:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 10:38 [PATCH] Improve git-prune -n output Andy Parkins
2006-10-26 17:21 ` Junio C Hamano
2006-10-26 17:37   ` Andy Parkins
2006-10-27  8:37   ` Andy Parkins
2006-10-28 14:00     ` Jakub Narebski
2006-10-28 20:37       ` Junio C Hamano
2006-10-26 17:33 ` Andy Whitcroft
2006-10-27  1:45   ` Petr Baudis
2006-10-27  8:19   ` Andy Parkins
2006-10-27  9:09     ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2006-11-02 11:12 Andy Parkins
2006-11-03  2:40 ` Junio C Hamano

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).