@@ -99,7 +99,6 @@ static struct strbuf stash_index_path = STRBUF_INIT;
99
99
* i_tree is set to the index tree
100
100
* u_tree is set to the untracked files tree
101
101
*/
102
-
103
102
struct stash_info {
104
103
struct object_id w_commit ;
105
104
struct object_id b_commit ;
@@ -320,11 +319,7 @@ static void add_diff_to_buf(struct diff_queue_struct *q,
320
319
for (i = 0 ; i < q -> nr ; i ++ ) {
321
320
strbuf_addstr (data , q -> queue [i ]-> one -> path );
322
321
323
- /*
324
- * The reason we add "0" at the end of this strbuf
325
- * is because we will pass the output further to
326
- * "git update-index -z ...".
327
- */
322
+ /* NUL-terminate: will be fed to update-index -z */
328
323
strbuf_addch (data , '\0' );
329
324
}
330
325
}
@@ -579,9 +574,9 @@ static int do_drop_stash(const char *prefix, struct stash_info *info, int quiet)
579
574
static void assert_stash_ref (struct stash_info * info )
580
575
{
581
576
if (!info -> is_stash_ref ) {
582
- free_stash_info (info );
583
577
error (_ ("'%s' is not a stash reference" ), info -> revision .buf );
584
- exit (128 );
578
+ free_stash_info (info );
579
+ exit (1 );
585
580
}
586
581
}
587
582
@@ -837,7 +832,7 @@ static void add_pathspecs(struct argv_array *args,
837
832
int i ;
838
833
839
834
for (i = 0 ; i < ps .nr ; i ++ )
840
- argv_array_push (args , ps .items [i ].match );
835
+ argv_array_push (args , ps .items [i ].original );
841
836
}
842
837
843
838
/*
@@ -869,7 +864,7 @@ static int get_untracked_files(struct pathspec ps, int include_untracked,
869
864
found ++ ;
870
865
strbuf_addstr (untracked_files , ent -> name );
871
866
/* NUL-terminate: will be fed to update-index -z */
872
- strbuf_addch (untracked_files , 0 );
867
+ strbuf_addch (untracked_files , '\0' );
873
868
}
874
869
free (ent );
875
870
}
@@ -888,7 +883,6 @@ static int get_untracked_files(struct pathspec ps, int include_untracked,
888
883
* = 0 if there are no changes.
889
884
* > 0 if there are changes.
890
885
*/
891
-
892
886
static int check_changes_tracked_files (struct pathspec ps )
893
887
{
894
888
int result ;
@@ -928,7 +922,6 @@ static int check_changes_tracked_files(struct pathspec ps)
928
922
* The function will fill `untracked_files` with the names of untracked files
929
923
* It will return 1 if there were any changes and 0 if there were not.
930
924
*/
931
-
932
925
static int check_changes (struct pathspec ps , int include_untracked ,
933
926
struct strbuf * untracked_files )
934
927
{
@@ -1238,7 +1231,9 @@ static int create_stash(int argc, const char **argv, const char *prefix)
1238
1231
if (!check_changes_tracked_files (ps ))
1239
1232
return 0 ;
1240
1233
1241
- if (!(ret = do_create_stash (ps , & stash_msg_buf , 0 , 0 , & info , NULL , 0 )))
1234
+ ret = do_create_stash (ps , & stash_msg_buf , 0 , 0 , & info ,
1235
+ NULL , 0 );
1236
+ if (!ret )
1242
1237
printf_ln ("%s" , oid_to_hex (& info .w_commit ));
1243
1238
1244
1239
strbuf_release (& stash_msg_buf );
@@ -1429,8 +1424,6 @@ static int do_push_stash(struct pathspec ps, const char *stash_msg, int quiet,
1429
1424
if (keep_index < 1 ) {
1430
1425
struct child_process cp = CHILD_PROCESS_INIT ;
1431
1426
1432
- discard_cache ();
1433
-
1434
1427
cp .git_cmd = 1 ;
1435
1428
argv_array_pushl (& cp .args , "reset" , "-q" , "--" , NULL );
1436
1429
add_pathspecs (& cp .args , ps );
@@ -1475,7 +1468,8 @@ static int push_stash(int argc, const char **argv, const char *prefix)
1475
1468
git_stash_push_usage ,
1476
1469
0 );
1477
1470
1478
- parse_pathspec (& ps , 0 , PATHSPEC_PREFER_FULL , prefix , argv );
1471
+ parse_pathspec (& ps , 0 , PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN ,
1472
+ prefix , argv );
1479
1473
return do_push_stash (ps , stash_msg , quiet , keep_index , patch_mode ,
1480
1474
include_untracked );
1481
1475
}
0 commit comments