From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ping Yin Subject: [PATCH v3 4/4] buitin-status: Add tests for submodule summary Date: Sat, 12 Apr 2008 23:05:33 +0800 Message-ID: <1208012733-18211-5-git-send-email-pkufranky@gmail.com> References: <1208012733-18211-1-git-send-email-pkufranky@gmail.com> <1208012733-18211-2-git-send-email-pkufranky@gmail.com> <1208012733-18211-3-git-send-email-pkufranky@gmail.com> <1208012733-18211-4-git-send-email-pkufranky@gmail.com> Cc: git@vger.kernel.org, Ping Yin To: gitster@pobox.com X-From: git-owner@vger.kernel.org Sat Apr 12 17:06:48 2008 connect(): Connection refused Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1JkhJO-0003cF-Ry for gcvg-git-2@gmane.org; Sat, 12 Apr 2008 17:06:39 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbYDLPF4 (ORCPT ); Sat, 12 Apr 2008 11:05:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752624AbYDLPFz (ORCPT ); Sat, 12 Apr 2008 11:05:55 -0400 Received: from mail.qikoo.org ([60.28.205.235]:45352 "EHLO mail.qikoo.org" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752556AbYDLPFh (ORCPT ); Sat, 12 Apr 2008 11:05:37 -0400 Received: by mail.qikoo.org (Postfix, from userid 1029) id BCEA0470B1; Sat, 12 Apr 2008 23:05:33 +0800 (CST) X-Mailer: git-send-email 1.5.5.23.g2a5f In-Reply-To: <1208012733-18211-4-git-send-email-pkufranky@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Signed-off-by: Ping Yin --- t/t7502-status.sh | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+), 0 deletions(-) diff --git a/t/t7502-status.sh b/t/t7502-status.sh index cd08516..33882c9 100755 --- a/t/t7502-status.sh +++ b/t/t7502-status.sh @@ -149,4 +149,138 @@ test_expect_success 'status of partial commit excluding new file in index' ' test_cmp expect output ' +test_expect_success "setup status submodule summary" ' + test_create_repo sm && + cd sm && + : >foo && + git add foo && + git commit -m "Add foo" && + cd .. && + git add sm +' + +cat > expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success "status submodule summary is disabled by default" ' + git status > output && + git diff expect output +' + +head=$(cd sm && git rev-parse --short=7 --verify HEAD) + +cat > expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success "status submodule summary" ' + git config status.submodulesummary 10 && + git status > output && + git diff expect output +' + + +cat > expect <..." to update what will be committed) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +no changes added to commit (use "git add" and/or "git commit -a") +EOF +test_expect_success "status submodule summary (clean submodule)" ' + git commit -m "commit submodule" && + git config status.submodulesummary 10 && + ! git status > output && + git diff expect output +' + +cat > expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success "status submodule summary (--amend)" ' + git config status.submodulesummary 10 && + git status --amend > output && + git diff expect output +' + test_done -- 1.5.5.23.g2a5f