Skip to content

Commit 12aeb00

Browse files
dschogitster
authored andcommitted
rebase (autostash): store the full OID in <state-dir>/autostash
It was reported by Gábor Szeder and analyzed by Alban Gruin that the built-in rebase stores only abbreviated stash hashes in the `autostash` file. This is problematic e.g. in t5520-pull.sh, where the abbreviated hash is so short that it sometimes consists only of digits, which are subsequently mistaken ("DWIMmed") for numbers by `git stash apply`. Let's align the behavior of the built-in rebase with the scripted rebase and store the full stash hash instead. That makes it a lot less likely that it consists only of digits. Signed-off-by: Johannes Schindelin <[email protected]> Reviewed-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 71064e6 commit 12aeb00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/rebase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
13741374
if (safe_create_leading_directories_const(autostash))
13751375
die(_("Could not create directory for '%s'"),
13761376
options.state_dir);
1377-
write_file(autostash, "%s", buf.buf);
1377+
write_file(autostash, "%s", oid_to_hex(&oid));
13781378
printf(_("Created autostash: %s\n"), buf.buf);
13791379
if (reset_head(&head->object.oid, "reset --hard",
13801380
NULL, 0, NULL, NULL) < 0)

0 commit comments

Comments
 (0)