}
if (autostash)
- create_autostash_ref(the_repository, "MERGE_AUTOSTASH");
+ create_autostash_ref(the_repository, "MERGE_AUTOSTASH",
+ NULL, false);
if (checkout_fast_forward(the_repository,
&head_commit->object.oid,
&commit->object.oid,
die_ff_impossible();
if (autostash)
- create_autostash_ref(the_repository, "MERGE_AUTOSTASH");
+ create_autostash_ref(the_repository, "MERGE_AUTOSTASH",
+ NULL, false);
/* We are going to make a new commit. */
git_committer_info(IDENT_STRICT);
static void create_autostash_internal(struct repository *r,
const char *path,
- const char *refname)
+ const char *refname,
+ const char *message,
+ bool silent)
{
struct strbuf buf = STRBUF_INIT;
struct lock_file lock_file = LOCK_INIT;
struct object_id oid;
strvec_pushl(&stash.args,
- "stash", "create", "autostash", NULL);
+ "stash", "create",
+ message ? message : "autostash", NULL);
stash.git_cmd = 1;
stash.no_stdin = 1;
strbuf_reset(&buf);
&oid, null_oid(the_hash_algo), 0, UPDATE_REFS_DIE_ON_ERR);
}
- printf(_("Created autostash: %s\n"), buf.buf);
+ if (!silent)
+ printf(_("Created autostash: %s\n"), buf.buf);
if (reset_head(r, &ropts) < 0)
die(_("could not reset --hard"));
discard_index(r->index);
void create_autostash(struct repository *r, const char *path)
{
- create_autostash_internal(r, path, NULL);
+ create_autostash_internal(r, path, NULL, NULL, false);
}
-void create_autostash_ref(struct repository *r, const char *refname)
+void create_autostash_ref(struct repository *r, const char *refname,
+ const char *message, bool silent)
{
- create_autostash_internal(r, NULL, refname);
+ create_autostash_internal(r, NULL, refname, message, silent);
}
static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
const struct object_id *new_head);
void create_autostash(struct repository *r, const char *path);
-void create_autostash_ref(struct repository *r, const char *refname);
+void create_autostash_ref(struct repository *r, const char *refname,
+ const char *message, bool silent);
int save_autostash(const char *path);
int save_autostash_ref(struct repository *r, const char *refname);
int apply_autostash(const char *path);