[PATCH 3/4] fix output for deleted submodules in git diff --submodule-summary
- From
Jens Lehmann <jens.lehmann@web.de>
- Date
- Oct 14, 2009, 18:31 UTC
- Message-ID
- <4AD6190C.4050804@web.de>
- In-Reply-To
- <4AD61880.4040600@web.de>
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 <Jens.Lehmann@web.de> --- submodule.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/submodule.c b/submodule.c index 5076113..d5fce7a 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)";
-- 1.6.5.4.g707c