Add some git attributes to avoid using CRLF on Win

This commit is contained in:
Victor Seiji Hariki 2023-01-02 00:37:00 -03:00
parent 431061f531
commit 61c261585b
6 changed files with 218 additions and 42 deletions

4
.devtools/sethooks.ps1 Normal file
View file

@ -0,0 +1,4 @@
git config core.eol lf
git config core.autocrlf input
git config core.hooksPath .githooks/windows

View file

@ -0,0 +1,27 @@
# Updates html files with cache busting urls including file hashes.
# Actual file processing
$htmlfiles = Get-ChildItem -Path . -Recurse -Filter "*.html" | Resolve-path -relative
foreach ($htmlfile in $htmlfiles) {
Write-Host "[info] Processing '${htmlfile}' for cache busting..." -ForegroundColor Blue
$resfiles = (@(Get-ChildItem -Path . -Recurse -Filter "*.css") + (Get-ChildItem -Path . -Recurse -Filter "*.js")) | Resolve-Path -relative
if ($args[0] -eq "gitadd") {
$resfiles = (git status -s | Select-String -Pattern "[A-Z] .+") | ForEach-Object { -split $_.Line | Select-Object -Last 1 }
}
foreach ($resfile in $resfiles) {
$resfile = $resfile -replace '\\', '/' -replace '\./', ''
# Check if resource is used in html file
if ($null -ne (Select-String -Path $htmlfile -Pattern $resfile)) {
$hash = (Get-FileHash $resfile -Algorithm SHA1).Hash
# This is just for cache busting...
# If 7 first characters of SHA1 is okay for git, it should be more than enough for us
$hash = $hash.Substring(0, 7).ToLower()
(Get-Content -Raw -Path $htmlfile).replace('\r\n', "\n") -replace "$resfile(\?v=[a-z0-9]+)?", "${resfile}?v=$hash" | Set-Content $htmlfile
}
}
}

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text eol=lf

View file

@ -4,22 +4,22 @@
<meta charset="utf-8" />
<title>openOutpaint 🐠</title>
<!-- CSS Variables -->
<link href="css/colors.css?v=3f81e80" rel="stylesheet" />
<link href="css/icons.css?v=a25504c" rel="stylesheet" />
<link href="css/colors.css?v=3f0d162" rel="stylesheet" />
<link href="css/icons.css?v=665c8c1" rel="stylesheet" />
<link href="css/index.css?v=ef0c943" rel="stylesheet" />
<link href="css/layers.css?v=b4fbf61" rel="stylesheet" />
<link href="css/index.css?v=6538a62" rel="stylesheet" />
<link href="css/layers.css?v=104d682" rel="stylesheet" />
<link href="css/ui/generic.css?v=a15ce4b" rel="stylesheet" />
<link href="css/ui/generic.css?v=90f4b50" rel="stylesheet" />
<link href="css/ui/history.css?v=0b03861" rel="stylesheet" />
<link href="css/ui/layers.css?v=4fd95fe" rel="stylesheet" />
<link href="css/ui/toolbar.css?v=109c78f" rel="stylesheet" />
<link href="css/ui/history.css?v=ce2a69a" rel="stylesheet" />
<link href="css/ui/layers.css?v=71d2325" rel="stylesheet" />
<link href="css/ui/toolbar.css?v=dfdf183" rel="stylesheet" />
<!-- Tool Specific CSS -->
<link href="css/ui/tool/dream.css?v=2d8a8ac" rel="stylesheet" />
<link href="css/ui/tool/stamp.css?v=6f5ce15" rel="stylesheet" />
<link href="css/ui/tool/colorbrush.css?v=57c8be5" rel="stylesheet" />
<link href="css/ui/tool/dream.css?v=eff86a8" rel="stylesheet" />
<link href="css/ui/tool/stamp.css?v=85def70" rel="stylesheet" />
<link href="css/ui/tool/colorbrush.css?v=5e5bb2f" rel="stylesheet" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
@ -308,7 +308,7 @@
<button id="settings-btn-close" class="close"></button>
</div>
<div class="ui separator"></div>
<iframe id="page-overlay" src="pages/configuration.html"></iframe>
<iframe id="page-overlay" src="pages/configuration.html?v=b872bdc"></iframe>
</div>
</div>
@ -316,17 +316,17 @@
<script src="js/global.js?v=3da0b2e" type="text/javascript"></script>
<!-- Base Libs -->
<script src="js/lib/util.js?v=7f6847c" type="text/javascript"></script>
<script src="js/lib/events.js?v=2ab7933" type="text/javascript"></script>
<script src="js/lib/input.js?v=09298ac" type="text/javascript"></script>
<script src="js/lib/layers.js?v=a1f8aea" type="text/javascript"></script>
<script src="js/lib/commands.js?v=00464cb" type="text/javascript"></script>
<script src="js/lib/util.js?v=5838390" type="text/javascript"></script>
<script src="js/lib/events.js?v=5651612" type="text/javascript"></script>
<script src="js/lib/input.js?v=41bcb1f" type="text/javascript"></script>
<script src="js/lib/layers.js?v=ef337a2" type="text/javascript"></script>
<script src="js/lib/commands.js?v=9382070" type="text/javascript"></script>
<script src="js/lib/toolbar.js?v=8a08072" type="text/javascript"></script>
<script src="js/lib/ui.js?v=8481b85" type="text/javascript"></script>
<script src="js/lib/toolbar.js?v=af283c3" type="text/javascript"></script>
<script src="js/lib/ui.js?v=d5f246c" type="text/javascript"></script>
<script
src="js/initalize/layers.populate.js?v=c81f0a5"
src="js/initalize/layers.populate.js?v=e39fbfc"
type="text/javascript"></script>
<!-- Configuration -->
@ -345,39 +345,150 @@
<!-- Load Tools -->
<script
src="js/ui/tool/generic.js?v=2bcd36d"
src="js/ui/tool/generic.js?v=f1a19a4"
type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=230e42e" type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=890a2eb" type="text/javascript"></script>
<script
src="js/ui/tool/maskbrush.js?v=1e8a893"
src="js/ui/tool/maskbrush.js?v=5b574f3"
type="text/javascript"></script>
<script
src="js/ui/tool/colorbrush.js?v=1bd7288"
type="text/javascript"></script>
<script
src="js/ui/tool/select.js?v=533feab"
src="js/ui/tool/select.js?v=14f1dda"
type="text/javascript"></script>
<script src="js/ui/tool/stamp.js?v=81b8908" type="text/javascript"></script>
<script src="js/ui/tool/stamp.js?v=1c26257" type="text/javascript"></script>
<script
src="js/ui/tool/interrogate.js?v=af51c4d"
src="js/ui/tool/interrogate.js?v=f06171a"
type="text/javascript"></script>
<!-- Initialize -->
<script
src="js/initalize/shortcuts.populate.js?v=fd01c47"
src="js/initalize/shortcuts.populate.js?v=7b4d80a"
type="text/javascript"></script>
<script
src="js/initalize/toolbar.populate.js?v=c1ca438"
src="js/initalize/toolbar.populate.js?v=9999735"
type="text/javascript"></script>
<script
src="js/initalize/debug.populate.js?v=64ad17f"
src="js/initalize/debug.populate.js?v=f051a64"
type="text/javascript"></script>
<script
src="js/initalize/ui.populate.js?v=b59b288"
src="js/initalize/ui.populate.js?v=0bfe42d"
type="text/javascript"></script>
<!-- Deals with webui communication -->
<script src="js/webui.js?v=60a0a81" type="text/javascript"></script>
</body>
</html>

