Commit Graph

284 Commits

Author SHA1 Message Date
Erik Flodin 1aa9839096
Bump shellcheck to version 0.8.0 in docker image
And fix the new SC2295 warning.
2021-12-29 21:55:14 +01:00
Erik Flodin 2379d63068
Support overriding architecture
In the same way as os, hostname and user.
2021-12-27 22:21:18 +01:00
Tim Byrne bacc948bba
Support "YADM_ARCH" variable in esh templates 2021-12-23 15:43:29 -06:00
Tim Byrne 31e2ce56bc
Support "arch" variable in built-in templates 2021-12-23 15:42:08 -06:00
Tim Byrne 85e05d311a
Merge pull request #203 from jameshclrk/arch-alternative 2021-12-21 16:50:41 -06:00
Tim Byrne f8abcd756b
Update version number and update documentation
* Fix clone support for older versions of Git (#348)
* Fix support for multiple GPG recipients (#342)
* Find symlinks in bootstrap-in-dir (#340)
2021-08-23 08:25:10 -05:00
Tim Byrne db78669479
Fix clone support for older versions of Git (#348) 2021-08-23 08:12:09 -05:00
Tim Byrne 5adb486727
Fix support for multiple GPG recipients (#342) 2021-05-17 15:42:35 -05:00
Tim Byrne a4d39c7504
Update version number and update documentation
* Use `git clone` directly during clone (#289, #323)
* Fix compatibility bug with Git completions (#318, #321)
* Support relative paths for --yadm-* and -w (#301)
* Improve parsing of if-statement in default template (#303)
* Read files without running cat in subshells (#317)
* Improve portability of updating read-only files (#320)
* Various code improvements (#306, #307, #311)
2021-04-03 12:00:02 -05:00
Tim Byrne 216aed2f87
Adjust special handling of existing read-only output files
Instead of duplicating the permissions on the temp file, the permissions
are duplicated on the output file directly. If the output file exists as
read-only, it is made writeable first.

There are some environments which don't allow the mv to work if the file
itself is read-only.
2021-02-28 10:55:37 -06:00
Tim Byrne 39773765ab
Merge pull request #320 from rasa/rs/update-read-only-files 2021-02-27 18:36:58 -06:00
Ross Smith II 814e5f8ab3
Replace cats with reads (passes all tests)
Signed-off-by: Ross Smith II <ross@smithii.com>
2021-02-23 17:51:44 -08:00
Tim Byrne d11e094f7b
Merge pull request #303 from erijo/default-template-if 2021-02-15 12:57:45 -06:00
Tim Byrne e6d7e6f174
Simplify return 2021-02-15 12:51:33 -06:00
Tim Byrne 999692fe5e
Merge pull request #307 from rasa/rs/simplify_parse_encrypt 2021-02-15 12:45:31 -06:00
Tim Byrne a8e5b20021
Move shellcheck option below license 2021-02-15 12:39:27 -06:00
Tim Byrne 8ece22ab2a
Merge pull request #306 from rasa/rs/default-shellcheck 2021-02-15 12:33:22 -06:00
Tim Byrne 79f7aae073
Remove unnecessary [[ 2021-02-15 12:27:55 -06:00
Tim Byrne 88ee3f09fb
Merge pull request #301 from erijo/relative-path 2021-02-15 12:11:21 -06:00
Tim Byrne e6cfd39bbc
Remove mktemp dependency 2021-02-03 22:46:48 -06:00
Ross Smith II 96471a6d68
Fix updating of readonly files 2021-01-30 18:17:59 -08:00
Ross Smith II 84136a8633
Remove unneeded duplicate line 2021-01-11 17:17:11 -08:00
Ross Smith II 0c788ae020
Simplify parse_encrypt by exiting early
if encrypt file doesn't exist.

Signed-off-by: Ross Smith II <ross@smithii.com>
2021-01-10 19:07:21 -08:00
Ross Smith II fecbb315df
Add 'shellcheck shell=bash' as the default
See https://github.com/koalaman/shellcheck/wiki/Directive#shell

Signed-off-by: Ross Smith II <ross@smithii.com>
2021-01-10 18:49:28 -08:00
Erik Flodin e2ed647c2a
Tighten up parsing of if-statement in default template
Require space after if and an ending %} after the condition.
2021-01-10 20:53:12 +01:00
Erik Flodin accec694f5
Deinit submodules before removing the repo
when forcing init/clone to happen.
2021-01-08 22:21:35 +01:00
Erik Flodin f45e66d4da
Rework clone
Instead of doing work to find the default branch just to be able to
set up the repository before doing a fetch, do a "git clone" and let
git handle it.

Use -c core.sharedrepository=0600 to get the same result as
--shared=0600 passed to init.

Use --separate-git-dir to get the git directory in $YADM_REPO. Use a
temporary dir as work tree and remove it right after the clone is
done.

When the clone is done, iterate over all missing files in $YADM_WORK
and perform a checkout. If local files exists that differ compared
with the cloned ones the local files are left intact and the user is
instructed to deal with the conflicts.
2021-01-08 22:05:46 +01:00
Erik Flodin a321c88c7c
Support passing relative paths to --yadm-* and -w
Relative paths are expanded relative the current working dir as
expected.
2021-01-08 21:45:55 +01:00
Tim Byrne a5b1067e02
Update version number and update documentation
* Fix parsing by sh (#299)
2021-01-07 10:49:26 -06:00
Tim Byrne b32025bcc3
Fix parsing by sh (#299) 2021-01-07 10:46:06 -06:00
Tim Byrne afab29c5fc
Update version number and update documentation
* Improve handling of submodules at upgrade (#284, #285, #293)
* Improve Zsh completions (#292, #298)
* Use stderr for error messages (#297)
2021-01-07 09:24:11 -06:00
Erik Flodin 6378fe3073
Print errors to stderr
This makes it possible to run e.g. "yadm -Y foo introspect repo
2>/dev/null" and get an empty output instead of getting the error
message about foo not being fully qualified.
2021-01-05 21:57:32 +01:00
Erik Flodin 5818eeb9dd
Change handling of submodules at upgrade
Start with doing "submodule absorbgitdirs" as otherwise "submodule
deinit" will fail if a module has been cloned first and later added as
a submodule (as it will then contain the .git dir instead of it being
under the superprojects .git dir).

Then try to deinit the submodules before moving the repo and abort the
upgrade if it fails for any submodule. Then do the move and finally
initialize the submodules that were initialized before the upgrade.

See #285
2021-01-04 18:31:24 +01:00
Tim Byrne dcfa55ce49
Update version number and update documentation
* Support encryption with OpenSSL (#138)
* Support "include" directive in built-in template processor (#255)
* Support extensions for alternate files and templates (#257)
* Improve support for default branches (#231, #232)
* Add --version and --help as yadm internal commands (#267)
* Improve support for XDG base directory specification
* Use XDG_DATA_HOME used for encrypted data and repository (#208)
* Default repo is now ~/.local/share/yadm/repo.git
* Default encrypted archive is now ~/.local/share/yadm/archive
* Improve shell completions (#238, #274, #275)
* Remove support for YADM_COMPATIBILITY=1 (#242)
* Remove deprecated option cygwin-copy
* Fix template mode inheritance on FreeBSD (#243, #246)
* Fix hook execution under MinGW (#150)
* Improve compatibility with Oil shell (#210)
2020-12-30 16:59:58 -06:00
Tim Byrne 7c1192ae2e
Support upgrading from version 1 repos
* yadm upgrade now updates legacy paths created by yadm 1
* Warnings are issued for invalid alternates again
2020-12-30 14:19:49 -06:00
Erik Flodin 8a3fb1a518
Make yadm enter work with zsh and tramp
zle must be disabled when using tramp, otherwise it doesn't work.
2020-12-29 23:58:05 +01:00
Erik Flodin 5e9c5cf66c
Issue legacy path warnings to stderr
To make it possible to ignore the warning e.g. when running yadm
introspect repo in the bash completion.
2020-12-27 22:33:15 +01:00
Tim Byrne df2ff5ec70
Remove deprecated option cygwin-copy 2020-12-26 12:34:58 -06:00
Tim Byrne d45d53ff39
Fix typo 2020-12-23 10:40:36 -06:00
Tim Byrne f9337101ee
Adjust formatting
Also use `{...;}` instead of `(...)`
2020-12-22 11:51:46 -06:00
Tim Byrne c2cb41cdd5
Merge pull request #150 from addshore/patch-1 2020-12-22 11:17:05 -06:00
Tim Byrne 7f23dde912
Merge pull request #210 from abathur/fix_regexp_space 2020-12-22 11:01:51 -06:00
Tim Byrne d298b42653
Merge pull request #257 from erijo/extension 2020-12-22 10:08:30 -06:00
Tim Byrne 999e0f11f8
Merge pull request #259 from erijo/cleanups 2020-12-22 09:54:01 -06:00
Tim Byrne 56e48947d0
Merge pull request #271 from rasa/patch-3 2020-12-22 09:41:06 -06:00
Tim Byrne c4b419d98e
Add --version and --help as yadm internal commands (#267) 2020-12-21 17:06:14 -06:00
Tim Byrne e3d2ea2863
Combine local and assignments where appropriate 2020-12-21 17:06:14 -06:00
Ross Smith II e2d9c06168
Fix paths in yadm help output
For completeness, I added the bootstrap script too.
2020-12-18 09:44:01 -08:00
Tim Byrne 80d8949850
Update regex to match horizontal white space only 2020-12-06 22:36:12 -06:00
Tim Byrne 4b5f16d73a
Improve support for default branches (#231, #232)
Unless a branch is specified, the default remote HEAD is used during
clone. Also a local master branch is not created if it is not the remote
HEAD.
2020-12-06 13:23:25 -06:00