Commit ac07e47
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.
https://public-inbox.org/git/20180818223329.GJ11326@hank.intra.tgummerer.com/
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>get_untracked_files() and check_changes()
1 parent 8c4fd89 commit ac07e47
1 file changed
+30
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
| 889 | + | |
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
895 | | - | |
| 895 | + | |
| 896 | + | |
896 | 897 | | |
897 | 898 | | |
898 | 899 | | |
899 | 900 | | |
900 | | - | |
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
928 | 943 | | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
| 944 | + | |
| 945 | + | |
933 | 946 | | |
934 | | - | |
935 | | - | |
| 947 | + | |
936 | 948 | | |
937 | 949 | | |
938 | 950 | | |
| |||
1143 | 1155 | | |
1144 | 1156 | | |
1145 | 1157 | | |
1146 | | - | |
| 1158 | + | |
1147 | 1159 | | |
1148 | 1160 | | |
1149 | 1161 | | |
| |||
1168 | 1180 | | |
1169 | 1181 | | |
1170 | 1182 | | |
1171 | | - | |
1172 | | - | |
| 1183 | + | |
1173 | 1184 | | |
1174 | 1185 | | |
1175 | 1186 | | |
| |||
1254 | 1265 | | |
1255 | 1266 | | |
1256 | 1267 | | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
| 1268 | + | |
| 1269 | + | |
1260 | 1270 | | |
1261 | | - | |
| 1271 | + | |
| 1272 | + | |
1262 | 1273 | | |
1263 | 1274 | | |
1264 | 1275 | | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
| 1276 | + | |
1271 | 1277 | | |
1272 | 1278 | | |
1273 | 1279 | | |
| |||
1277 | 1283 | | |
1278 | 1284 | | |
1279 | 1285 | | |
| 1286 | + | |
1280 | 1287 | | |
1281 | 1288 | | |
1282 | 1289 | | |
| |||
1311 | 1318 | | |
1312 | 1319 | | |
1313 | 1320 | | |
1314 | | - | |
| 1321 | + | |
1315 | 1322 | | |
1316 | 1323 | | |
1317 | 1324 | | |
| |||
0 commit comments