]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/stash.c
Merge branch 'gc/branch-recurse-submodules-fix'
[thirdparty/git.git] / builtin / stash.c
index 3e2f478b7610a0dfdc2645aebd73dcc61f275d36..0c7b6a95882d9405e3cdf4a8d3d2d251dc0588db 100644 (file)
@@ -16,7 +16,6 @@
 #include "log-tree.h"
 #include "diffcore.h"
 #include "exec-cmd.h"
-#include "entry.h"
 #include "reflog.h"
 
 #define INCLUDE_ALL_FILES 2
@@ -311,7 +310,7 @@ static int reset_head(void)
         * API for resetting.
         */
        cp.git_cmd = 1;
-       strvec_push(&cp.args, "reset");
+       strvec_pushl(&cp.args, "reset", "--quiet", "--refresh", NULL);
 
        return run_command(&cp);
 }
@@ -1317,7 +1316,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
 
        branch_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
        if (flags & REF_ISSYMREF)
-               branch_name = strrchr(branch_ref, '/') + 1;
+               skip_prefix(branch_ref, "refs/heads/", &branch_name);
        head_short_sha1 = find_unique_abbrev(&head_commit->object.oid,
                                             DEFAULT_ABBREV);
        strbuf_addf(&msg, "%s: %s ", branch_name, head_short_sha1);
@@ -1623,7 +1622,8 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
                        struct child_process cp = CHILD_PROCESS_INIT;
 
                        cp.git_cmd = 1;
-                       strvec_pushl(&cp.args, "reset", "-q", "--", NULL);
+                       strvec_pushl(&cp.args, "reset", "-q", "--refresh", "--",
+                                    NULL);
                        add_pathspecs(&cp.args, ps);
                        if (run_command(&cp)) {
                                ret = -1;