@@ -156,7 +156,7 @@ bundle agent git_clean(repo_path)
156156}
157157
158158bundle agent git_stash(repo_path, stash_name)
159- # @brief Stash any changes (including untracked files) in repo_path
159+ # @brief Stash any changes (including untracked files if git is capable ) in repo_path
160160# @param repo_path Path to the clone
161161# @param stash_name Stash name
162162#
@@ -169,14 +169,31 @@ bundle agent git_stash(repo_path, stash_name)
169169# comment => "Stash any changes, including untracked files";
170170# ```
171171{
172+ classes:
173+ _stdlib_path_exists_git::
174+ "_git_stash_supports_including_untracked_files" -> { "CFE-3383" }
175+ expression => regcmp( ".*--include-untracked.*",
176+ execresult( "$(paths.git) stash --help", noshell ) );
177+
178+ vars:
179+ "_stash_options"
180+ string => concat( "save ",
181+ "--quiet ",
182+ ifelse( "_git_stash_supports_including_untracked_files",
183+ "--include-untracked", ""),
184+ "$(stash_name)");
185+
172186 methods:
173- "" usebundle => git($(repo_path), "stash", 'save --quiet --include-untracked "$(stash_name)"' ),
187+ "" usebundle => git($(repo_path), "stash", $(_stash_options) ),
174188 comment => "So that we don't lose any trail of what happened and so that
175189 we don't accidentally delete something important we stash any
176190 changes.
177191 Note:
178192 1. This promise will fail if user.email is not set
179193 2. We are respecting ignored files.";
194+
195+ !_stdlib_path_exists_git::
196+ "Warning: bundle '$(this.bundle)' actuated, but git not found";
180197}
181198
182199bundle agent git_stash_and_clean(repo_path)
0 commit comments