]> git.ipfire.org Git - thirdparty/git.git/commitdiff
create_autostash(): remove unneeded parameter
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 26 Jan 2022 13:05:44 +0000 (13:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jan 2022 20:08:53 +0000 (12:08 -0800)
The default_reflog parameter of create_autostash() is passed to
reset_head(). However as creating a stash does not involve updating
any refs the parameter is not used by reset_head(). Removing the
parameter from create_autostash() simplifies the callers.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c
builtin/rebase.c
sequencer.c
sequencer.h

index ea3112e0c0b3acc9f4439430fb19e596a9fc9093..cb0e4e22258ff671302b0f7bf8f2e1f93ad70331 100644 (file)
@@ -1565,8 +1565,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
                if (autostash)
                        create_autostash(the_repository,
-                                        git_path_merge_autostash(the_repository),
-                                        "merge");
+                                        git_path_merge_autostash(the_repository));
                if (checkout_fast_forward(the_repository,
                                          &head_commit->object.oid,
                                          &commit->object.oid,
@@ -1637,8 +1636,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
        if (autostash)
                create_autostash(the_repository,
-                                git_path_merge_autostash(the_repository),
-                                "merge");
+                                git_path_merge_autostash(the_repository));
 
        /* We are going to make a new commit. */
        git_committer_info(IDENT_STRICT);
index 82be965915c4ba05bbbd7afb0963384af6cbd21a..3d78b5c8bef94f391f0d602e15879c72c98a430e 100644 (file)
@@ -1657,10 +1657,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
        if (repo_read_index(the_repository) < 0)
                die(_("could not read index"));
 
-       if (options.autostash) {
-               create_autostash(the_repository, state_dir_path("autostash", &options),
-                                DEFAULT_REFLOG_ACTION);
-       }
+       if (options.autostash)
+               create_autostash(the_repository,
+                                state_dir_path("autostash", &options));
+
 
        if (require_clean_work_tree(the_repository, "rebase",
                                    _("Please commit or stash them."), 1, 1)) {
index e18329a399f50f7d0644e7c464296eb3d946d6c5..119564f4353a9b9de51d319fce02ecc2df20fe91 100644 (file)
@@ -4100,8 +4100,7 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
        return -1;
 }
 
-void create_autostash(struct repository *r, const char *path,
-                     const char *default_reflog_action)
+void create_autostash(struct repository *r, const char *path)
 {
        struct strbuf buf = STRBUF_INIT;
        struct lock_file lock_file = LOCK_INIT;
@@ -4138,7 +4137,7 @@ void create_autostash(struct repository *r, const char *path,
                write_file(path, "%s", oid_to_hex(&oid));
                printf(_("Created autostash: %s\n"), buf.buf);
                if (reset_head(r, NULL, NULL, RESET_HEAD_HARD, NULL, NULL,
-                              default_reflog_action) < 0)
+                              NULL) < 0)
                        die(_("could not reset --hard"));
 
                if (discard_index(r->index) < 0 ||
index 05a7d2ba6b392c37b106bea6af5f0e1912dffd9e..da64473636b4bcf991925daf90647503097e4c05 100644 (file)
@@ -197,8 +197,7 @@ void commit_post_rewrite(struct repository *r,
                         const struct commit *current_head,
                         const struct object_id *new_head);
 
-void create_autostash(struct repository *r, const char *path,
-                     const char *default_reflog_action);
+void create_autostash(struct repository *r, const char *path);
 int save_autostash(const char *path);
 int apply_autostash(const char *path);
 int apply_autostash_oid(const char *stash_oid);