@@ -1137,7 +1137,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
11371137 int ret = 0 ;
11381138 struct strbuf untracked_msg = STRBUF_INIT ;
11391139 struct child_process cp_upd_index = CHILD_PROCESS_INIT ;
1140- struct index_state istate = { NULL } ;
1140+ struct index_state istate = INDEX_STATE_INIT ;
11411141
11421142 cp_upd_index .git_cmd = 1 ;
11431143 strvec_pushl (& cp_upd_index .args , "update-index" , "-z" , "--add" ,
@@ -1165,7 +1165,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
11651165 }
11661166
11671167done :
1168- discard_index (& istate );
1168+ release_index (& istate );
11691169 strbuf_release (& untracked_msg );
11701170 remove_path (stash_index_path .buf );
11711171 return ret ;
@@ -1176,7 +1176,7 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
11761176{
11771177 int ret = 0 ;
11781178 struct child_process cp_diff_tree = CHILD_PROCESS_INIT ;
1179- struct index_state istate = { NULL } ;
1179+ struct index_state istate = INDEX_STATE_INIT ;
11801180
11811181 if (write_index_as_tree (& info -> w_tree , & istate , the_repository -> index_file ,
11821182 0 , NULL )) {
@@ -1199,7 +1199,7 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
11991199 }
12001200
12011201done :
1202- discard_index (& istate );
1202+ release_index (& istate );
12031203 return ret ;
12041204}
12051205
@@ -1209,7 +1209,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
12091209 int ret = 0 ;
12101210 struct child_process cp_read_tree = CHILD_PROCESS_INIT ;
12111211 struct child_process cp_diff_tree = CHILD_PROCESS_INIT ;
1212- struct index_state istate = { NULL } ;
1212+ struct index_state istate = INDEX_STATE_INIT ;
12131213 char * old_index_env = NULL , * old_repo_index_file ;
12141214
12151215 remove_path (stash_index_path .buf );
@@ -1260,7 +1260,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
12601260 }
12611261
12621262done :
1263- discard_index (& istate );
1263+ release_index (& istate );
12641264 remove_path (stash_index_path .buf );
12651265 return ret ;
12661266}
@@ -1271,7 +1271,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
12711271 struct rev_info rev ;
12721272 struct child_process cp_upd_index = CHILD_PROCESS_INIT ;
12731273 struct strbuf diff_output = STRBUF_INIT ;
1274- struct index_state istate = { NULL } ;
1274+ struct index_state istate = INDEX_STATE_INIT ;
12751275
12761276 init_revisions (& rev , NULL );
12771277 copy_pathspec (& rev .prune_data , ps );
@@ -1319,7 +1319,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
13191319 }
13201320
13211321done :
1322- discard_index (& istate );
1322+ release_index (& istate );
13231323 release_revisions (& rev );
13241324 strbuf_release (& diff_output );
13251325 remove_path (stash_index_path .buf );
0 commit comments