diff options
author | Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com> | 2019-02-25 23:16:26 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-07 09:41:40 +0900 |
commit | ef0f0b4509ae8bd6736dacf740d9e1bc1281f7bd (patch) | |
tree | 458159720b502d3489df9e0e2a3be339008392f9 /t/t4139-apply-escape.sh | |
parent | stash: convert save to builtin (diff) | |
download | tgif-ef0f0b4509ae8bd6736dacf740d9e1bc1281f7bd.tar.xz |
stash: optimize `get_untracked_files()` and `check_changes()`
This commits introduces a optimization by avoiding calling the
same functions again. For example, `git stash push -u`
would call at some points the following functions:
* `check_changes()` (inside `do_push_stash()`)
* `do_create_stash()`, which calls: `check_changes()` and
`get_untracked_files()`
Note that `check_changes()` also calls `get_untracked_files()`.
So, `check_changes()` is called 2 times and `get_untracked_files()`
3 times.
The old function `check_changes()` now consists of two functions:
`get_untracked_files()` and `check_changes_tracked_files()`.
These are the call chains for `push` and `create`:
* `push_stash()` -> `do_push_stash()` -> `do_create_stash()`
* `create_stash()` -> `do_create_stash()`
To prevent calling the same functions over and over again,
`check_changes()` inside `do_create_stash()` is now placed
in the caller functions (`create_stash()` and `do_push_stash()`).
This way `check_changes()` and `get_untracked files()` are called
only one time.
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4139-apply-escape.sh')
0 files changed, 0 insertions, 0 deletions