From 4a724707e9789461f2843aa11284b051a651b518 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:28:05 -0400
Subject: [PATCH 1/9] Add test for relative paths

---
 .github/workflows/workflow.yml | 43 ++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index c394023..1700c08 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -57,7 +57,7 @@ jobs:
       uses: actions/checkout@v2
     - name: Generate files
       shell: bash
-      run: __tests__/create-cache-files.sh ${{ runner.os }}
+      run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
     - name: Save cache
       uses: ./
       with:
@@ -79,7 +79,42 @@ jobs:
         path: test-cache
     - name: Verify cache
       shell: bash
-      run: __tests__/verify-cache-files.sh ${{ runner.os }}
+      run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache
+
+  # End to end save and restore with relative paths
+  test-save:
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest, macOS-latest]
+    runs-on: ${{ matrix.os }}
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+    - name: Generate files
+      shell: bash
+      run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
+    - name: Save cache
+      uses: ./
+      with:
+        key: test-relative-${{ runner.os }}-${{ github.run_id }}
+        path: ~test-cache
+  test-restore:
+    needs: test-save
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest, macOS-latest]
+    runs-on: ${{ matrix.os }}
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+    - name: Restore cache
+      uses: ./
+      with:
+        key: test-relative-${{ runner.os }}-${{ github.run_id }}
+        path: test-cache
+    - name: Verify cache
+      shell: bash
+      run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache
 
   # End to end with proxy
   test-proxy-save:
@@ -98,7 +133,7 @@ jobs:
     - name: Checkout
       uses: actions/checkout@v2
     - name: Generate files
-      run: __tests__/create-cache-files.sh proxy
+      run: __tests__/create-cache-files.sh proxy test-cache
     - name: Save cache
       uses: ./
       with:
@@ -126,4 +161,4 @@ jobs:
         key: test-proxy-${{ github.run_id }}
         path: test-cache
     - name: Verify cache
-      run: __tests__/verify-cache-files.sh proxy
+      run: __tests__/verify-cache-files.sh proxy test-cache

From 64f876951512169eb2fd25ede0708ba40b51f118 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:29:07 -0400
Subject: [PATCH 2/9] Add path argument to create-cache-files.sh

---
 __tests__/create-cache-files.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/__tests__/create-cache-files.sh b/__tests__/create-cache-files.sh
index 885a5f2..0ce4140 100755
--- a/__tests__/create-cache-files.sh
+++ b/__tests__/create-cache-files.sh
@@ -7,5 +7,11 @@ if [ -z "$prefix" ]; then
   exit 1
 fi
 
-mkdir test-cache
-echo "$prefix $GITHUB_RUN_ID" > test-cache/test-file.txt
\ No newline at end of file
+path="$2"
+if [ -z "$path" ]; then
+  echo "Must supply path argument"
+  exit 1
+fi
+
+mkdir -p $path
+echo "$prefix $GITHUB_RUN_ID" > $path/test-file.txt

From 272268544c66d8b10351152875f69e59d20e68a7 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:30:01 -0400
Subject: [PATCH 3/9] Add path argument to verify-cache-files.sh

---
 __tests__/verify-cache-files.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/__tests__/verify-cache-files.sh b/__tests__/verify-cache-files.sh
index c7b75ae..3ee8a84 100755
--- a/__tests__/verify-cache-files.sh
+++ b/__tests__/verify-cache-files.sh
@@ -7,6 +7,12 @@ if [ -z "$prefix" ]; then
   exit 1
 fi
 
+path="$2"
+if [ -z "$path" ]; then
+  echo "Must specify path argument"
+  exit 1
+fi
+
 # Sanity check GITHUB_RUN_ID defined
 if [ -z "$GITHUB_RUN_ID" ]; then
   echo "GITHUB_RUN_ID not defined"
@@ -14,7 +20,7 @@ if [ -z "$GITHUB_RUN_ID" ]; then
 fi
 
 # Verify file exists
-file="test-cache/test-file.txt"
+file="$path/test-file.txt"
 echo "Checking for $file"
 if [ ! -e $file ]; then
   echo "File does not exist"
@@ -27,4 +33,4 @@ echo "File content:\n$content"
 if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then
   echo "Unexpected file content"
   exit 1
-fi
\ No newline at end of file
+fi

From b6b8aa78d8ae06ec477252c9b2d71d0c6c29bfd2 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:31:27 -0400
Subject: [PATCH 4/9] Update workflow.yml

