Skip to content

Commit b7de153

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1526d0f commit b7de153

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

builtin/merge.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,8 +1565,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
15651565

15661566
if (autostash)
15671567
create_autostash(the_repository,
1568-
git_path_merge_autostash(the_repository),
1569-
"merge");
1568+
git_path_merge_autostash(the_repository));
15701569
if (checkout_fast_forward(the_repository,
15711570
&head_commit->object.oid,
15721571
&commit->object.oid,
@@ -1637,8 +1636,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
16371636

16381637
if (autostash)
16391638
create_autostash(the_repository,
1640-
git_path_merge_autostash(the_repository),
1641-
"merge");
1639+
git_path_merge_autostash(the_repository));
16421640

16431641
/* We are going to make a new commit. */
16441642
git_committer_info(IDENT_STRICT);

builtin/rebase.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,10 +1657,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
16571657
if (repo_read_index(the_repository) < 0)
16581658
die(_("could not read index"));
16591659

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+
16641664

16651665
if (require_clean_work_tree(the_repository, "rebase",
16661666
_("Please commit or stash them."), 1, 1)) {

sequencer.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,8 +4100,7 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
41004100
return -1;
41014101
}
41024102

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)
41054104
{
41064105
struct strbuf buf = STRBUF_INIT;
41074106
struct lock_file lock_file = LOCK_INIT;
@@ -4138,7 +4137,7 @@ void create_autostash(struct repository *r, const char *path,
41384137
write_file(path, "%s", oid_to_hex(&oid));
41394138
printf(_("Created autostash: %s\n"), buf.buf);
41404139
if (reset_head(r, NULL, NULL, RESET_HEAD_HARD, NULL, NULL,
4141-
default_reflog_action) < 0)
4140+
NULL) < 0)
41424141
die(_("could not reset --hard"));
41434142

41444143
if (discard_index(r->index) < 0 ||

sequencer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ void commit_post_rewrite(struct repository *r,
197197
const struct commit *current_head,
198198
const struct object_id *new_head);
199199

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);
202201
int save_autostash(const char *path);
203202
int apply_autostash(const char *path);
204203
int apply_autostash_oid(const char *stash_oid);

0 commit comments

Comments
 (0)