From e4a5cb6416a8908a65e274cd00f7ea04f5094d77 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 8 Mar 2023 08:58:33 +0100 Subject: Stash and pop changes when syncing --- CHANGELOG.md | 6 ++++++ lib/subcommands/sync.bash | 4 ++++ 2 files changed, 10 insertions(+) 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 -- cgit v1.1