Hello community,

here is the log from the commit of package direnv for openSUSE:Factory checked 
in at 2020-11-24 22:15:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/direnv (Old)
 and      /work/SRC/openSUSE:Factory/.direnv.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "direnv"

Tue Nov 24 22:15:11 2020 rev:9 rq:850502 version:2.24.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/direnv/direnv.changes    2020-10-29 
14:52:48.505255359 +0100
+++ /work/SRC/openSUSE:Factory/.direnv.new.5913/direnv.changes  2020-11-24 
22:15:13.987648658 +0100
@@ -1,0 +2,14 @@
+Sat Nov 21 11:45:50 UTC 2020 - Julien Enselme <juj...@jujens.eu>
+
+- update to 2.24.0
+  * direnv_load: avoid leaking DIRENV_DUMP_FILE_PATH (#715)
+  * Add strict_env and unstrict_env (#572)
+  * stdlib: add use_vim to source local vimrc (#497)
+  * stdlib: add source_env_if_exists (#714)
+  * Wording (#713)
+  * build(deps): bump actions/checkout from v2.3.3 to v2.3.4 (#709)
+  * build(deps): bump cachix/install-nix-action from v11 to v12 (#710)
+  * Fix XDG_CACHE_HOME path (#711)
+  * rc: make file existence check more robust (#706)
+
+-------------------------------------------------------------------

Old:
----
  direnv-2.23.1.tar.gz

New:
----
  direnv-2.24.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ direnv.spec ++++++
--- /var/tmp/diff_new_pack.rxAs8s/_old  2020-11-24 22:15:14.759649374 +0100
+++ /var/tmp/diff_new_pack.rxAs8s/_new  2020-11-24 22:15:14.763649377 +0100
@@ -18,7 +18,7 @@
 
 %define gopackagepath github.com/direnv/direnv
 Name:           direnv
-Version:        2.23.1
+Version:        2.24.0
 Release:        0
 Summary:        Environment switcher for shells
 License:        MIT

++++++ direnv-2.23.1.tar.gz -> direnv-2.24.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/.github/workflows/go.yml 
new/direnv-2.24.0/.github/workflows/go.yml
--- old/direnv-2.23.1/.github/workflows/go.yml  2020-10-22 20:34:41.000000000 
+0200
+++ new/direnv-2.24.0/.github/workflows/go.yml  2020-11-15 19:12:19.000000000 
+0100
@@ -16,7 +16,7 @@
       id: go
 
     - name: Check out code into the Go module directory
-      uses: actions/checkout@v2.3.3
+      uses: actions/checkout@v2.3.4
 
     - name: Build
       env:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/.github/workflows/nix.yml 
new/direnv-2.24.0/.github/workflows/nix.yml
--- old/direnv-2.23.1/.github/workflows/nix.yml 2020-10-22 20:34:41.000000000 
+0200
+++ new/direnv-2.24.0/.github/workflows/nix.yml 2020-11-15 19:12:19.000000000 
+0100
@@ -8,10 +8,10 @@
     name: Build
     runs-on: ${{ matrix.os }}
     steps:
-      - uses: actions/checkout@v2.3.3
+      - uses: actions/checkout@v2.3.4
         with:
           fetch-depth: 1
-      - uses: cachix/install-nix-action@v11
+      - uses: cachix/install-nix-action@v12
 
       - name: Build
         run: nix-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/.github/workflows/release.yml 
new/direnv-2.24.0/.github/workflows/release.yml
--- old/direnv-2.23.1/.github/workflows/release.yml     2020-10-22 
20:34:41.000000000 +0200
+++ new/direnv-2.24.0/.github/workflows/release.yml     2020-11-15 
19:12:19.000000000 +0100
@@ -17,7 +17,7 @@
         with:
           go-version: 1.13.6
       - name: Checkout code
-        uses: actions/checkout@v2.3.3
+        uses: actions/checkout@v2.3.4
       - name: Get release notes
         id: release-notes
         run: |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/CHANGELOG.md 
new/direnv-2.24.0/CHANGELOG.md
--- old/direnv-2.23.1/CHANGELOG.md      2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/CHANGELOG.md      2020-11-15 19:12:19.000000000 +0100
@@ -1,4 +1,17 @@
 
+2.24.0 / 2020-11-15
+==================
+
+  * direnv_load: avoid leaking DIRENV_DUMP_FILE_PATH (#715)
+  * Add strict_env and unstrict_env (#572)
+  * stdlib: add `use_vim` to source local vimrc (#497)
+  * stdlib: add source_env_if_exists (#714)
+  * Wording (#713)
+  * build(deps): bump actions/checkout from v2.3.3 to v2.3.4 (#709)
+  * build(deps): bump cachix/install-nix-action from v11 to v12 (#710)
+  * Fix XDG_CACHE_HOME path (#711)
+  * rc: make file existence check more robust (#706)
+
 2.23.1 / 2020-10-22
 ==================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/README.md new/direnv-2.24.0/README.md
--- old/direnv-2.23.1/README.md 2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/README.md 2020-11-15 19:12:19.000000000 +0100
@@ -147,7 +147,14 @@
 have a chat. If you ask a question make sure to stay around as not everyone is
 active all day.
 
-## Similar projects
+## Complementary projects
+
+Here is a list of projects you might want to look into if you are using direnv.
+
+* [starship](https://starship.rs/) - A cross-shell prompt.
+* [nix-direnv](https://github.com/nix-community/nix-direnv) - A fast, 
persistent use_nix implementation for direnv.
+
+## Related projects
 
 Here is a list of other projects found in the same design space. Feel free to
 submit new ones.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/cmd_dump.go 
new/direnv-2.24.0/cmd_dump.go
--- old/direnv-2.23.1/cmd_dump.go       2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/cmd_dump.go       2020-11-15 19:12:19.000000000 +0100
@@ -27,7 +27,7 @@
        if len(args) > 2 {
                filePath = args[2]
        } else {
-               filePath = os.Getenv("DIRENV_DUMP_FILE_PATH")
+               filePath = os.Getenv(DIRENV_DUMP_FILE_PATH)
        }
 
        if filePath != "" {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/const.go new/direnv-2.24.0/const.go
--- old/direnv-2.23.1/const.go  2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/const.go  2020-11-15 19:12:19.000000000 +0100
@@ -9,4 +9,6 @@
        DIRENV_DIR     = "DIRENV_DIR"
        DIRENV_WATCHES = "DIRENV_WATCHES"
        DIRENV_DIFF    = "DIRENV_DIFF"
+
+       DIRENV_DUMP_FILE_PATH = "DIRENV_DUMP_FILE_PATH"
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/env.go new/direnv-2.24.0/env.go
--- old/direnv-2.23.1/env.go    2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/env.go    2020-11-15 19:12:19.000000000 +0100
@@ -36,9 +36,10 @@
 // this after reverting the environment, otherwise direnv will just be amnesic
 // about the previously-loaded environment.
 func (env Env) CleanContext() {
+       delete(env, DIRENV_DIFF)
        delete(env, DIRENV_DIR)
+       delete(env, DIRENV_DUMP_FILE_PATH)
        delete(env, DIRENV_WATCHES)
-       delete(env, DIRENV_DIFF)
 }
 
 // LoadEnv unmarshals the env back from a gzenv string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/man/direnv-stdlib.1 
new/direnv-2.24.0/man/direnv-stdlib.1
--- old/direnv-2.23.1/man/direnv-stdlib.1       2020-10-22 20:34:41.000000000 
+0200
+++ new/direnv-2.24.0/man/direnv-stdlib.1       2020-11-15 19:12:19.000000000 
+0100
@@ -101,6 +101,26 @@
 .PP
 NOTE: the other \fB\fC\&.envrc\fR is not checked by the security framework.
 
+.SS \fB\fCsource\_env\_if\_exists <filename>\fR
+.PP
+Loads another ".envrc", but only if it exists.
+
+.PP
+NOTE: contrary to \fB\fCsource\_env\fR, this only works when passing a path to 
a file,
+      not a directory.
+
+.PP
+Example:
+
+.PP
+.RS
+
+.nf
+source\_env\_if\_exists .envrc.private
+
+.fi
+.RE
+
 .SS \fB\fCsource\_up [<filename>]\fR
 .PP
 Loads another \fB\fC\&.envrc\fR if found when searching from the parent 
directory up to /.
@@ -432,6 +452,15 @@
 .fi
 .RE
 
+.SS \fB\fCuse vim [<vimrc\_file>]\fR
+.PP
+Prepends the specified vim script (or .vimrc.local by default) to the
+\fB\fCDIRENV\_EXTRA\_VIMRC\fR environment variable.
+
+.PP
+This variable is understood by the direnv/direnv.vim extension. When found,
+it will source it after opening files in the directory.
+
 .SS \fB\fCwatch\_file <path> [<path> ...]\fR
 .PP
 Adds each file to direnv's watch\-list. If the file changes direnv will reload 
the environment on the next prompt.
@@ -454,6 +483,78 @@
 be useful when sharing an \fB\fC\&.envrc\fR and to make sure that the users 
are up to
 date.
 
+.SS \fB\fCstrict\_env [<command> ...]\fR
+.PP
+Turns on shell execution strictness. This will force the .envrc
+evaluation context to exit immediately if:
+.IP \(bu 2
+any command in a pipeline returns a non\-zero exit status that is not
+otherwise handled as part of \fB\fCif\fR, \fB\fCwhile\fR, or \fB\fCuntil\fR 
tests,
+return value negation (\fB\fC!\fR), or part of a boolean (\fB\fC\&\&\fR or 
\fB\fC||\fR)
+chain.
+.IP \(bu 2
+any variable that has not explicitly been set or declared (with
+either \fB\fCdeclare\fR or \fB\fClocal\fR) is referenced.
+
+.PP
+If followed by a command\-line, the strictness applies for the duration
+of the command.
+
+.PP
+Example (Whole Script):
+
+.PP
+.RS
+
+.nf
+strict\_env
+has curl
+
+.fi
+.RE
+
+.PP
+Example (Command):
+
+.PP
+.RS
+
+.nf
+strict\_env has curl
+
+.fi
+.RE
+
+.SS \fB\fCunstrict\_env [<command> ...]\fR
+.PP
+Turns off shell execution strictness. If followed by a command\-line, the
+strictness applies for the duration of the command.
+
+.PP
+Example (Whole Script):
+
+.PP
+.RS
+
+.nf
+unstrict\_env
+has curl
+
+.fi
+.RE
+
+.PP
+Example (Command):
+
+.PP
+.RS
+
+.nf
+unstrict\_env has curl
+
+.fi
+.RE
+
 .SH COPYRIGHT
 .PP
 MIT licence \- Copyright (C) 2019 @zimbatm and contributors
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/man/direnv-stdlib.1.md 
new/direnv-2.24.0/man/direnv-stdlib.1.md
--- old/direnv-2.23.1/man/direnv-stdlib.1.md    2020-10-22 20:34:41.000000000 
+0200
+++ new/direnv-2.24.0/man/direnv-stdlib.1.md    2020-11-15 19:12:19.000000000 
+0100
@@ -75,6 +75,17 @@
 
 NOTE: the other `.envrc` is not checked by the security framework.
 
+### `source_env_if_exists <filename>`
+
+Loads another ".envrc", but only if it exists.
+
+NOTE: contrary to `source_env`, this only works when passing a path to a file,
+      not a directory.
+
+Example:
+
+    source_env_if_exists .envrc.private
+
 ### `source_up [<filename>]`
 
 Loads another `.envrc` if found when searching from the parent directory up to 
/.
@@ -303,6 +314,14 @@
     set -e
     use node 4.2.2
 
+### `use vim [<vimrc_file>]`
+
+Prepends the specified vim script (or .vimrc.local by default) to the
+`DIRENV_EXTRA_VIMRC` environment variable.
+
+This variable is understood by the direnv/direnv.vim extension. When found,
+it will source it after opening files in the directory.
+
 ### `watch_file <path> [<path> ...]`
 
 Adds each file to direnv's watch-list. If the file changes direnv will reload 
the environment on the next prompt.
@@ -317,6 +336,45 @@
 be useful when sharing an `.envrc` and to make sure that the users are up to
 date.
 
+### `strict_env [<command> ...]`
+
+Turns on shell execution strictness. This will force the .envrc
+evaluation context to exit immediately if:
+
+- any command in a pipeline returns a non-zero exit status that is not
+  otherwise handled as part of `if`, `while`, or `until` tests,
+  return value negation (`!`), or part of a boolean (`&&` or `||`)
+  chain.
+- any variable that has not explicitly been set or declared (with
+  either `declare` or `local`) is referenced.
+
+If followed by a command-line, the strictness applies for the duration
+of the command.
+
+Example (Whole Script):
+
+    strict_env
+    has curl
+
+Example (Command):
+
+    strict_env has curl
+
+#### `unstrict_env [<command> ...]`
+
+Turns off shell execution strictness. If followed by a command-line, the
+strictness applies for the duration of the command.
+
+Example (Whole Script):
+
+    unstrict_env
+    has curl
+
+Example (Command):
+
+    unstrict_env has curl
+
+
 COPYRIGHT
 ---------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/man/direnv.1 
new/direnv-2.24.0/man/direnv.1
--- old/direnv-2.23.1/man/direnv.1      2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/man/direnv.1      2020-11-15 19:12:19.000000000 +0100
@@ -150,7 +150,7 @@
 .PP
 So here we are pretty sure that it won't do anything bad. Type \fB\fCdirenv 
allow .\fR
 and watch direnv loading your new environment. Note that \fB\fCdirenv edit 
.\fR is a
-handy shortcut that open the file in your $EDITOR and automatically allows it
+handy shortcut that opens the file in your $EDITOR and automatically reloads it
 if the file's modification time has changed.
 
 .PP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/man/direnv.1.md 
new/direnv-2.24.0/man/direnv.1.md
--- old/direnv-2.23.1/man/direnv.1.md   2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/man/direnv.1.md   2020-11-15 19:12:19.000000000 +0100
@@ -118,7 +118,7 @@
 
 So here we are pretty sure that it won't do anything bad. Type `direnv allow .`
 and watch direnv loading your new environment. Note that `direnv edit .` is a
-handy shortcut that open the file in your $EDITOR and automatically allows it
+handy shortcut that opens the file in your $EDITOR and automatically reloads it
 if the file's modification time has changed.
 
 Now that the environment is loaded you can notice that once you `cd` out
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/rc.go new/direnv-2.24.0/rc.go
--- old/direnv-2.23.1/rc.go     2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/rc.go     2020-11-15 19:12:19.000000000 +0100
@@ -239,8 +239,14 @@
 }
 
 func fileExists(path string) bool {
-       _, err := os.Stat(path)
-       return err == nil
+       // Some broken filesystems like SSHFS return file information on stat() 
but
+       // then cannot open the file. So we use os.Open instead.
+       f, err := os.Open(path)
+       if err == nil {
+               f.Close()
+               return true
+       }
+       return false
 }
 
 func fileHash(path string) (hash string, err error) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/stdlib.go new/direnv-2.24.0/stdlib.go
--- old/direnv-2.23.1/stdlib.go 2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/stdlib.go 2020-11-15 19:12:19.000000000 +0100
@@ -15,7 +15,6 @@
        "shopt -s nullglob\n" +
        "shopt -s extglob\n" +
        "\n" +
-       "\n" +
        "# NOTE: don't touch the RHS, it gets replaced at runtime\n" +
        "direnv=\"$(command -v direnv)\"\n" +
        "\n" +
@@ -30,6 +29,90 @@
        "# algorithm and so it won't be re-exported.\n" +
        "export DIRENV_IN_ENVRC=1\n" +
        "\n" +
+       "__env_strictness() {\n" +
+       "  local mode tmpfile old_shell_options\n" +
+       "  local -i res\n" +
+       "\n" +
+       "  tmpfile=$(mktemp)\n" +
+       "  res=0\n" +
+       "  mode=\"$1\"\n" +
+       "  shift\n" +
+       "\n" +
+       "  set +o | grep 'pipefail\\|nounset\\|errexit' > \"$tmpfile\"\n" +
+       "  old_shell_options=$(< \"$tmpfile\")\n" +
+       "  rm -f tmpfile\n" +
+       "\n" +
+       "  case \"$mode\" in\n" +
+       "  strict)\n" +
+       "    set -o errexit -o nounset -o pipefail\n" +
+       "    ;;\n" +
+       "  unstrict)\n" +
+       "    set +o errexit +o nounset +o pipefail\n" +
+       "    ;;\n" +
+       "  *)\n" +
+       "    log_error \"Unknown strictness mode '${mode}'.\"\n" +
+       "    exit 1\n" +
+       "    ;;\n" +
+       "  esac\n" +
+       "\n" +
+       "  if (($#)); then\n" +
+       "    \"${@}\"\n" +
+       "    res=$?\n" +
+       "    eval \"$old_shell_options\"\n" +
+       "  fi\n" +
+       "\n" +
+       "  # Force failure if the inner script has failed and the mode is 
strict\n" +
+       "  if [[ $mode = strict && $res -gt 0 ]]; then\n" +
+       "    exit 1\n" +
+       "  fi\n" +
+       "\n" +
+       "  return $res\n" +
+       "}\n" +
+       "\n" +
+       "# Usage: strict_env [<command> ...]\n" +
+       "#\n" +
+       "# Turns on shell execution strictness. This will force the .envrc\n" +
+       "# evaluation context to exit immediately if:\n" +
+       "#\n" +
+       "# - any command in a pipeline returns a non-zero exit status that 
is\n" +
+       "#   not otherwise handled as part of `if`, `while`, or `until` 
tests,\n" +
+       "#   return value negation (`!`), or part of a boolean (`&&` or 
`||`)\n" +
+       "#   chain.\n" +
+       "# - any variable that has not explicitly been set or declared (with\n" 
+
+       "#   either `declare` or `local`) is referenced.\n" +
+       "#\n" +
+       "# If followed by a command-line, the strictness applies for the 
duration\n" +
+       "# of the command.\n" +
+       "#\n" +
+       "# Example:\n" +
+       "#\n" +
+       "#    strict_env\n" +
+       "#    has curl\n" +
+       "#\n" +
+       "#    strict_env has curl\n" +
+       "strict_env() {\n" +
+       "  __env_strictness strict \"$@\"\n" +
+       "}\n" +
+       "\n" +
+       "# Usage: unstrict_env [<command> ...]\n" +
+       "#\n" +
+       "# Turns off shell execution strictness. If followed by a command-line, 
the\n" +
+       "# strictness applies for the duration of the command.\n" +
+       "#\n" +
+       "# Example:\n" +
+       "#\n" +
+       "#    unstrict_env\n" +
+       "#    has curl\n" +
+       "#\n" +
+       "#    unstrict_env has curl\n" +
+       "unstrict_env() {\n" +
+       "  if (($#)); then\n" +
+       "    __env_strictness unstrict \"$@\"\n" +
+       "  else\n" +
+       "    set +o errexit +o nounset +o pipefail\n" +
+       "  fi\n" +
+       "}\n" +
+       "\n" +
        "# Usage: direnv_layout_dir\n" +
        "#\n" +
        "# Prints the folder path that direnv should use to store layout 
content.\n" +
@@ -254,6 +337,22 @@
        "  popd >/dev/null || return 1\n" +
        "}\n" +
        "\n" +
+       "# Usage: source_env_if_exists <filename>\n" +
+       "#\n" +
+       "# Loads another \".envrc\", but only if it exists.\n" +
+       "#\n" +
+       "# NOTE: contrary to source_env, this only works when passing a path to 
a file,\n" +
+       "#       not a directory.\n" +
+       "#\n" +
+       "# Example:\n" +
+       "# \n" +
+       "#    source_env_if_exists .envrc.private\n" +
+       "#\n" +
+       "source_env_if_exists() {\n" +
+       "  watch_file \"$1\"\n" +
+       "  if [[ -f \"$1\" ]]; then source_env \"$1\"; fi\n" +
+       "}\n" +
+       "\n" +
        "# Usage: watch_file <filename> [<filename> ...]\n" +
        "#\n" +
        "# Adds each <filename> to the list of files that direnv will watch for 
changes -\n" +
@@ -317,7 +416,7 @@
        "direnv_load() {\n" +
        "  # Backup watches in case of `nix-shell --pure`\n" +
        "  local prev_watches=$DIRENV_WATCHES\n" +
-       "  local temp_dir output_file script_file exit_code\n" +
+       "  local temp_dir output_file script_file exit_code 
old_direnv_dump_file_path\n" +
        "\n" +
        "  # Prepare a temporary place for dumps and such.\n" +
        "  temp_dir=$(mktemp -dt direnv.XXXXXX) || {\n" +
@@ -326,6 +425,7 @@
        "  }\n" +
        "  output_file=\"$temp_dir/output\"\n" +
        "  script_file=\"$temp_dir/script\"\n" +
+       "  old_direnv_dump_file_path=${DIRENV_DUMP_FILE_PATH:-}\n" +
        "\n" +
        "  # Chain the following commands explicitly so that we can capture the 
exit code\n" +
        "  # of the whole chain. Crucially this ensures that we don't return 
early (via\n" +
@@ -349,6 +449,13 @@
        "    export DIRENV_WATCHES=$prev_watches\n" +
        "  fi\n" +
        "\n" +
+       "  # Restore DIRENV_DUMP_FILE_PATH if needed\n" +
+       "  if [[ -n \"$old_direnv_dump_file_path\" ]]; then\n" +
+       "    export DIRENV_DUMP_FILE_PATH=$old_direnv_dump_file_path\n" +
+       "  else\n" +
+       "    unset DIRENV_DUMP_FILE_PATH\n" +
+       "  fi\n" +
+       "\n" +
        "  # Exit accordingly\n" +
        "  return ${exit_code:-0}\n" +
        "}\n" +
@@ -974,6 +1081,18 @@
        "  eval \"$(guix environment \"$@\" --search-paths)\"\n" +
        "}\n" +
        "\n" +
+       "# Usage: use_vim [<vimrc_file>]\n" +
+       "#\n" +
+       "# Prepends the specified vim script (or .vimrc.local by default) to 
the\n" +
+       "# `DIRENV_EXTRA_VIMRC` environment variable.\n" +
+       "#\n" +
+       "# This variable is understood by the direnv/direnv.vim extension. When 
found,\n" +
+       "# it will source it after opening files in the directory.\n" +
+       "use_vim() {\n" +
+       "  local extra_vimrc=${1:-.vimrc.local}\n" +
+       "  path_add DIRENV_EXTRA_VIMRC \"$extra_vimrc\"\n" +
+       "}\n" +
+       "\n" +
        "# Usage: direnv_version <version_at_least>\n" +
        "#\n" +
        "# Checks that the direnv version is at least old as 
<version_at_least>.\n" +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/stdlib.sh new/direnv-2.24.0/stdlib.sh
--- old/direnv-2.23.1/stdlib.sh 2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/stdlib.sh 2020-11-15 19:12:19.000000000 +0100
@@ -12,7 +12,6 @@
 shopt -s nullglob
 shopt -s extglob
 
-
 # NOTE: don't touch the RHS, it gets replaced at runtime
 direnv="$(command -v direnv)"
 
@@ -27,6 +26,90 @@
 # algorithm and so it won't be re-exported.
 export DIRENV_IN_ENVRC=1
 
+__env_strictness() {
+  local mode tmpfile old_shell_options
+  local -i res
+
+  tmpfile=$(mktemp)
+  res=0
+  mode="$1"
+  shift
+
+  set +o | grep 'pipefail\|nounset\|errexit' > "$tmpfile"
+  old_shell_options=$(< "$tmpfile")
+  rm -f tmpfile
+
+  case "$mode" in
+  strict)
+    set -o errexit -o nounset -o pipefail
+    ;;
+  unstrict)
+    set +o errexit +o nounset +o pipefail
+    ;;
+  *)
+    log_error "Unknown strictness mode '${mode}'."
+    exit 1
+    ;;
+  esac
+
+  if (($#)); then
+    "${@}"
+    res=$?
+    eval "$old_shell_options"
+  fi
+
+  # Force failure if the inner script has failed and the mode is strict
+  if [[ $mode = strict && $res -gt 0 ]]; then
+    exit 1
+  fi
+
+  return $res
+}
+
+# Usage: strict_env [<command> ...]
+#
+# Turns on shell execution strictness. This will force the .envrc
+# evaluation context to exit immediately if:
+#
+# - any command in a pipeline returns a non-zero exit status that is
+#   not otherwise handled as part of `if`, `while`, or `until` tests,
+#   return value negation (`!`), or part of a boolean (`&&` or `||`)
+#   chain.
+# - any variable that has not explicitly been set or declared (with
+#   either `declare` or `local`) is referenced.
+#
+# If followed by a command-line, the strictness applies for the duration
+# of the command.
+#
+# Example:
+#
+#    strict_env
+#    has curl
+#
+#    strict_env has curl
+strict_env() {
+  __env_strictness strict "$@"
+}
+
+# Usage: unstrict_env [<command> ...]
+#
+# Turns off shell execution strictness. If followed by a command-line, the
+# strictness applies for the duration of the command.
+#
+# Example:
+#
+#    unstrict_env
+#    has curl
+#
+#    unstrict_env has curl
+unstrict_env() {
+  if (($#)); then
+    __env_strictness unstrict "$@"
+  else
+    set +o errexit +o nounset +o pipefail
+  fi
+}
+
 # Usage: direnv_layout_dir
 #
 # Prints the folder path that direnv should use to store layout content.
@@ -251,6 +334,22 @@
   popd >/dev/null || return 1
 }
 
+# Usage: source_env_if_exists <filename>
+#
+# Loads another ".envrc", but only if it exists.
+#
+# NOTE: contrary to source_env, this only works when passing a path to a file,
+#       not a directory.
+#
+# Example:
+# 
+#    source_env_if_exists .envrc.private
+#
+source_env_if_exists() {
+  watch_file "$1"
+  if [[ -f "$1" ]]; then source_env "$1"; fi
+}
+
 # Usage: watch_file <filename> [<filename> ...]
 #
 # Adds each <filename> to the list of files that direnv will watch for changes 
-
@@ -314,7 +413,7 @@
 direnv_load() {
   # Backup watches in case of `nix-shell --pure`
   local prev_watches=$DIRENV_WATCHES
-  local temp_dir output_file script_file exit_code
+  local temp_dir output_file script_file exit_code old_direnv_dump_file_path
 
   # Prepare a temporary place for dumps and such.
   temp_dir=$(mktemp -dt direnv.XXXXXX) || {
@@ -323,6 +422,7 @@
   }
   output_file="$temp_dir/output"
   script_file="$temp_dir/script"
+  old_direnv_dump_file_path=${DIRENV_DUMP_FILE_PATH:-}
 
   # Chain the following commands explicitly so that we can capture the exit 
code
   # of the whole chain. Crucially this ensures that we don't return early (via
@@ -346,6 +446,13 @@
     export DIRENV_WATCHES=$prev_watches
   fi
 
+  # Restore DIRENV_DUMP_FILE_PATH if needed
+  if [[ -n "$old_direnv_dump_file_path" ]]; then
+    export DIRENV_DUMP_FILE_PATH=$old_direnv_dump_file_path
+  else
+    unset DIRENV_DUMP_FILE_PATH
+  fi
+
   # Exit accordingly
   return ${exit_code:-0}
 }
@@ -971,6 +1078,18 @@
   eval "$(guix environment "$@" --search-paths)"
 }
 
+# Usage: use_vim [<vimrc_file>]
+#
+# Prepends the specified vim script (or .vimrc.local by default) to the
+# `DIRENV_EXTRA_VIMRC` environment variable.
+#
+# This variable is understood by the direnv/direnv.vim extension. When found,
+# it will source it after opening files in the directory.
+use_vim() {
+  local extra_vimrc=${1:-.vimrc.local}
+  path_add DIRENV_EXTRA_VIMRC "$extra_vimrc"
+}
+
 # Usage: direnv_version <version_at_least>
 #
 # Checks that the direnv version is at least old as <version_at_least>.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/test/stdlib.bash 
new/direnv-2.24.0/test/stdlib.bash
--- old/direnv-2.23.1/test/stdlib.bash  2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/test/stdlib.bash  2020-11-15 19:12:19.000000000 +0100
@@ -137,4 +137,25 @@
   test_julia ""    "1.5"
 )
 
+test_name source_env_if_exists
+(
+  load_stdlib
+
+  workdir=$(mktemp -d)
+  trap 'rm -rf "$workdir"' EXIT
+
+  cd "$workdir"
+
+  # Try to source a file that doesn't exist
+  source_env_if_exists non_existing_file
+
+  # Try to source a file that exists
+  echo "export FOO=bar" > existing_file
+  source_env_if_exists existing_file
+  [[ $FOO = bar ]]
+)
+
+# test strict_env and unstrict_env
+./strict_env_test.bash
+
 echo OK
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/test/strict_env_test.bash 
new/direnv-2.24.0/test/strict_env_test.bash
--- old/direnv-2.23.1/test/strict_env_test.bash 1970-01-01 01:00:00.000000000 
+0100
+++ new/direnv-2.24.0/test/strict_env_test.bash 2020-11-15 19:12:19.000000000 
+0100
@@ -0,0 +1,67 @@
+#! /usr/bin/env bash
+
+# Note: this is _explicitly_ not setting `set -euo pipefail`
+# because we are testing functions that configure that.
+
+declare base expected actual
+base="${TMPDIR:-/tmp}/$(basename "$0").$$"
+expected="$base".expected
+actual="$base".actual
+
+declare -i success
+success=0
+
+# always execute relative to here
+cd "$(dirname "$0")" || exit 1
+
+# add the built direnv to the path
+root=$(cd .. && pwd -P)
+export PATH=$root:$PATH
+
+load_stdlib() {
+  # shellcheck disable=SC1090
+  source "$root/stdlib.sh"
+}
+
+test_fail() {
+  echo "FAILED $*: expected is not actual"
+  exit 1
+}
+
+test_strictness() {
+  local step
+  step="$1"
+  echo "$2" > "$expected"
+
+  set -o | grep 'errexit\|nounset\|pipefail' > "$actual"
+  diff -u "$expected" "$actual" || test_fail "$step"
+  (( success += 1 ))
+}
+
+load_stdlib
+
+test_strictness 'after source' $'errexit               off
+nounset                off
+pipefail               off'
+
+strict_env
+test_strictness 'after strict_env' $'errexit           on
+nounset                on
+pipefail               on'
+
+unstrict_env echo HELLO > /dev/null
+test_strictness "after unstrict_env with command" $'errexit            on
+nounset                on
+pipefail               on'
+
+strict_env echo HELLO > /dev/null
+test_strictness "after strict_env with command" $'errexit              on
+nounset                on
+pipefail               on'
+
+unstrict_env
+test_strictness 'after unstrict_env' $'errexit         off
+nounset                off
+pipefail               off'
+
+echo "OK ($success tests)"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/version.go new/direnv-2.24.0/version.go
--- old/direnv-2.23.1/version.go        2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/version.go        2020-11-15 19:12:19.000000000 +0100
@@ -1,3 +1,3 @@
 package main
 
-const Version = "2.23.1"
+const Version = "2.24.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/version.txt 
new/direnv-2.24.0/version.txt
--- old/direnv-2.23.1/version.txt       2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/version.txt       2020-11-15 19:12:19.000000000 +0100
@@ -1 +1 @@
-2.23.1
+2.24.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/direnv-2.23.1/xdg/xdg.go new/direnv-2.24.0/xdg/xdg.go
--- old/direnv-2.23.1/xdg/xdg.go        2020-10-22 20:34:41.000000000 +0200
+++ new/direnv-2.24.0/xdg/xdg.go        2020-11-15 19:12:19.000000000 +0100
@@ -36,7 +36,7 @@
 // CacheDir returns the cache directory for the application
 func CacheDir(env map[string]string, programName string) string {
        if env["XDG_CACHE_HOME"] != "" {
-               return filepath.Join(env["XDG_CONFIG_HOME"], programName)
+               return filepath.Join(env["XDG_CACHE_HOME"], programName)
        } else if env["HOME"] != "" {
                return filepath.Join(env["HOME"], ".cache", programName)
        }
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to