aboutsummaryrefslogtreecommitdiff
path: root/builtin-prune.c
diff options
context:
space:
mode:
authorAndy Parkins <andyparkins@gmail.com>2006-11-02 12:12:26 +0100
committerJunio C Hamano <junkio@cox.net>2006-11-21 19:02:08 -0800
commit21f88ac84a024fcc73a22547e51509aa1459ab03 (patch)
treec41feb1d22e147e839ed7ef4c493439dc8a56373 /builtin-prune.c
parent594270635732d6320d6e6d7fa127679ae90ef5b1 (diff)
downloadgit-21f88ac84a024fcc73a22547e51509aa1459ab03.tar.gz
git-21f88ac84a024fcc73a22547e51509aa1459ab03.tar.xz
Improve git-prune -n output
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-prune.c')
-rw-r--r--builtin-prune.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin-prune.c b/builtin-prune.c
index d853902c5..286a94c3f 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));