Commit ef0f0b4
stash: optimize
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>get_untracked_files() and check_changes()
1 parent 64fe9c2 commit ef0f0b4
1 file changed
+27
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
| 882 | + | |
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | | - | |
| 888 | + | |
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
893 | | - | |
894 | 893 | | |
895 | 894 | | |
896 | 895 | | |
| |||
918 | 917 | | |
919 | 918 | | |
920 | 919 | | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
921 | 934 | | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
| 935 | + | |
| 936 | + | |
926 | 937 | | |
927 | | - | |
928 | | - | |
| 938 | + | |
929 | 939 | | |
930 | 940 | | |
931 | 941 | | |
| |||
1137 | 1147 | | |
1138 | 1148 | | |
1139 | 1149 | | |
1140 | | - | |
| 1150 | + | |
1141 | 1151 | | |
1142 | 1152 | | |
1143 | 1153 | | |
| |||
1162 | 1172 | | |
1163 | 1173 | | |
1164 | 1174 | | |
1165 | | - | |
1166 | | - | |
| 1175 | + | |
1167 | 1176 | | |
1168 | 1177 | | |
1169 | 1178 | | |
| |||
1248 | 1257 | | |
1249 | 1258 | | |
1250 | 1259 | | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1251 | 1263 | | |
1252 | 1264 | | |
1253 | 1265 | | |
1254 | 1266 | | |
1255 | 1267 | | |
1256 | 1268 | | |
1257 | 1269 | | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
| 1270 | + | |
1264 | 1271 | | |
1265 | 1272 | | |
1266 | 1273 | | |
| |||
1270 | 1277 | | |
1271 | 1278 | | |
1272 | 1279 | | |
| 1280 | + | |
1273 | 1281 | | |
1274 | 1282 | | |
1275 | 1283 | | |
| |||
1304 | 1312 | | |
1305 | 1313 | | |
1306 | 1314 | | |
1307 | | - | |
| 1315 | + | |
1308 | 1316 | | |
1309 | 1317 | | |
1310 | 1318 | | |
| |||
0 commit comments