Merge branch 'dl/stash-show-untracked-fixup'

The code to handle options recently added to "git stash show"
around untracked part of the stash segfaulted when these options
were used on a stash entry that does not record untracked part.

* dl/stash-show-untracked-fixup:
  stash show: fix segfault with --{include,only}-untracked
  t3905: correct test title
This commit is contained in:
Junio C Hamano
2021-05-16 21:05:24 +09:00
2 changed files with 22 additions and 3 deletions

View File

@ -902,10 +902,14 @@ static int show_stash(int argc, const char **argv, const char *prefix)
diff_tree_oid(&info.b_commit, &info.w_commit, "", &rev.diffopt);
break;
case UNTRACKED_ONLY:
diff_root_tree_oid(&info.u_tree, "", &rev.diffopt);
if (info.has_u)
diff_root_tree_oid(&info.u_tree, "", &rev.diffopt);
break;
case UNTRACKED_INCLUDE:
diff_include_untracked(&info, &rev.diffopt);
if (info.has_u)
diff_include_untracked(&info, &rev.diffopt);
else
diff_tree_oid(&info.b_commit, &info.w_commit, "", &rev.diffopt);
break;
}
log_tree_diff_flush(&rev);