git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>,
	Lars Hjemli <hjemli@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add the --submodule-summary option to the diff option family
Date: Mon, 05 Oct 2009 19:32:43 +0200	[thread overview]
Message-ID: <4ACA2DBB.5030908@web.de> (raw)
In-Reply-To: <4AC9D6EB.8090002@web.de>

A bug showed up in the tests, deleted submodules were labelled
"(not checked out)" instead of "(submodule deleted)". This patch
fixes that.

--------------------------8<--------------------
[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 <Jens.Lehmann@web.de>
---
 submodule.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/submodule.c b/submodule.c
index 11fce7d..54c8de8 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.rc2.210.gac56a4.dirty

  reply	other threads:[~2009-10-05 17:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1254668669u.git.johannes.schindelin@gmx.de>
2009-10-04 15:05 ` [PATCH] Add the --submodule-summary option to the diff option family Johannes Schindelin
2009-10-04 22:19   ` Junio C Hamano
2009-10-05  6:18     ` Johannes Sixt
2009-10-05  9:00       ` Johannes Schindelin
2009-10-05  9:09         ` Johannes Sixt
2009-10-05  9:20           ` Johannes Schindelin
     [not found]     ` <alpine.DEB.1.00.0910051027010.4985@pacific.mpi-cbg.de>
2009-10-05  9:21       ` Johannes Schindelin
2009-10-05 11:22       ` Jens Lehmann
2009-10-05 17:32         ` Jens Lehmann [this message]
2009-10-05 20:39           ` Johannes Schindelin
2009-10-05 19:08       ` Junio C Hamano
2009-10-05 21:08         ` Johannes Schindelin
2009-10-06 10:58           ` Jens Lehmann
2009-10-06 11:36             ` Junio C Hamano
2009-10-06 11:45               ` Johannes Schindelin
2009-10-06 11:51                 ` Jens Lehmann
2009-10-06 12:10                   ` Johannes Schindelin
2009-10-07 19:32               ` Jens Lehmann
2009-10-07 20:00                 ` Junio C Hamano
2009-10-07 22:28                   ` Johannes Schindelin

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=4ACA2DBB.5030908@web.de \
    --to=jens.lehmann@web.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hjemli@gmail.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).