@ -212,8 +212,25 @@ func Diff(ctx *context.Context) { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						userName  :=  ctx . Repo . Owner . Name   
					 
					 
					 
						userName  :=  ctx . Repo . Owner . Name   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						repoName  :=  ctx . Repo . Repository . Name   
					 
					 
					 
						repoName  :=  ctx . Repo . Repository . Name   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						commitID  :=  ctx . Params ( ":sha" )   
					 
					 
					 
						commitID  :=  ctx . Params ( ":sha" )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						var  (   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							gitRepo   * git . Repository   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							err       error   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							repoPath  string   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						)   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						if  ctx . Data [ "PageIsWiki" ]  !=  nil  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							gitRepo ,  err  =  git . OpenRepository ( ctx . Repo . Repository . WikiPath ( ) )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							if  err  !=  nil  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
								ctx . ServerError ( "Repo.GitRepo.GetCommit" ,  err )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
								return   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							}   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							repoPath  =  ctx . Repo . Repository . WikiPath ( )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						}  else  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							gitRepo  =  ctx . Repo . GitRepo   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							repoPath  =  models . RepoPath ( userName ,  repoName )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						}   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						commit ,  err  :=  ctx . Repo . GitRepo . GetCommit ( commitID )   
					 
					 
					 
						commit ,  err  :=  g itRepo. GetCommit ( commitID )   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
						if  err  !=  nil  {   
					 
					 
					 
						if  err  !=  nil  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							if  git . IsErrNotExist ( err )  {   
					 
					 
					 
							if  git . IsErrNotExist ( err )  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
								ctx . NotFound ( "Repo.GitRepo.GetCommit" ,  err )   
					 
					 
					 
								ctx . NotFound ( "Repo.GitRepo.GetCommit" ,  err )   
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -233,7 +250,7 @@ func Diff(ctx *context.Context) { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						ctx . Data [ "CommitStatus" ]  =  models . CalcCommitStatus ( statuses )   
					 
					 
					 
						ctx . Data [ "CommitStatus" ]  =  models . CalcCommitStatus ( statuses )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						diff ,  err  :=  gitdiff . GetDiffCommit ( models . RepoPath ( userName ,  repoName ) ,   
					 
					 
					 
						diff ,  err  :=  gitdiff . GetDiffCommit ( repoPath ,   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
							commitID ,  setting . Git . MaxGitDiffLines ,   
					 
					 
					 
							commitID ,  setting . Git . MaxGitDiffLines ,   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							setting . Git . MaxGitDiffLineCharacters ,  setting . Git . MaxGitDiffFiles )   
					 
					 
					 
							setting . Git . MaxGitDiffLineCharacters ,  setting . Git . MaxGitDiffFiles )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						if  err  !=  nil  {   
					 
					 
					 
						if  err  !=  nil  {   
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -258,7 +275,7 @@ func Diff(ctx *context.Context) { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						var  parentCommit  * git . Commit   
					 
					 
					 
						var  parentCommit  * git . Commit   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						if  commit . ParentCount ( )  >  0  {   
					 
					 
					 
						if  commit . ParentCount ( )  >  0  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							parentCommit ,  err  =  ctx . Repo . G itRepo. GetCommit ( parents [ 0 ] )   
					 
					 
					 
							parentCommit ,  err  =  g itRepo. GetCommit ( parents [ 0 ] )   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
							if  err  !=  nil  {   
					 
					 
					 
							if  err  !=  nil  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
								ctx . NotFound ( "GetParentCommit" ,  err )   
					 
					 
					 
								ctx . NotFound ( "GetParentCommit" ,  err )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
								return   
					 
					 
					 
								return   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -298,8 +315,14 @@ func Diff(ctx *context.Context) { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					// RawDiff dumps diff results of repository in given commit ID to io.Writer
  
					 
					 
					 
					// RawDiff dumps diff results of repository in given commit ID to io.Writer
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					func  RawDiff ( ctx  * context . Context )  {  
					 
					 
					 
					func  RawDiff ( ctx  * context . Context )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						var  repoPath  string   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						if  ctx . Data [ "PageIsWiki" ]  !=  nil  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							repoPath  =  ctx . Repo . Repository . WikiPath ( )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						}  else  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
							repoPath  =  models . RepoPath ( ctx . Repo . Owner . Name ,  ctx . Repo . Repository . Name )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
						}   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
						if  err  :=  git . GetRawDiff (   
					 
					 
					 
						if  err  :=  git . GetRawDiff (   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							models . RepoPath ( ctx . Repo . Owner . Name ,  ctx . Repo . Repository . Name ) ,   
					 
					 
					 
							repoPath ,   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
							ctx . Params ( ":sha" ) ,   
					 
					 
					 
							ctx . Params ( ":sha" ) ,   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							git . RawDiffType ( ctx . Params ( ":ext" ) ) ,   
					 
					 
					 
							git . RawDiffType ( ctx . Params ( ":ext" ) ) ,   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							ctx . Resp ,   
					 
					 
					 
							ctx . Resp ,