---
 .github/workflows/workflow.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index 1700c08..ba13037 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -111,7 +111,7 @@ jobs:
       uses: ./
       with:
         key: test-relative-${{ runner.os }}-${{ github.run_id }}
-        path: test-cache
+        path: ~test-cache
     - name: Verify cache
       shell: bash
       run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache

From f15bc7a0d98de7bd545124899e08849ea82403c5 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:33:13 -0400
Subject: [PATCH 5/9] Fix job names

---
 .github/workflows/workflow.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index ba13037..75cdddb 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -47,7 +47,7 @@ jobs:
       run: npm run test
 
   # End to end save and restore
-  test-save:
+  test-save-relative:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
@@ -63,8 +63,8 @@ jobs:
       with:
         key: test-${{ runner.os }}-${{ github.run_id }}
         path: test-cache
-  test-restore:
-    needs: test-save
+  test-restore-relative:
+    needs: test-save-relative
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]

From 2ba9edf492f7fe62e6fe617899942a37e00ec19e Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:37:50 -0400
Subject: [PATCH 6/9] Fix job names v2

---
 .github/workflows/workflow.yml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index 75cdddb..24fbfd1 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -47,7 +47,7 @@ jobs:
       run: npm run test
 
   # End to end save and restore
-  test-save-relative:
+  test-save:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
@@ -63,8 +63,8 @@ jobs:
       with:
         key: test-${{ runner.os }}-${{ github.run_id }}
         path: test-cache
-  test-restore-relative:
-    needs: test-save-relative
+  test-restore:
+    needs: test-save
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
@@ -82,7 +82,7 @@ jobs:
       run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache
 
   # End to end save and restore with relative paths
-  test-save:
+  test-save-relative:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
@@ -98,8 +98,8 @@ jobs:
       with:
         key: test-relative-${{ runner.os }}-${{ github.run_id }}
         path: ~test-cache
-  test-restore:
-    needs: test-save
+  test-restore-relative:
+    needs: test-save-relative
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]

From 0e86d5c038445d4fdc18afc7a192506af498e8f6 Mon Sep 17 00:00:00 2001
From: David Hadka <dhadka@users.noreply.github.com>
Date: Tue, 7 Apr 2020 23:41:38 -0400
Subject: [PATCH 7/9] Update workflow.yml

---
 .github/workflows/workflow.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index 24fbfd1..f31be24 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -51,6 +51,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
+      fail-fast: false
     runs-on: ${{ matrix.os }}
     steps:
     - name: Checkout
@@ -68,6 +69,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
+      fail-fast: false
     runs-on: ${{ matrix.os }}
     steps:
     - name: Checkout
@@ -86,6 +88,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
+      fail-fast: false
     runs-on: ${{ matrix.os }}
     steps:
     - name: Checkout
@@ -103,6 +106,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
+      fail-fast: false
     runs-on: ${{ matrix.os }}
     steps:
     - name: Checkout

From e5370355e697012169d3b31dcf6de22a4f9d6988 Mon Sep 17 00:00:00 2001
From: Josh Gross <joshmgross@github.com>
Date: Wed, 8 Apr 2020 10:52:52 -0400
Subject: [PATCH 8/9] Combine relative jobs into main test jobs

---
 .github/workflows/workflow.yml | 51 ++++++++--------------------------
 1 file changed, 12 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index f31be24..c97fe95 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -56,14 +56,19 @@ jobs:
     steps:
     - name: Checkout
       uses: actions/checkout@v2
-    - name: Generate files
+    - name: Generate files in working directory
       shell: bash
       run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
+    - name: Generate files outside working directory
+      shell: bash
+      run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
     - name: Save cache
       uses: ./
       with:
         key: test-${{ runner.os }}-${{ github.run_id }}
-        path: test-cache
+        path: |
+          test-cache
+          ~/test-cache
   test-restore:
     needs: test-save
     strategy:
@@ -78,45 +83,13 @@ jobs:
       uses: ./
       with:
         key: test-${{ runner.os }}-${{ github.run_id }}
-        path: test-cache
-    - name: Verify cache
+        path: |
+          test-cache
+          ~/test-cache
+    - name: Verify cache files in working directory
       shell: bash
       run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache
