@@ -282,8 +282,10 @@ static int apply_autostash(struct rebase_options *opts)
282
282
if (!file_exists (path ))
283
283
return 0 ;
284
284
285
- if (read_one (state_dir_path ( "autostash" , opts ) , & autostash ))
285
+ if (read_one (path , & autostash ))
286
286
return error (_ ("Could not read '%s'" ), path );
287
+ /* Ensure that the hash is not mistaken for a number */
288
+ strbuf_addstr (& autostash , "^0" );
287
289
argv_array_pushl (& stash_apply .args ,
288
290
"stash" , "apply" , autostash .buf , NULL );
289
291
stash_apply .git_cmd = 1 ;
@@ -1531,7 +1533,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1531
1533
update_index_if_able (& the_index , & lock_file );
1532
1534
rollback_lock_file (& lock_file );
1533
1535
1534
- if (has_unstaged_changes (0 ) || has_uncommitted_changes (0 )) {
1536
+ if (has_unstaged_changes (1 ) || has_uncommitted_changes (1 )) {
1535
1537
const char * autostash =
1536
1538
state_dir_path ("autostash" , & options );
1537
1539
struct child_process stash = CHILD_PROCESS_INIT ;
@@ -1557,7 +1559,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1557
1559
if (safe_create_leading_directories_const (autostash ))
1558
1560
die (_ ("Could not create directory for '%s'" ),
1559
1561
options .state_dir );
1560
- write_file (autostash , "%s" , buf . buf );
1562
+ write_file (autostash , "%s" , oid_to_hex ( & oid ) );
1561
1563
printf (_ ("Created autostash: %s\n" ), buf .buf );
1562
1564
if (reset_head (& head -> object .oid , "reset --hard" ,
1563
1565
NULL , 0 , NULL , NULL ) < 0 )
0 commit comments