All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Caspar Duregger <herr.kaste@gmail.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH 3/4] rebase -i: use struct object_id when writing state
Date: Tue, 27 Oct 2020 14:02:16 +0000	[thread overview]
Message-ID: <11494a7b79cd5b6fbef51720e7111a94e7bd650e.1603807338.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.773.git.1603807337.gitgitgadget@gmail.com>

From: Phillip Wood <phillip.wood@dunelm.org.uk>

Rather than passing a string around pass the struct object_id that the
string was created from call oid_hex() when we write the file.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 builtin/rebase.c | 3 ++-
 sequencer.c      | 5 +++--
 sequencer.h      | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index d975918de6..f94f9fe307 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -296,7 +296,8 @@ static int get_revision_ranges(struct commit *upstream, struct commit *onto,
 }
 
 static int init_basic_state(struct replay_opts *opts, const char *head_name,
-			    struct commit *onto, const char *orig_head)
+			    struct commit *onto,
+			    const struct object_id *orig_head)
 {
 	FILE *interactive;
 
diff --git a/sequencer.c b/sequencer.c
index f79c3df861..2037f0ba66 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2692,7 +2692,7 @@ static void write_strategy_opts(struct replay_opts *opts)
 }
 
 int write_basic_state(struct replay_opts *opts, const char *head_name,
-		      struct commit *onto, const char *orig_head)
+		      struct commit *onto, const struct object_id *orig_head)
 {
 	if (head_name)
 		write_file(rebase_path_head_name(), "%s\n", head_name);
@@ -2700,7 +2700,8 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,
 		write_file(rebase_path_onto(), "%s\n",
 			   oid_to_hex(&onto->object.oid));
 	if (orig_head)
-		write_file(rebase_path_orig_head(), "%s\n", orig_head);
+		write_file(rebase_path_orig_head(), "%s\n",
+			   oid_to_hex(orig_head));
 
 	if (opts->quiet)
 		write_file(rebase_path_quiet(), "%s", "");
diff --git a/sequencer.h b/sequencer.h
index ea56825488..cf201f2406 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -227,7 +227,7 @@ int read_author_script(const char *path, char **name, char **email, char **date,
 		       int allow_missing);
 void parse_strategy_opts(struct replay_opts *opts, char *raw_opts);
 int write_basic_state(struct replay_opts *opts, const char *head_name,
-		      struct commit *onto, const char *orig_head);
+		      struct commit *onto, const struct object_id *orig_head);
 void sequencer_post_commit_cleanup(struct repository *r, int verbose);
 int sequencer_get_last_command(struct repository* r,
 			       enum replay_action *action);
-- 
gitgitgadget


  parent reply	other threads:[~2020-10-27 18:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 14:02 [PATCH 0/4] rebase -i: fix ORIG_HEAD handling Phillip Wood via GitGitGadget
2020-10-27 14:02 ` [PATCH 1/4] rebase -i: stop overwriting ORIG_HEAD buffer Phillip Wood via GitGitGadget
2020-10-27 21:10   ` Junio C Hamano
2020-10-31 10:55     ` Phillip Wood
2020-11-02 19:40     ` herr.kaste
2020-11-03  0:21       ` Junio C Hamano
2020-11-03 11:02         ` herr.kaste
2020-10-27 14:02 ` [PATCH 2/4] rebase -i: use struct object_id rather than looking up commit Phillip Wood via GitGitGadget
2020-10-27 14:02 ` Phillip Wood via GitGitGadget [this message]
2020-10-27 14:02 ` [PATCH 4/4] rebase -i: simplify get_revision_ranges() Phillip Wood via GitGitGadget
2020-11-04 15:29 ` [PATCH v2 0/4] rebase -i: fix ORIG_HEAD handling Phillip Wood via GitGitGadget
2020-11-04 15:29   ` [PATCH v2 1/4] rebase -i: stop overwriting ORIG_HEAD buffer Phillip Wood via GitGitGadget
2020-11-04 15:29   ` [PATCH v2 2/4] rebase -i: use struct object_id rather than looking up commit Phillip Wood via GitGitGadget
2020-11-04 15:29   ` [PATCH v2 3/4] rebase -i: use struct object_id when writing state Phillip Wood via GitGitGadget
2020-11-04 15:29   ` [PATCH v2 4/4] rebase -i: simplify get_revision_ranges() Phillip Wood via GitGitGadget

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=11494a7b79cd5b6fbef51720e7111a94e7bd650e.1603807338.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=herr.kaste@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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.