Refactored: Move some logic to CGitDiff
[TortoiseGit.git] / src / TortoiseProc / GitDiff.h
blob604b47c47df1f10371877e1423c86ced0bc8cf73
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2014 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
21 #include "TGitPath.h"
22 #include "GitStatus.h"
23 #include "Git.h"
25 class CGitDiff
27 public:
28 CGitDiff(void);
29 ~CGitDiff(void);
31 enum ChangeType
33 Unknown,
34 NewSubmodule,
35 DeleteSubmodule,
36 FastForward,
37 Rewind,
38 NewerTime,
39 OlderTime,
40 SameTime
42 static void GetSubmoduleChangeType(CGit& subgit, const CString& oldhash, const CString& newhash, bool& oldOK, bool& newOK, ChangeType& changeType, CString& oldsub, CString& newsub);
44 // Use two path to handle rename cases
45 static int Diff(const CTGitPath * pPath1, const CTGitPath *pPath2, git_revnum_t rev1, git_revnum_t rev2, bool blame = false, bool unified = false, int jumpToLine = 0);
46 static int SubmoduleDiff(const CTGitPath * pPath1, const CTGitPath *pPath2, const git_revnum_t &rev1, const git_revnum_t &rev2, bool blame = false, bool unified = false);
47 static int DiffNull(const CTGitPath *pPath, git_revnum_t rev1, bool bIsAdd = true, int jumpToLine = 0);
48 static int DiffCommit(const CTGitPath &path, const GitRev *r1, const GitRev *r2);
49 static int DiffCommit(const CTGitPath &path1, const CTGitPath &path2, const GitRev *r1, const GitRev *r2);
50 static int DiffCommit(const CTGitPath &path, const CString &r1, const CString &r2);
51 static int DiffCommit(const CTGitPath &path1, const CTGitPath &path2, const CString &r1, const CString &r2);
52 static int SubmoduleDiffNull(const CTGitPath * pPath1, const git_revnum_t &rev1);