create_autostash(): remove unneeded parameter
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>
Phillip Wood committed
Jan 26, 2022 at 13:05 UTC
b7de153bd9332a992baa6f937372f0b1833f61e5
4 files changed
+9
-13
builtin/merge.c
+2
-4
@@ -1565,8 +1565,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1565
1566
if (autostash)
1567
create_autostash(the_repository,
1568
- git_path_merge_autostash(the_repository),
1569
- "merge");
1568
+ git_path_merge_autostash(the_repository));
1569
if (checkout_fast_forward(the_repository,
1570
&head_commit->object.oid,
1571
&commit->object.oid,
@@ -1637,8 +1636,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1636
1637
if (autostash)
1638
create_autostash(the_repository,
1640
- git_path_merge_autostash(the_repository),
1641
- "merge");
1639
+ git_path_merge_autostash(the_repository));
1640
1641
/* We are going to make a new commit. */
1642
git_committer_info(IDENT_STRICT);
builtin/rebase.c
+4
-4
@@ -1657,10 +1657,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1657
if (repo_read_index(the_repository) < 0)
1658
die(_("could not read index"));
1659
1660
- if (options.autostash) {
1661
- create_autostash(the_repository, state_dir_path("autostash", &options),
1662
- DEFAULT_REFLOG_ACTION);
1663
- }
1660
+ if (options.autostash)
1661
+ create_autostash(the_repository,
1662
+ state_dir_path("autostash", &options));
1663
+
1664
1665
if (require_clean_work_tree(the_repository, "rebase",
1666
_("Please commit or stash them."), 1, 1)) {
sequencer.c
+2
-3
@@ -4100,8 +4100,7 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
4100
return -1;
4101
}
4102
4103
-void create_autostash(struct repository *r, const char *path,
4104
- const char *default_reflog_action)
4103
+void create_autostash(struct repository *r, const char *path)
4104
{
4105
struct strbuf buf = STRBUF_INIT;
4106
struct lock_file lock_file = LOCK_INIT;
@@ -4138,7 +4137,7 @@ void create_autostash(struct repository *r, const char *path,
4137
write_file(path, "%s", oid_to_hex(&oid));
4138
printf(_("Created autostash: %s\n"), buf.buf);
4139
if (reset_head(r, NULL, NULL, RESET_HEAD_HARD, NULL, NULL,
4141
- default_reflog_action) < 0)
4140
+ NULL) < 0)
4141
die(_("could not reset --hard"));
4142
4143
if (discard_index(r->index) < 0 ||
sequencer.h
+1
-2
@@ -197,8 +197,7 @@ void commit_post_rewrite(struct repository *r,
197
const struct commit *current_head,
198
const struct object_id *new_head);
199
200
-void create_autostash(struct repository *r, const char *path,
201
- const char *default_reflog_action);
200
+void create_autostash(struct repository *r, const char *path);
201
int save_autostash(const char *path);
202
int apply_autostash(const char *path);
203
int apply_autostash_oid(const char *stash_oid);