From 767f48236c8d390d68419d3346af3a856b26f19f Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 Oct 2021 16:53:39 +0200 Subject: [PATCH] direct git link --- .github/workflows/symlink-test.yml | 47 +++++++++++++++++++++--------- bang | 1 - 2 files changed, 33 insertions(+), 15 deletions(-) delete mode 120000 bang diff --git a/.github/workflows/symlink-test.yml b/.github/workflows/symlink-test.yml index fdd4bae..57bfaeb 100644 --- a/.github/workflows/symlink-test.yml +++ b/.github/workflows/symlink-test.yml @@ -41,21 +41,40 @@ jobs: # symlink via pwsh # this creates a 'bang' file that contains 'duh' # on local machine, it fails 'New-Item: Administrator privilege required for this operation.' - - name: Symlink Pwsh - shell: pwsh + # + # update: it creates *something* that is listed as a directory in the log, + # and that GitHub represents as a link, so it has to be a link, but when + # I check the thing out, it's a file + # because Windows won't create the link but on Linux, it's checked out as a link + # + #- name: Symlink Pwsh + # shell: pwsh + # run: | + # if (! (test-path bang)) { + # New-Item -ItemType SymbolicLink -Name bang -Target duh + # write-output "DIR:" + # ls . + # write-output "DIR:" + # ls bang + # git config --global user.email "stephan@REDACTED.com" + # git config --global user.name "Stephan" + # git config --global core.symlinks "true" + # git add bang + # git commit -m "created symlink" + # } + + # see + # this just creates the symlink in Git - works on Windows + # BUT will be checked out as a file and we don't care + - name: Symlink Git + shell: bash run: | - if (! (test-path bang)) { - New-Item -ItemType SymbolicLink -Name bang -Target duh - write-output "DIR:" - ls . - write-output "DIR:" - ls bang - git config --global user.email "stephan@REDACTED.com" - git config --global user.name "Stephan" - git config --global core.symlinks "true" - git add bang - git commit -m "created symlink" - } + if [ -f "bang" ]; then rm -f bang; fi + git update-index --add --cacheinfo 120000 "$(echo "duh" | git hash-object -w --stdin)" "bang" + git config --global user.email "stephan@REDACTED.com" + git config --global user.name "Stephan" + git add bang + git commit -m "created symlink" # push changes back - name: Push diff --git a/bang b/bang deleted file mode 120000 index 426bf5a..0000000 --- a/bang +++ /dev/null @@ -1 +0,0 @@ -duh \ No newline at end of file