Skip to content

Commit 6d7b674

Browse files
committed
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]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4e49779 commit 6d7b674

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
@@ -1376,7 +1376,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
13761376
if (safe_create_leading_directories_const(autostash))
13771377
die(_("Could not create directory for '%s'"),
13781378
options.state_dir);
1379-
write_file(autostash, "%s", buf.buf);
1379+
write_file(autostash, "%s", oid_to_hex(&oid));
13801380
printf(_("Created autostash: %s\n"), buf.buf);
13811381
if (reset_head(&head->object.oid, "reset --hard",
13821382
NULL, 0, NULL, NULL) < 0)

0 commit comments

Comments
 (0)