From 2d96dbc41a72628f88529a285b6a8dae834a33d0 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Mon, 5 Oct 2009 19:24:48 +0200 Subject: [PATCH] fix output for deleted submodules in git diff --submodule-summary When a submodule has been deleted, add_submodule_odb() returns false because the directory of the submodule is gone. So we have to test the second sha for null before we call add_submodule_odb() to get the correct output. Signed-off-by: Jens Lehmann --- submodule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/submodule.c b/submodule.c index 11fce7de65..54c8de8971 100644 --- a/submodule.c +++ b/submodule.c @@ -45,12 +45,12 @@ void show_submodule_summary(FILE *f, const char *path, static const char *format = " %m %s"; int fast_forward = 0, fast_backward = 0; - if (add_submodule_odb(path)) + if (is_null_sha1(two)) + message = "(submodule deleted)"; + else if (add_submodule_odb(path)) message = "(not checked out)"; else if (is_null_sha1(one)) message = "(new submodule)"; - else if (is_null_sha1(two)) - message = "(submodule deleted)"; else if (!(left = lookup_commit_reference(one)) || !(right = lookup_commit_reference(two))) message = "(commits not present)"; -- 2.11.4.GIT