#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=47

tigrc <<EOF
set vertical-split = no
EOF

steps '
	:save-display log-submodule.screen

	:toggle log-options --submodule -p
	:save-display log-submodule-diff.screen
'

test_setup_work_dir()
{
	git_clone 'repo-two' .
	git submodule init
	git submodule update
}

test_tig log

assert_equals 'log-submodule.screen' <<EOF
commit 8d2fa18ab8ef94d85a99504e143279bb1ce4f719                                 
Refs: [master], {origin/master}, {origin/HEAD}                                  
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Sun Sep 6 08:23:30 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-a, repo-two-b, repo-two-c        
                                                                                
 repo-two-a | 2 +-                                                              
 repo-two-b | 2 +-                                                              
 repo-two-c | 2 +-                                                              
 3 files changed, 3 insertions(+), 3 deletions(-)                               
                                                                                
commit 02086c59d402236784ea1fd76c5e7896541ac582                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Mon Aug 3 06:54:50 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-b                                
                                                                                
 repo-two-b | 2 +-                                                              
 1 file changed, 1 insertion(+), 1 deletion(-)                                  
                                                                                
commit e35ffcb9d416d0367f3effe5997c78678dd46ced                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Wed Jul 8 17:48:20 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-a, repo-two-c                    
                                                                                
 repo-two-a | 2 +-                                                              
 repo-two-c | 2 +-                                                              
 2 files changed, 2 insertions(+), 2 deletions(-)                               
                                                                                
commit dfe0f3afc5bc19406049be37829359d2f576bf46                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Wed May 27 03:57:30 2009 +0000                                          
                                                                                
    [repo-two] Creating repository                                              
                                                                                
 .gitmodules | 9 +++++++++                                                      
 repo-two-a  | 1 +                                                              
 repo-two-b  | 1 +                                                              
 repo-two-c  | 1 +                                                              
 4 files changed, 12 insertions(+)                                              
                                                                                
commit 9bb0f0da3dd2dec58efa5d8fa9d2b1f4768504e9                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
[log] 8d2fa18ab8ef94d85a99504e143279bb1ce4f719 - line 1 of 69                65%
EOF

assert_equals 'log-submodule-diff.screen' <<EOF
commit 8d2fa18ab8ef94d85a99504e143279bb1ce4f719                                 
Refs: [master], {origin/master}, {origin/HEAD}                                  
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Sun Sep 6 08:23:30 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-a, repo-two-b, repo-two-c        
---                                                                             
 repo-two-a | 2 +-                                                              
 repo-two-b | 2 +-                                                              
 repo-two-c | 2 +-                                                              
 3 files changed, 3 insertions(+), 3 deletions(-)                               
                                                                                
Submodule repo-two-a a1d2fa2..598d4e4:                                          
  > [repo-two-a] Commit 5                                                       
Submodule repo-two-b f3866fb..8ab92f1:                                          
  > [repo-two-b] Commit 5                                                       
Submodule repo-two-c cd41885..e4b7821:                                          
  > [repo-two-c] Commit 5                                                       
                                                                                
commit 02086c59d402236784ea1fd76c5e7896541ac582                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Mon Aug 3 06:54:50 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-b                                
---                                                                             
 repo-two-b | 2 +-                                                              
 1 file changed, 1 insertion(+), 1 deletion(-)                                  
                                                                                
Submodule repo-two-b e795b27..f3866fb:                                          
  > [repo-two-b] Commit 4                                                       
  > [repo-two-b] Commit 3                                                       
                                                                                
commit e35ffcb9d416d0367f3effe5997c78678dd46ced                                 
Author: A. U. Thor <a.u.thor@example.com>                                       
Date:   Wed Jul 8 17:48:20 2009 +0000                                           
                                                                                
    [repo-two] Integrate feature from repo-two-a, repo-two-c                    
---                                                                             
 repo-two-a | 2 +-                                                              
 repo-two-c | 2 +-                                                              
 2 files changed, 2 insertions(+), 2 deletions(-)                               
                                                                                
Submodule repo-two-a 7df88b0..a1d2fa2:                                          
  > [repo-two-a] Commit 4                                                       
  > [repo-two-a] Commit 3                                                       
[log] 8d2fa18ab8ef94d85a99504e143279bb1ce4f719 - line 1 of 130               34%
EOF
