mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 04:18:48 +00:00
Create new file only if there are changes
Code submitted by @vburdo in https://github.com/tmux-plugins/tmux-resurrect/issues/156
This commit is contained in:
parent
dec4e15fc5
commit
b1f3df21e9
@ -18,6 +18,7 @@
|
|||||||
- `mutt` added to the list of automatically restored programs
|
- `mutt` added to the list of automatically restored programs
|
||||||
- added guide for migrating from tmuxinator
|
- added guide for migrating from tmuxinator
|
||||||
- fixed a bug for restoring commands on tmux 2.5 (and probably tmux 2.4)
|
- fixed a bug for restoring commands on tmux 2.5 (and probably tmux 2.4)
|
||||||
|
- do not create another resurrect file if there are no changes (credit @vburdo)
|
||||||
|
|
||||||
### v2.4.0, 2015-02-23
|
### v2.4.0, 2015-02-23
|
||||||
- add "tmux-test"
|
- add "tmux-test"
|
||||||
|
@ -56,6 +56,10 @@ capture_pane_contents_option_on() {
|
|||||||
[ "$option" == "on" ]
|
[ "$option" == "on" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
files_differ() {
|
||||||
|
! cmp -s "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
save_bash_history_option_on() {
|
save_bash_history_option_on() {
|
||||||
local option="$(get_tmux_option "$bash_history_option" "off")"
|
local option="$(get_tmux_option "$bash_history_option" "off")"
|
||||||
[ "$option" == "on" ]
|
[ "$option" == "on" ]
|
||||||
|
@ -254,12 +254,17 @@ dump_bash_history() {
|
|||||||
|
|
||||||
save_all() {
|
save_all() {
|
||||||
local resurrect_file_path="$(resurrect_file_path)"
|
local resurrect_file_path="$(resurrect_file_path)"
|
||||||
|
local last_resurrect_file="$(last_resurrect_file)"
|
||||||
mkdir -p "$(resurrect_dir)"
|
mkdir -p "$(resurrect_dir)"
|
||||||
fetch_and_dump_grouped_sessions > "$resurrect_file_path"
|
fetch_and_dump_grouped_sessions > "$resurrect_file_path"
|
||||||
dump_panes >> "$resurrect_file_path"
|
dump_panes >> "$resurrect_file_path"
|
||||||
dump_windows >> "$resurrect_file_path"
|
dump_windows >> "$resurrect_file_path"
|
||||||
dump_state >> "$resurrect_file_path"
|
dump_state >> "$resurrect_file_path"
|
||||||
ln -fs "$(basename "$resurrect_file_path")" "$(last_resurrect_file)"
|
if files_differ "$resurrect_file_path" "$last_resurrect_file"; then
|
||||||
|
ln -fs "$(basename "$resurrect_file_path")" "$last_resurrect_file"
|
||||||
|
else
|
||||||
|
rm "$resurrect_file_path"
|
||||||
|
fi
|
||||||
if capture_pane_contents_option_on; then
|
if capture_pane_contents_option_on; then
|
||||||
mkdir -p "$(pane_contents_dir)"
|
mkdir -p "$(pane_contents_dir)"
|
||||||
dump_pane_contents
|
dump_pane_contents
|
||||||
|
Loading…
Reference in New Issue
Block a user