ide: '.git' now ignored in directory comparison tool

This commit is contained in:
Mirek Fidler 2024-08-10 16:59:44 +02:00
parent 58a79d6780
commit 5b1144ab99
3 changed files with 10 additions and 3 deletions

View file

@ -26,7 +26,7 @@ LAYOUT(EditDateLayout, 236, 62)
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(6, 24))
END_LAYOUT
LAYOUT(ProgressLayout, 320, 72)
LAYOUT(ProgressLayout, 500, 72)
ITEM(Upp::Button, stop, SetLabel(t_("Cancel")).HCenterPosZ(68, 0).BottomPosZ(4, 24))
UNTYPED(pi, HSizePosZ(4, 4).TopPosZ(28, 12))
ITEM(Upp::Label, info, HSizePosZ(4, 4).TopPosZ(4, 20))

View file

@ -217,7 +217,11 @@ void DirDiffDlg::Compare()
String p1 = AppendFileName(~dir1, f[i]);
String p2 = AppendFileName(~dir2, f[i]);
int n = NORMAL_FILE;
if((IsNull(dlim) || FileGetTime(p1) >= dlim || FileGetTime(p2) >= dlim) && !FileEqual(p1, p2, n))
auto IsGit = [&](const String& path) {
return path.Find("/.git/") >= 0 || path.Find("\\.git/") >= 0 || path.Find("\\.git\\") >= 0 || path.Find("/.git\\") >= 0;
};
if((IsNull(dlim) || FileGetTime(p1) >= dlim || FileGetTime(p2) >= dlim) && !FileEqual(p1, p2, n) &&
!IsGit(p1) && !IsGit(p2))
list.Add(MakeTuple(f[i], p1, p2, n));
}

View file

@ -105,7 +105,10 @@ void LoadBranches(DropList& branch, const String& dir)
void LoadGitRevisions(DropList& r, const String& dir, const String& branch, const String& file)
{
String gitcmd = "log --format=medium --date=short --follow --name-only " + branch;
String gitcmd = "log --format=medium --date=short --name-only ";
if(file.GetCount())
gitcmd << " --follow ";
gitcmd << branch;
if(file.GetCount())
gitcmd << " -- " << GetFileName(file);
String log = GitCmd(dir, gitcmd);