'git log' on a newly initialized repository (before any commits) shows an ugly message. Signed-off-by: Leila Muhtasib <muhtasib@xxxxxxxxx> --- I found this bug on the debian git bug list. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=412890 See scenario below: % mkdir test % cd test % git init Initialized empty Git repository in .git/ % git log fatal: bad default revision 'HEAD' I've reworded the error message to something friendlier. I can change the message or add something like the link suggests about 'Create or switch to an existent branch." But I don't feel like that message quite captures the scenario of initializing a new repository. Alternatively, we can print the message using printf and exit successfully instead of using 'die'. Thanks, Leila revision.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index 935e7a7..96add37 100644 --- a/revision.c +++ b/revision.c @@ -1821,8 +1821,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s unsigned char sha1[20]; struct object *object; unsigned mode; - if (get_sha1_with_mode(revs->def, sha1, &mode)) - die("bad default revision '%s'", revs->def); + if (get_sha1_with_mode(revs->def, sha1, &mode)) { + if (!strcmp(argv[0], "log") && !strcmp(revs->def, "HEAD")) + die("No commits to display."); + else + die("bad default revision '%s'", revs->def); + } object = get_reference(revs, revs->def, sha1, 0); add_pending_object_with_mode(revs, object, revs->def, mode); } -- 1.7.7.5 (Apple Git-26) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html