Skip to content

Commit

Permalink
Improve git-prune -n output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Parkins authored and Junio C Hamano committed Nov 22, 2006
1 parent 5942706 commit 21f88ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builtin-prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 21f88ac

Please sign in to comment.