View file

@ -4,22 +4,22 @@
<meta charset="utf-8" />
<title>openOutpaint 🐠</title>
<!-- CSS Variables -->
<link href="../css/colors.css?v=3f81e80" rel="stylesheet" />
<link href="../css/icons.css?v=a25504c" rel="stylesheet" />
<link href="../css/colors.css?v=3f0d162" rel="stylesheet" />
<link href="../css/icons.css?v=665c8c1" rel="stylesheet" />
<link href="../css/index.css?v=ef0c943" rel="stylesheet" />
<link href="../css/layers.css?v=b4fbf61" rel="stylesheet" />
<link href="../css/index.css?v=6538a62" rel="stylesheet" />
<link href="../css/layers.css?v=104d682" rel="stylesheet" />
<link href="../css/ui/generic.css?v=a15ce4b" rel="stylesheet" />
<link href="../css/ui/generic.css?v=90f4b50" rel="stylesheet" />
<link href="../css/ui/history.css?v=0b03861" rel="stylesheet" />
<link href="../css/ui/layers.css?v=4fd95fe" rel="stylesheet" />
<link href="../css/ui/toolbar.css?v=109c78f" rel="stylesheet" />
<link href="../css/ui/history.css?v=ce2a69a" rel="stylesheet" />
<link href="../css/ui/layers.css?v=71d2325" rel="stylesheet" />
<link href="../css/ui/toolbar.css?v=dfdf183" rel="stylesheet" />
<!-- Tool Specific CSS -->
<link href="../css/ui/tool/dream.css?v=2d8a8ac" rel="stylesheet" />
<link href="../css/ui/tool/stamp.css?v=6f5ce15" rel="stylesheet" />
<link href="../css/ui/tool/colorbrush.css?v=57c8be5" rel="stylesheet" />
<link href="../css/ui/tool/dream.css?v=eff86a8" rel="stylesheet" />
<link href="../css/ui/tool/stamp.css?v=85def70" rel="stylesheet" />
<link href="../css/ui/tool/colorbrush.css?v=5e5bb2f" rel="stylesheet" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
@ -88,3 +88,36 @@
</script>
</body>
</html>

View file

@ -8,7 +8,7 @@
<iframe
id="openoutpaint"
style="width: 100%; height: 800px"
src="../index.html"
src="../index.html?v=e2520a0"
frameborder="0"></iframe>
<button id="add-res">Add Resource</button>
<script>