Commit a8472bd
stash: fix segmentation fault when files were added with intent
After `git add -N <file>`, the index is in a special state. A state for
which the built-in stash was not prepared, as it failed to initialize
the `rev` structure in that case before using `&rev.pending`. If
`reset_tree()` returns a non-zero value, `stash_working_tree()`
calls `object_array_clear()` with `&rev.pending`. If `rev` is not
initialized, this causes a segmentation fault.
Prevent this by initializing `rev` before calling `reset_tree()`.
This fixes #2006.
[jes: modified the commit message in preparation for sending this patch
to the Git mailing list.]
Signed-off-by: Matthew Kraai <mkraai@its.jnj.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent a9fba51 commit a8472bd
2 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1050 | 1050 | | |
1051 | 1051 | | |
1052 | 1052 | | |
| 1053 | + | |
| 1054 | + | |
1053 | 1055 | | |
1054 | 1056 | | |
1055 | 1057 | | |
1056 | 1058 | | |
1057 | 1059 | | |
1058 | 1060 | | |
1059 | 1061 | | |
1060 | | - | |
1061 | 1062 | | |
1062 | 1063 | | |
1063 | 1064 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
| |||
0 commit comments