git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 3/4] fix output for deleted submodules in git diff --submodule-summary
Date: Wed, 14 Oct 2009 20:31:40 +0200	[thread overview]
Message-ID: <4AD6190C.4050804@web.de> (raw)
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

  parent reply	other threads:[~2009-10-14 18:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12  3:18 What's cooking in git.git (Oct 2009, #02; Sun, 11) Junio C Hamano
2009-10-12  5:14 ` Jeff King
2009-10-12 22:52   ` Junio C Hamano
2009-10-14  4:24     ` Jeff King
2009-10-12  6:23 ` Sverre Rabbelier
2009-10-14 18:29 ` Jens Lehmann
2009-10-14 18:30   ` [PATCH 1/4] Add the --submodule-summary option to the diff option family Jens Lehmann
2009-10-14 18:31   ` [PATCH 2/4] fix indentation depth for git diff --submodule-summary Jens Lehmann
2009-10-14 18:31   ` Jens Lehmann [this message]
2009-10-14 18:32   ` [PATCH 4/4] add tests " Jens Lehmann
2009-10-14 20:34   ` submodule-summary Junio C Hamano
2009-10-14 21:27     ` submodule-summary Jens Lehmann
2009-10-14 22:42       ` submodule-summary Junio C Hamano
2009-10-15 10:34         ` submodule-summary Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AD6190C.4050804@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).