Skip to content

Commit

Permalink
Removed windows symlinks hack, since it seems to no longer be necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Aug 6, 2020
1 parent 612e85d commit b47a8c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 112 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,59 +39,6 @@ jobs:
with:
java-version: ${{ matrix.java }}

- name: Setup rm-symlink alias
if: contains(runner.os, 'windows')
shell: bash
run: |
git config --global alias.rm-symlinks '!'"$(cat <<'ETX'
__git_rm_symlinks() {
case "$1" in (-h)
printf 'usage: git rm-symlinks [symlink] [symlink] [...]\n'
return 0
esac
ppid=$$
case $# in
(0) git ls-files -s | grep -E '^120000' | cut -f2 ;;
(*) printf '%s\n' "$@" ;;
esac | while IFS= read -r symlink; do
case "$symlink" in
(*/*) symdir=${symlink%/*} ;;
(*) symdir=. ;;
esac
git checkout -- "$symlink"
src="${symdir}/$(cat "$symlink")"
posix_to_dos_sed='s_^/\([A-Za-z]\)_\1:_;s_/_\\\\_g'
doslnk=$(printf '%s\n' "$symlink" | sed "$posix_to_dos_sed")
dossrc=$(printf '%s\n' "$src" | sed "$posix_to_dos_sed")
if [ -f "$src" ]; then
rm -f "$symlink"
cmd //C mklink //H "$doslnk" "$dossrc"
elif [ -d "$src" ]; then
rm -f "$symlink"
cmd //C mklink //J "$doslnk" "$dossrc"
else
printf 'error: git-rm-symlink: Not a valid source\n' >&2
printf '%s =/=> %s (%s =/=> %s)...\n' \
"$symlink" "$src" "$doslnk" "$dossrc" >&2
false
fi || printf 'ESC[%d]: %d\n' "$ppid" "$?"
git update-index --assume-unchanged "$symlink"
done | awk '
BEGIN { status_code = 0 }
/^ESC\['"$ppid"'\]: / { status_code = $2 ; next }
{ print }
END { exit status_code }
'
}
__git_rm_symlinks
ETX
)"
git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat.
- if: contains(runner.os, 'windows')
shell: bash
run: git rm-symlink

- name: Cache ivy2
uses: actions/cache@v1
with:
Expand Down
59 changes: 0 additions & 59 deletions src/main/scala/sbtghactions/GenerativePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -520,64 +520,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}"""
},

githubWorkflowGeneratedCI := {
val windowsHacksOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) {
// credit: https://stackoverflow.com/a/16754068/9815
val aliasHack = """git config --global alias.rm-symlinks '!'"$(cat <<'ETX'
__git_rm_symlinks() {
case "$1" in (-h)
printf 'usage: git rm-symlinks [symlink] [symlink] [...]\n'
return 0
esac
ppid=$$
case $# in
(0) git ls-files -s | grep -E '^120000' | cut -f2 ;;
(*) printf '%s\n' "$@" ;;
esac | while IFS= read -r symlink; do
case "$symlink" in
(*/*) symdir=${symlink%/*} ;;
(*) symdir=. ;;
esac
git checkout -- "$symlink"
src="${symdir}/$(cat "$symlink")"
posix_to_dos_sed='s_^/\([A-Za-z]\)_\1:_;s_/_\\\\_g'
doslnk=$(printf '%s\n' "$symlink" | sed "$posix_to_dos_sed")
dossrc=$(printf '%s\n' "$src" | sed "$posix_to_dos_sed")
if [ -f "$src" ]; then
rm -f "$symlink"
cmd //C mklink //H "$doslnk" "$dossrc"
elif [ -d "$src" ]; then
rm -f "$symlink"
cmd //C mklink //J "$doslnk" "$dossrc"
else
printf 'error: git-rm-symlink: Not a valid source\n' >&2
printf '%s =/=> %s (%s =/=> %s)...\n' \
"$symlink" "$src" "$doslnk" "$dossrc" >&2
false
fi || printf 'ESC[%d]: %d\n' "$ppid" "$?"
git update-index --assume-unchanged "$symlink"
done | awk '
BEGIN { status_code = 0 }
/^ESC\['"$ppid"'\]: / { status_code = $2 ; next }
{ print }
END { exit status_code }
'
}
__git_rm_symlinks
ETX
)"
git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat."""

List(
WorkflowStep.Run(
List(aliasHack),
name = Some("Setup rm-symlink alias"),
cond = windowsGuard),

WorkflowStep.Run(List("git rm-symlink"), cond = windowsGuard))
} else {
Nil
}

val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) {
List(
WorkflowStep.Run(
Expand All @@ -591,7 +533,6 @@ git config --global alias.rm-symlink '!git rm-symlinks' # for back-compat."""
val preamble = autoCrlfOpt ::: List(
WorkflowStep.Checkout,
WorkflowStep.SetupScala) :::
windowsHacksOpt :::
githubWorkflowGeneratedCacheSteps.value.toList

val publicationCondPre =
Expand Down

0 comments on commit b47a8c5

Please sign in to comment.