All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: SZEDER Gabor <szeder.dev@gmail.com>,
	Alban Gruin <alban.gruin@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v2 2/3] rebase (autostash): store the full OID in <state-dir>/autostash
Date: Mon, 22 Oct 2018 15:15:03 -0700 (PDT)	[thread overview]
Message-ID: <86107a6d0a044e3338e6f70313917066d200a1f4.1540246499.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.52.v2.git.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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 <johannes.schindelin@gmx.de>
---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index d21504d9f..418624837 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1375,7 +1375,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			if (safe_create_leading_directories_const(autostash))
 				die(_("Could not create directory for '%s'"),
 				    options.state_dir);
-			write_file(autostash, "%s", buf.buf);
+			write_file(autostash, "%s", oid_to_hex(&oid));
 			printf(_("Created autostash: %s\n"), buf.buf);
 			if (reset_head(&head->object.oid, "reset --hard",
 				       NULL, 0, NULL, NULL) < 0)
-- 
gitgitgadget


  parent reply	other threads:[~2018-10-22 22:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <pull.52.git.gitgitgadget@gmail.com>
2018-10-22 22:15 ` [PATCH v2 0/3] Fix rebase autostash Johannes Schindelin via GitGitGadget
2018-10-22 22:15   ` [PATCH v2 1/3] rebase (autostash): avoid duplicate call to state_dir_path() Johannes Schindelin via GitGitGadget
2018-10-22 22:15   ` Johannes Schindelin via GitGitGadget [this message]
2018-10-22 22:15   ` [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash Johannes Schindelin via GitGitGadget
2018-10-22 22:25     ` Eric Sunshine
2018-10-22 22:32     ` SZEDER Gábor
2018-10-23  4:13       ` Junio C Hamano
2018-10-23  9:34         ` Johannes Schindelin
2018-10-23 17:07     ` Alban Gruin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86107a6d0a044e3338e6f70313917066d200a1f4.1540246499.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=alban.gruin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.