aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-03-08 08:58:33 +0100
committerPatrick Spek <p.spek@tyil.nl>2023-03-08 08:58:33 +0100
commite4a5cb6416a8908a65e274cd00f7ea04f5094d77 (patch)
treec1f2a303e1e9c7a8e31d218866bd745addc78b34
parente777cbc1cb10da93cb257305b05a6bba54307813 (diff)
Stash and pop changes when syncing
-rw-r--r--CHANGELOG.md6
-rw-r--r--lib/subcommands/sync.bash4
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd66446..474c4a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
recursively, calculate a hash for each of them, and then calculate a hash
based on the total result. The intended goal is to allow running before and
after templating some files, to deduce whether something actually changed.
+- A `diff` subcommand has been added to show all non-committed changes. It is a
+ convenience wrapper to avoid having to change directory and run `git diff` to
+ get an overview of all pending changes.
### Changed
@@ -46,6 +49,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
passed to the `pkg_*()` function will be used by the host's package manager.
- `datetime()` now always passes `-u` on to `date`.
- All manpages now include a `NAME` section.
+- The `sync` subcomman will now `stash` any changes before it attempts to
+ `pull`. Afterwards, `stash pop` will be ran to apply the last `stash`ed
+ changes again.
## [1.0.0] - 2022-05-06
diff --git a/lib/subcommands/sync.bash b/lib/subcommands/sync.bash
index 0413ce4..ed03faa 100644
--- a/lib/subcommands/sync.bash
+++ b/lib/subcommands/sync.bash
@@ -17,8 +17,12 @@ subcommand()
notice "bashtard/sync" "Syncing $BASHTARD_ETCDIR"
pushd -- "$BASHTARD_ETCDIR" > /dev/null || return 4
+
+ git stash
git pull origin master || return 4
git submodule update --recursive --remote || return 4
+ git stash pop
+
popd > /dev/null || return 4
# Run a sync for each registered playbook for this host