UiPath 2019 treats JSON & XAML files that are added to a git repository as binary by creating a $DIR/.git/info/attributes file with the following contents
*.json binary
*.xaml binary
This results in being unable to see the file differences
D:\RPA\UiPath\test\test2019>git diff Main.xaml
diff --git a/Main.xaml b/Main.xaml
index 115ce60..75801f8 100644
Binary files a/Main.xaml and b/Main.xaml differ
This file is created/updated when
Git Init a project within Studio
Opening a Project/Workspace that is already tracked within a Git repository.
Is this intended? If so, what is the reason?
Is this configurable so that users can continue to use their Git CLI or GUI of their choice without having to modify the attributes file each time the workspace is opened?
Git documentation.git/info/attributes takes precedence over the other configurations so while that file exists with those values, users cannot override the settings by other means.
When deciding what attributes are assigned to a path, Git consults $GIT_DIR/info/attributes file (which has the highest precedence), .gitattributes file in the same directory as the path in question, and its parent directories up to the toplevel of the work tree (the further the directory that contains .gitattributes is from the path in question, the lower its precedence). Finally global and system-wide files are considered (they have the lowest precedence).
Yes. This is intended. We do this to prevent Git automerge for XAML and Json. We mark them as binary so the Git can allow us to use our own Diff capability. We will take configurability into consideration. Thank you for the feedback.
How about letting the RPA developer decide? I frequently use “rm .git/info/attributes” from PowerShell in order to be able to do a quick and efficient diff.
Has there been any progress on this? I need to check a series of projects for differences between branches to pick and merge them together. UiPath only gives options to checkout, rebase or merge, not to diff.
I know it’s just creating a read only empty file at .git/info/attributes, but doing that for EVERY project is annoying, why not allow a template to be used so the developer can decide?
As a workaround, if you have several projects you want to see in a proper diff client, then this PowerShell script will iterate through each folder and if it’s connected to git then will override the attributes file with a blank read only one:
$RootFolder = "root folder for your projects"
foreach ($SubFolder in Get-ChildItem -Path $RootFolder -Directory) {
if (Test-Path -Path "$($SubFolder.FullName)\.git") {
New-Item -Path "$($SubFolder.FullName)\.git\info\attributes" -ItemType File -Force
Set-ItemProperty -Path "$($SubFolder.FullName)\.git\info\attributes" -Name IsReadOnly -Value $true
}
}