Permalink
Browse files

Do not always include staged files

Signed-off-by: Sven Strickroth <email@cs-ware.de>
  • Loading branch information...
csware authored and ch3cooli committed Oct 13, 2018
1 parent bc93206 commit 7c7c1f3831f2bd0e532e15503d3009a2c260a8e7
@@ -8170,6 +8170,10 @@ msgstr ""
msgid "Show Whitespaces"
msgstr ""
#. Resource IDs: (Dialog IDD_CHANGEDFILES: Control id 1210)
msgid "Show all &staged files"
msgstr ""
#. Resource IDs: (32813)
msgid "Show an overview of the whole graph"
msgstr ""
@@ -18,6 +18,8 @@ Released: unreleased
* CommitDlg: commit.template did not honor "~/"
* Fixed issue #3281: TortoiseGitUDiff preferences page clips out text in Russian translation
* Fixed issue #3284: BrowseRefsDlg: Cannot compare annotated tag to working tree (libgit2 returned the requested type does not match the type in ODB)
* Modified files, Revert, and Resolve dialogs did show all staged files regardless of selection
The Commit dialog still shows all staged files, this is by design and required for commit to work properly (e.g., that no files get lost in a merge commit).
= Release 2.7.0 =
Released: 2018-08-19
@@ -3188,7 +3188,7 @@ bool CGit::LoadTextFile(const CString &filename, CString &msg)
return true; // load no further files
}
int CGit::GetWorkingTreeChanges(CTGitPathList& result, bool amend, const CTGitPathList* filterlist)
int CGit::GetWorkingTreeChanges(CTGitPathList& result, bool amend, const CTGitPathList* filterlist, bool includedStaged /* = false */)
{
if (IsInitRepos())
return GetInitAddList(result);
@@ -3225,8 +3225,13 @@ int CGit::GetWorkingTreeChanges(CTGitPathList& result, bool amend, const CTGitPa
}
// also list staged files which will be in the commit
cmd.Format(L"git.exe diff-index --cached --raw %s --numstat -C%d%% -M%d%% -z --", (LPCTSTR)head, ms_iSimilarityIndexThreshold, ms_iSimilarityIndexThreshold);
Run(cmd, &cmdout);
if (includedStaged || !filterlist)
Run(L"git.exe diff-index --cached --raw " + head + L" --numstat -C -M -z --", &cmdout);
else
{
cmd.Format(L"git.exe diff-index --cached --raw %s --numstat -C -M -z -- \"%s\"", (LPCTSTR)head, (LPCTSTR)(*filterlist)[i].GetGitPathString());
Run(cmd, &cmdout);
}
if (!filterlist)
cmd.Format(L"git.exe diff-index --raw %s --numstat -C%d%% -M%d%% -z --", (LPCTSTR)head, ms_iSimilarityIndexThreshold, ms_iSimilarityIndexThreshold);
@@ -431,7 +431,7 @@ class CGit
int GetCommitDiffList(const CString &rev1, const CString &rev2, CTGitPathList &outpathlist, bool ignoreSpaceAtEol = false, bool ignoreSpaceChange = false, bool ignoreAllSpace = false, bool ignoreBlankLines = false);
int GetInitAddList(CTGitPathList &outpathlist);
int GetWorkingTreeChanges(CTGitPathList& result, bool amend = false, const CTGitPathList* filterlist = nullptr);
int GetWorkingTreeChanges(CTGitPathList& result, bool amend = false, const CTGitPathList* filterlist = nullptr, bool includedStaged = false);
static __int64 filetime_to_time_t(__int64 winTime)
{
@@ -273,6 +273,7 @@ CGitStatusListCtrl::CGitStatusListCtrl() : CResizableColumnsListCtrl<CListCtrl>(
, m_nLineDeleted(0)
, m_nBlockItemChangeHandler(0)
, m_uiFont(nullptr)
, m_bIncludedStaged(false)
{
m_critSec.Init();
m_bNoAutoselectMissing = CRegDWORD(L"Software\\TortoiseGit\\AutoselectMissingFiles", FALSE) == TRUE;
@@ -3688,7 +3689,8 @@ int CGitStatusListCtrl::UpdateFileList(const CTGitPathList* list)
CAutoWriteLock locker(m_guard);
m_CurrentVersion = GIT_REV_ZERO;
g_Git.GetWorkingTreeChanges(m_StatusFileList, m_amend, list);
ATLASSERT(!(m_amend && !m_bIncludedStaged)); // just a safeguard that we always show all files if we want to amend (amending should only be the used from commitdlg)
g_Git.GetWorkingTreeChanges(m_StatusFileList, m_amend, list, m_bIncludedStaged);
BOOL bDeleteChecked = FALSE;
int deleteFromIndex = 0;
@@ -628,6 +628,8 @@ class CGitStatusListCtrl :
bool m_amend; ///< if true show the changes to the revision before the last commit
bool m_bIncludedStaged;
CString m_sUUID; ///< the UUID of the associated repository
CString m_sDisplayedBranch; ///< When on LogDialog, what is the current displayed branch
@@ -166,8 +166,8 @@ BEGIN
PUSHBUTTON "Help",IDHELP,187,133,50,14
END
IDD_CHANGEDFILES DIALOGEX 0, 0, 520, 228
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
IDD_CHANGEDFILES DIALOGEX 0, 0, 520, 243
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Working Tree"
FONT 9, "MS Shell Dlg 2", 400, 0, 0x1
BEGIN
@@ -177,14 +177,15 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,181,263,10
CONTROL "Show i&gnored files",IDC_SHOWIGNORED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,191,263,10
CONTROL "Show un&modified files",IDC_SHOWUNMODIFIED,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,201,263,10
CONTROL "Show &Whole Project",IDC_WHOLE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,201,263,10
CONTROL "Show all &staged files",IDC_SHOWSTAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,201,263,10
CONTROL "Show &Whole Project",IDC_WHOLE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,211,263,10
LTEXT "",IDC_SUMMARYTEXT,294,193,219,13
EDITTEXT IDC_INFOLABEL,294,169,219,23,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
PUSHBUTTON "Save unified diff",IDC_BUTTON_UNIFIEDDIFF,109,207,119,14
PUSHBUTTON "Stash",IDC_BUTTON_STASH,236,207,68,14
PUSHBUTTON "Commit",IDC_COMMIT,312,207,67,14
PUSHBUTTON "&Refresh",IDC_REFRESH,388,207,67,14
DEFPUSHBUTTON "OK",IDOK,463,207,50,14
PUSHBUTTON "Save unified diff",IDC_BUTTON_UNIFIEDDIFF,109,222,119,14
PUSHBUTTON "Stash",IDC_BUTTON_STASH,236,222,68,14
PUSHBUTTON "Commit",IDC_COMMIT,312,222,67,14
PUSHBUTTON "&Refresh",IDC_REFRESH,388,222,67,14
DEFPUSHBUTTON "OK",IDOK,463,222,50,14
END
IDD_LOGMESSAGE DIALOGEX 0, 0, 422, 331
@@ -2255,7 +2256,7 @@ BEGIN
RIGHTMARGIN, 513
VERTGUIDE, 312
TOPMARGIN, 7
BOTTOMMARGIN, 221
BOTTOMMARGIN, 236
END
IDD_LOGMESSAGE, DIALOG
@@ -1,4 +1,4 @@
// TortoiseGit - a Windows shell extension for easy version control
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008-2018 - TortoiseGit
// Copyright (C) 2003-2008 - TortoiseSVN
@@ -38,6 +38,7 @@ CChangedDlg::CChangedDlg(CWnd* pParent /*=nullptr*/)
, m_bShowLocalChangesIgnored(FALSE)
, m_bWholeProject(FALSE)
, m_bRemote(FALSE)
, m_bShowStaged(TRUE)
{
}
@@ -55,6 +56,7 @@ void CChangedDlg::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_SHOWIGNORED, m_bShowIgnored);
DDX_Check(pDX, IDC_SHOWLOCALCHANGESIGNORED, m_bShowLocalChangesIgnored);
DDX_Check(pDX, IDC_WHOLE_PROJECT, m_bWholeProject);
DDX_Check(pDX, IDC_SHOWSTAGED, m_bShowStaged);
}
@@ -70,6 +72,7 @@ BEGIN_MESSAGE_MAP(CChangedDlg, CResizableStandAloneDialog)
ON_BN_CLICKED(IDC_BUTTON_UNIFIEDDIFF, &CChangedDlg::OnBnClickedButtonUnifieddiff)
ON_BN_CLICKED(IDC_SHOWLOCALCHANGESIGNORED, &CChangedDlg::OnBnClickedShowlocalchangesignored)
ON_BN_CLICKED(IDC_WHOLE_PROJECT, OnBnClickedWholeProject)
ON_BN_CLICKED(IDC_SHOWSTAGED, OnBnClickedShowStaged)
END_MESSAGE_MAP()
BOOL CChangedDlg::OnInitDialog()
@@ -83,6 +86,8 @@ BOOL CChangedDlg::OnInitDialog()
regPath.Replace(L':', L'_');
m_regShowWholeProject = CRegDWORD(L"Software\\TortoiseGit\\TortoiseProc\\ShowWholeProject\\" + regPath, FALSE);
m_bWholeProject = m_regShowWholeProject;
m_regShowStaged = CRegDWORD(L"Software\\TortoiseGit\\TortoiseProc\\ChangedFilesIncludeStaged", TRUE);
m_bShowStaged = m_regShowStaged;
SetDlgTitle();
if (m_pathList.GetCount() == 1 && m_pathList[0].GetWinPathString().IsEmpty())
@@ -103,6 +108,7 @@ BOOL CChangedDlg::OnInitDialog()
AdjustControlSize(IDC_SHOWLOCALCHANGESIGNORED);
AdjustControlSize(IDC_SHOWIGNORED);
AdjustControlSize(IDC_WHOLE_PROJECT);
AdjustControlSize(IDC_SHOWSTAGED);
AddAnchor(IDC_CHANGEDLIST, TOP_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_SUMMARYTEXT, BOTTOM_LEFT, BOTTOM_RIGHT);
@@ -111,6 +117,7 @@ BOOL CChangedDlg::OnInitDialog()
AddAnchor(IDC_SHOWLOCALCHANGESIGNORED, BOTTOM_LEFT);
AddAnchor(IDC_SHOWIGNORED, BOTTOM_LEFT);
AddAnchor(IDC_WHOLE_PROJECT, BOTTOM_LEFT);
AddAnchor(IDC_SHOWSTAGED, BOTTOM_LEFT);
AddAnchor(IDC_INFOLABEL, BOTTOM_RIGHT);
AddAnchor(IDC_BUTTON_STASH, BOTTOM_RIGHT);
AddAnchor(IDC_BUTTON_UNIFIEDDIFF, BOTTOM_RIGHT);
@@ -152,11 +159,13 @@ UINT CChangedDlg::ChangedStatusThread()
DialogEnableWindow(IDC_SHOWUNMODIFIED, FALSE);
DialogEnableWindow(IDC_SHOWIGNORED, FALSE);
DialogEnableWindow(IDC_SHOWLOCALCHANGESIGNORED, FALSE);
DialogEnableWindow(IDC_SHOWSTAGED, FALSE);
g_Git.RefreshGitIndex();
m_FileListCtrl.StoreScrollPos();
m_FileListCtrl.Clear();
m_FileListCtrl.m_bIncludedStaged = (m_bShowStaged == TRUE);
if (!m_FileListCtrl.GetStatus(m_bWholeProject ? nullptr : &m_pathList, m_bRemote, m_bShowIgnored != FALSE, m_bShowUnversioned != FALSE, m_bShowLocalChangesIgnored != FALSE))
{
if (!m_FileListCtrl.GetLastErrorMessage().IsEmpty())
@@ -181,6 +190,7 @@ UINT CChangedDlg::ChangedStatusThread()
//DialogEnableWindow(IDC_SHOWUNMODIFIED, bIsDirectory);
DialogEnableWindow(IDC_SHOWIGNORED, bIsDirectory);
DialogEnableWindow(IDC_SHOWLOCALCHANGESIGNORED, TRUE);
DialogEnableWindow(IDC_SHOWSTAGED, TRUE);
InterlockedExchange(&m_bBlock, FALSE);
// revert the remote flag back to the default
m_bRemote = !!(DWORD)CRegDWORD(L"Software\\TortoiseGit\\CheckRepo", FALSE);
@@ -450,3 +460,10 @@ void CChangedDlg::OnBnClickedWholeProject()
m_regShowWholeProject = m_bWholeProject;
OnBnClickedRefresh();
}
void CChangedDlg::OnBnClickedShowStaged()
{
UpdateData();
m_regShowStaged = m_bShowStaged;
OnBnClickedRefresh();
}
@@ -1,6 +1,6 @@
// TortoiseGit - a Windows shell extension for easy version control
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008, 2011-2017 - TortoiseGit
// Copyright (C) 2008, 2011-2018 - TortoiseGit
// Copyright (C) 2003-2006,2008 - Stefan Kueng
// This program is free software; you can redistribute it and/or
@@ -55,6 +55,7 @@ class CChangedDlg : public CResizableStandAloneDialog
afx_msg void OnBnClickedShowignored();
afx_msg void OnBnClickedShowlocalchangesignored();
afx_msg void OnBnClickedWholeProject();
afx_msg void OnBnClickedShowStaged();
afx_msg LRESULT OnSVNStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
afx_msg LRESULT OnSVNStatusListCtrlItemCountChanged(WPARAM, LPARAM);
@@ -83,6 +84,7 @@ class CChangedDlg : public CResizableStandAloneDialog
private:
CRegDWORD m_regAddBeforeCommit;
CRegDWORD m_regShowWholeProject;
CRegDWORD m_regShowStaged;
CGitStatusListCtrl m_FileListCtrl;
bool m_bRemote;
BOOL m_bShowUnversioned;
@@ -93,5 +95,6 @@ class CChangedDlg : public CResizableStandAloneDialog
bool m_bCanceled;
BOOL m_bShowIgnored;
BOOL m_bWholeProject;
BOOL m_bShowStaged;
};
@@ -1319,6 +1319,7 @@ UINT CCommitDlg::StatusThread()
BOOL success;
CTGitPathList *pList;
m_ListCtrl.m_amend = (m_bCommitAmend==TRUE || m_bForceCommitAmend) && (m_bAmendDiffToLastCommit==FALSE);
m_ListCtrl.m_bIncludedStaged = true;
m_ListCtrl.m_bDoNotAutoselectSubmodules = (m_bDoNotAutoselectSubmodules == TRUE);
if(m_bWholeProject || m_bWholeProject2)
@@ -182,7 +182,7 @@ int CGitLogListBase::AsyncDiffThread()
pRev->m_ParentHash.clear();
pRev->m_ParentHash.push_back(m_HeadHash);
g_Git.RefreshGitIndex();
g_Git.GetWorkingTreeChanges(files);
g_Git.GetWorkingTreeChanges(files, false, nullptr, true); // filtering is done in LogDlg.cpp
auto& action = pRev->GetAction(this);
action = 0;
for (int j = 0; j < files.GetCount(); ++j)
@@ -522,6 +522,7 @@
#define IDC_SHOWUNMODIFIED 1209
#define IDS_PROC_SYNC_FETCH 1209
#define IDS_PROC_SYNC_FETCHREBASE 1210
#define IDC_SHOWSTAGED 1210
#define IDS_LOG_REVERT_CONFIRM 1211
#define IDS_PROC_SYNC_REMOTEUPDATE 1212
#define IDS_PROC_SYNC_CLEANUPSTALEBRANCHES 1213
Oops, something went wrong.

0 comments on commit 7c7c1f3

Please sign in to comment.