-
-  # End to end save and restore with relative paths
-  test-save-relative:
-    strategy:
-      matrix:
-        os: [ubuntu-latest, windows-latest, macOS-latest]
-      fail-fast: false
-    runs-on: ${{ matrix.os }}
-    steps:
-    - name: Checkout
-      uses: actions/checkout@v2
-    - name: Generate files
-      shell: bash
-      run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
-    - name: Save cache
-      uses: ./
-      with:
-        key: test-relative-${{ runner.os }}-${{ github.run_id }}
-        path: ~test-cache
-  test-restore-relative:
-    needs: test-save-relative
-    strategy:
-      matrix:
-        os: [ubuntu-latest, windows-latest, macOS-latest]
-      fail-fast: false
-    runs-on: ${{ matrix.os }}
-    steps:
-    - name: Checkout
-      uses: actions/checkout@v2
-    - name: Restore cache
-      uses: ./
-      with:
-        key: test-relative-${{ runner.os }}-${{ github.run_id }}
-        path: ~test-cache
-    - name: Verify cache
+    - name: Verify cache files outside working directory
       shell: bash
       run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache
 

From a4e3c3b64e77f4001b05b54ee3871ef057b7fe74 Mon Sep 17 00:00:00 2001
From: Josh Gross <joshmgross@github.com>
Date: Wed, 8 Apr 2020 10:58:38 -0400
Subject: [PATCH 9/9] Add -P flag for tar creation

---
 __tests__/tar.test.ts | 1 +
 dist/restore/index.js | 9 +++++----
 dist/save/index.js    | 9 +++++----
 src/tar.ts            | 1 +
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts
index fdf637a..ca10f34 100644
--- a/__tests__/tar.test.ts
+++ b/__tests__/tar.test.ts
@@ -73,6 +73,7 @@ test("create tar", async () => {
             "-cz",
             "-f",
             CacheFilename,
+            "-P",
             "-C",
             workspace,
             "--files-from",
diff --git a/dist/restore/index.js b/dist/restore/index.js
index ac49982..2e71724 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(__webpack_require__(470));
-const fs = __importStar(__webpack_require__(747));
-const crypto = __importStar(__webpack_require__(417));
 const http_client_1 = __webpack_require__(539);
 const auth_1 = __webpack_require__(226);
-const utils = __importStar(__webpack_require__(443));
+const crypto = __importStar(__webpack_require__(417));
+const fs = __importStar(__webpack_require__(747));
 const constants_1 = __webpack_require__(694);
+const utils = __importStar(__webpack_require__(443));
 const versionSalt = "1.0";
 function isSuccessStatusCode(statusCode) {
     if (!statusCode) {
@@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(__webpack_require__(470));
-const io = __importStar(__webpack_require__(1));
 const glob = __importStar(__webpack_require__(281));
+const io = __importStar(__webpack_require__(1));
 const fs = __importStar(__webpack_require__(747));
 const path = __importStar(__webpack_require__(622));
 const util = __importStar(__webpack_require__(669));
@@ -5016,6 +5016,7 @@ function createTar(archiveFolder, sourceDirectories) {
             "-cz",
             "-f",
             constants_1.CacheFilename,
+            "-P",
             "-C",
             workingDirectory,
             "--files-from",
diff --git a/dist/save/index.js b/dist/save/index.js
index ca454ed..f807389 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(__webpack_require__(470));
-const fs = __importStar(__webpack_require__(747));
-const crypto = __importStar(__webpack_require__(417));
 const http_client_1 = __webpack_require__(539);
 const auth_1 = __webpack_require__(226);
-const utils = __importStar(__webpack_require__(443));
+const crypto = __importStar(__webpack_require__(417));
+const fs = __importStar(__webpack_require__(747));
 const constants_1 = __webpack_require__(694);
+const utils = __importStar(__webpack_require__(443));
 const versionSalt = "1.0";
 function isSuccessStatusCode(statusCode) {
     if (!statusCode) {
@@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(__webpack_require__(470));
-const io = __importStar(__webpack_require__(1));
 const glob = __importStar(__webpack_require__(281));
+const io = __importStar(__webpack_require__(1));
 const fs = __importStar(__webpack_require__(747));
 const path = __importStar(__webpack_require__(622));
 const util = __importStar(__webpack_require__(669));
@@ -4993,6 +4993,7 @@ function createTar(archiveFolder, sourceDirectories) {
             "-cz",
             "-f",
             constants_1.CacheFilename,
+            "-P",
             "-C",
             workingDirectory,
             "--files-from",
diff --git a/src/tar.ts b/src/tar.ts
index 3ca3019..9a1f446 100644
--- a/src/tar.ts
+++ b/src/tar.ts
@@ -59,6 +59,7 @@ export async function createTar(
         "-cz",
         "-f",
         CacheFilename,
+        "-P",
         "-C",
         workingDirectory,
         "--files-from",