git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Use refs API for handling sundry pseudorefs
@ 2020-08-18 12:17 Han-Wen Nienhuys via GitGitGadget
  2020-08-18 12:17 ` [PATCH 1/3] Make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-18 12:17 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys

This series changes the handling of CHERRY_PICK_HEAD and REVERT_HEAD to use
the refs API, as a preliminary refactor for reftable. 

No functional changes.

Han-Wen Nienhuys (3):
  Make refs_ref_exists public
  Treat CHERRY_PICK_HEAD as a pseudo ref
  Treat REVERT_HEAD as a pseudo ref

 builtin/commit.c | 34 ++++++++++++++++-------------
 builtin/merge.c  |  2 +-
 path.c           |  2 --
 path.h           |  9 ++++----
 refs.c           |  2 +-
 refs.h           |  2 ++
 sequencer.c      | 56 +++++++++++++++++++++++++++++-------------------
 wt-status.c      |  6 +++---
 8 files changed, 64 insertions(+), 49 deletions(-)


base-commit: 2befe97201e1f3175cce557866c5822793624b5a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-706%2Fhanwen%2Fstray-pseudorefs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-706/hanwen/stray-pseudorefs-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/706
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 1/3] Make refs_ref_exists public
  2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 12:17 ` Han-Wen Nienhuys via GitGitGadget
  2020-08-18 20:39   ` Junio C Hamano
  2020-08-18 12:17 ` [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-18 12:17 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 refs.c | 2 +-
 refs.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/refs.c b/refs.c
index cf91711968..d46080f4b6 100644
--- a/refs.c
+++ b/refs.c
@@ -313,7 +313,7 @@ int read_ref(const char *refname, struct object_id *oid)
 	return read_ref_full(refname, RESOLVE_REF_READING, oid, NULL);
 }
 
-static int refs_ref_exists(struct ref_store *refs, const char *refname)
+int refs_ref_exists(struct ref_store *refs, const char *refname)
 {
 	return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
 }
diff --git a/refs.h b/refs.h
index 29e28124cd..04bd25019f 100644
--- a/refs.h
+++ b/refs.h
@@ -105,6 +105,8 @@ int refs_verify_refname_available(struct ref_store *refs,
 				  const struct string_list *skip,
 				  struct strbuf *err);
 
+int refs_ref_exists(struct ref_store *refs, const char *refname);
+
 int ref_exists(const char *refname);
 
 int should_autocreate_reflog(const char *refname);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  2020-08-18 12:17 ` [PATCH 1/3] Make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 12:17 ` Han-Wen Nienhuys via GitGitGadget
  2020-08-18 21:05   ` Junio C Hamano
  2020-08-18 12:17 ` [PATCH 3/3] Treat REVERT_HEAD " Han-Wen Nienhuys via GitGitGadget
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-18 12:17 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Check for existence and delete CHERRY_PICK_HEAD through ref functions.
This will help cherry-pick work with alternate ref storage backends.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/commit.c | 34 +++++++++++++++++++---------------
 builtin/merge.c  |  2 +-
 path.c           |  1 -
 path.h           |  7 ++++---
 sequencer.c      | 42 ++++++++++++++++++++++++++----------------
 wt-status.c      |  4 ++--
 6 files changed, 52 insertions(+), 38 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 69ac78d5e5..619b71bcb4 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -847,21 +847,25 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
 				!merge_contains_scissors)
 				wt_status_add_cut_line(s->fp);
-			status_printf_ln(s, GIT_COLOR_NORMAL,
-			    whence == FROM_MERGE
-				? _("\n"
-					"It looks like you may be committing a merge.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n")
-				: _("\n"
-					"It looks like you may be committing a cherry-pick.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n"),
-				whence == FROM_MERGE ?
-					git_path_merge_head(the_repository) :
-					git_path_cherry_pick_head(the_repository));
+			if (whence == FROM_MERGE)
+				status_printf_ln(
+					s, GIT_COLOR_NORMAL,
+
+					_("\n"
+					  "It looks like you may be committing a merge.\n"
+					  "If this is not correct, please remove the file\n"
+					  "	%s\n"
+					  "and try again.\n"),
+					git_path_merge_head(the_repository));
+			else
+				status_printf_ln(
+					s, GIT_COLOR_NORMAL,
+
+					_("\n"
+					  "It looks like you may be committing a cherry-pick.\n"
+					  "If this is not correct, please run\n"
+					  "	git cherry-pick --abort\n"
+					  "and try again.\n"));
 		}
 
 		fprintf(s->fp, "\n");
diff --git a/builtin/merge.c b/builtin/merge.c
index 74829a838e..b9a89ba858 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1348,7 +1348,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		else
 			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
 	}
-	if (file_exists(git_path_cherry_pick_head(the_repository))) {
+	if (ref_exists("CHERRY_PICK_HEAD")) {
 		if (advice_resolve_conflict)
 			die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
 			    "Please, commit your changes before you merge."));
diff --git a/path.c b/path.c
index 8b2c753191..783cc2ae81 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(cherry_pick_head, "CHERRY_PICK_HEAD")
 REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
diff --git a/path.h b/path.h
index 1f1bf8f87a..8941c018a9 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *cherry_pick_head;
 	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
@@ -182,9 +181,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+#define PATH_CACHE_INIT                                              \
+	{                                                            \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+	}
 
-const char *git_path_cherry_pick_head(struct repository *r);
 const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index cc3f8fa88e..09e2ff659e 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -381,7 +381,8 @@ static void print_advice(struct repository *r, int show_hint,
 		 * (typically rebase --interactive) wants to take care
 		 * of the commit itself so remove CHERRY_PICK_HEAD
 		 */
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		return;
 	}
 
@@ -1455,7 +1456,8 @@ static int do_commit(struct repository *r,
 				    author, opts, flags, &oid);
 		strbuf_release(&sb);
 		if (!res) {
-			unlink(git_path_cherry_pick_head(r));
+			refs_delete_ref(get_main_ref_store(r), "",
+					"CHERRY_PICK_HEAD", NULL, 0);
 			unlink(git_path_merge_msg(r));
 			if (!is_rebase_i(opts))
 				print_commit_summary(r, NULL, &oid,
@@ -1966,7 +1968,8 @@ static int do_pick_commit(struct repository *r,
 		flags |= ALLOW_EMPTY;
 	} else if (allow == 2) {
 		drop_commit = 1;
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		unlink(git_path_merge_msg(r));
 		fprintf(stderr,
 			_("dropping %s %s -- patch contents already upstream\n"),
@@ -2305,8 +2308,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 	struct replay_opts opts = REPLAY_OPTS_INIT;
 	int need_cleanup = 0;
 
-	if (file_exists(git_path_cherry_pick_head(r))) {
-		if (!unlink(git_path_cherry_pick_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "",
+				     "CHERRY_PICK_HEAD", NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a cherry picking in progress"));
 		opts.action = REPLAY_PICK;
 		need_cleanup = 1;
@@ -2671,8 +2676,9 @@ static int create_seq_dir(struct repository *r)
 	enum replay_action action;
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
-	unsigned int advise_skip = file_exists(git_path_revert_head(r)) ||
-				file_exists(git_path_cherry_pick_head(r));
+	unsigned int advise_skip =
+		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
 		switch (action) {
@@ -2771,7 +2777,7 @@ static int rollback_single_pick(struct repository *r)
 {
 	struct object_id head_oid;
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
@@ -2874,7 +2880,8 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 		}
 		break;
 	case REPLAY_PICK:
-		if (!file_exists(git_path_cherry_pick_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r),
+				     "CHERRY_PICK_HEAD")) {
 			if (action != REPLAY_PICK)
 				return error(_("no cherry-pick in progress"));
 			if (!rollback_is_safe())
@@ -3569,7 +3576,8 @@ static int do_merge(struct repository *r,
 				    oid_to_hex(&j->item->object.oid));
 
 		strbuf_release(&ref_name);
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		rollback_lock_file(&lock);
 
 		rollback_lock_file(&lock);
@@ -4201,7 +4209,7 @@ static int continue_single_pick(struct repository *r)
 {
 	const char *argv[] = { "commit", NULL };
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
@@ -4318,9 +4326,10 @@ static int commit_staged_changes(struct repository *r,
 	}
 
 	if (is_clean) {
-		const char *cherry_pick_head = git_path_cherry_pick_head(r);
-
-		if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") &&
+		    refs_delete_ref(get_main_ref_store(r), "",
+				    "CHERRY_PICK_HEAD", NULL, 0))
 			return error(_("could not remove CHERRY_PICK_HEAD"));
 		if (!final_fixup)
 			return 0;
@@ -4379,7 +4388,8 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 
 	if (!is_rebase_i(opts)) {
 		/* Verify that the conflict has been resolved */
-		if (file_exists(git_path_cherry_pick_head(r)) ||
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") ||
 		    file_exists(git_path_revert_head(r))) {
 			res = continue_single_pick(r);
 			if (res)
@@ -5442,7 +5452,7 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
 
 int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
 {
-	if (file_exists(git_path_cherry_pick_head(r))) {
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
 		struct object_id cherry_pick_head, rebase_head;
 
 		if (file_exists(git_path_seq_dir()))
diff --git a/wt-status.c b/wt-status.c
index d75399085d..c6abf2f3ca 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1672,8 +1672,8 @@ void wt_status_get_state(struct repository *r,
 		state->merge_in_progress = 1;
 	} else if (wt_status_check_rebase(NULL, state)) {
 		;		/* all set */
-	} else if (!stat(git_path_cherry_pick_head(r), &st) &&
-			!get_oid("CHERRY_PICK_HEAD", &oid)) {
+	} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
+		   !get_oid("CHERRY_PICK_HEAD", &oid)) {
 		state->cherry_pick_in_progress = 1;
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/3] Treat REVERT_HEAD as a pseudo ref
  2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  2020-08-18 12:17 ` [PATCH 1/3] Make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
  2020-08-18 12:17 ` [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 12:17 ` Han-Wen Nienhuys via GitGitGadget
  2020-08-18 21:06   ` Junio C Hamano
  2020-08-18 20:33 ` [PATCH 0/3] Use refs API for handling sundry pseudorefs Junio C Hamano
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
  4 siblings, 1 reply; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-18 12:17 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 path.c      |  1 -
 path.h      |  8 +++-----
 sequencer.c | 16 +++++++++-------
 wt-status.c |  2 +-
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/path.c b/path.c
index 783cc2ae81..7b385e5eb2 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
 REPO_GIT_PATH_FUNC(merge_rr, "MERGE_RR")
diff --git a/path.h b/path.h
index 8941c018a9..e7e77da6aa 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
 	const char *merge_rr;
@@ -181,12 +180,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT                                              \
-	{                                                            \
-		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+#define PATH_CACHE_INIT                                        \
+	{                                                      \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
 	}
 
-const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
 const char *git_path_merge_rr(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index 09e2ff659e..d116ea69bd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2317,8 +2317,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 		need_cleanup = 1;
 	}
 
-	if (file_exists(git_path_revert_head(r))) {
-		if (!unlink(git_path_revert_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "", "REVERT_HEAD",
+				     NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a revert in progress"));
 		opts.action = REPLAY_REVERT;
 		need_cleanup = 1;
@@ -2677,7 +2679,7 @@ static int create_seq_dir(struct repository *r)
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
 	unsigned int advise_skip =
-		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") ||
 		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
@@ -2778,7 +2780,7 @@ static int rollback_single_pick(struct repository *r)
 	struct object_id head_oid;
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
 		return error(_("cannot resolve HEAD"));
@@ -2872,7 +2874,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 	 */
 	switch (opts->action) {
 	case REPLAY_REVERT:
-		if (!file_exists(git_path_revert_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			if (action != REPLAY_REVERT)
 				return error(_("no revert in progress"));
 			if (!rollback_is_safe())
@@ -4210,7 +4212,7 @@ static int continue_single_pick(struct repository *r)
 	const char *argv[] = { "commit", NULL };
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
 }
@@ -4390,7 +4392,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 		/* Verify that the conflict has been resolved */
 		if (refs_ref_exists(get_main_ref_store(r),
 				    "CHERRY_PICK_HEAD") ||
-		    file_exists(git_path_revert_head(r))) {
+		    refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			res = continue_single_pick(r);
 			if (res)
 				goto release_todo_list;
diff --git a/wt-status.c b/wt-status.c
index c6abf2f3ca..ecbe570e28 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1678,7 +1678,7 @@ void wt_status_get_state(struct repository *r,
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
 	wt_status_check_bisect(NULL, state);
-	if (!stat(git_path_revert_head(r), &st) &&
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
 	    !get_oid("REVERT_HEAD", &oid)) {
 		state->revert_in_progress = 1;
 		oidcpy(&state->revert_head_oid, &oid);
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 0/3] Use refs API for handling sundry pseudorefs
  2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
                   ` (2 preceding siblings ...)
  2020-08-18 12:17 ` [PATCH 3/3] Treat REVERT_HEAD " Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 20:33 ` Junio C Hamano
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
  4 siblings, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2020-08-18 20:33 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> This series changes the handling of CHERRY_PICK_HEAD and REVERT_HEAD to use
> the refs API, as a preliminary refactor for reftable. 

Nice.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/3] Make refs_ref_exists public
  2020-08-18 12:17 ` [PATCH 1/3] Make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 20:39   ` Junio C Hamano
  0 siblings, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2020-08-18 20:39 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH 1/3] Make refs_ref_exists public

Documentation/SubmittingPatches[[describe-changes]]

Applies to all three patches and probably other recent topics from
you.

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  refs.c | 2 +-
>  refs.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/refs.c b/refs.c
> index cf91711968..d46080f4b6 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -313,7 +313,7 @@ int read_ref(const char *refname, struct object_id *oid)
>  	return read_ref_full(refname, RESOLVE_REF_READING, oid, NULL);
>  }
>  
> -static int refs_ref_exists(struct ref_store *refs, const char *refname)
> +int refs_ref_exists(struct ref_store *refs, const char *refname)
>  {
>  	return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
>  }
> diff --git a/refs.h b/refs.h
> index 29e28124cd..04bd25019f 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -105,6 +105,8 @@ int refs_verify_refname_available(struct ref_store *refs,
>  				  const struct string_list *skip,
>  				  struct strbuf *err);
>  
> +int refs_ref_exists(struct ref_store *refs, const char *refname);
> +
>  int ref_exists(const char *refname);
>  
>  int should_autocreate_reflog(const char *refname);

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-18 12:17 ` [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 21:05   ` Junio C Hamano
  2020-08-19 15:04     ` Han-Wen Nienhuys
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2020-08-18 21:05 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> Check for existence and delete CHERRY_PICK_HEAD through ref functions.
> This will help cherry-pick work with alternate ref storage backends.

These two sentences are true, but this patch does another thing that
is not advertised here.  It stops recommending removal of
CHERRY_PICK_HEAD from the filesystem with "rm" (or using "git
update-ref -d" for that matter) as a way to avoid recording the
current commit as a cherry-pick.

The intent of the warning message touched by this patch, I think, is
that there is CHERRY_PICK_HEAD, but that might be a leftover one
that does not have to do anything to do with the commit the user is
making, and continuing blindly may record the commit incorrectly
(perhaps 'cherry-picked-from' trailer is added incorrectly?
existing notes data would be copied to the newly created commit?).

To recover from the situation, the user would want to abort the
commit while keeping the changes made to the working tree and to the
index to avoid the result recorded as a cherry-pick of an irrelevant
commit, get rid of CHERRY_PICK_HEAD and then attempt the "git
commit" again.

Does "git cherry-pick --abort" only remove CHERRY_PICK_HEAD without
doing any other damage to the working tree files and to the index?

> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  builtin/commit.c | 34 +++++++++++++++++++---------------
>  builtin/merge.c  |  2 +-
>  path.c           |  1 -
>  path.h           |  7 ++++---
>  sequencer.c      | 42 ++++++++++++++++++++++++++----------------
>  wt-status.c      |  4 ++--
>  6 files changed, 52 insertions(+), 38 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 69ac78d5e5..619b71bcb4 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -847,21 +847,25 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>  			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
>  				!merge_contains_scissors)
>  				wt_status_add_cut_line(s->fp);
> -			status_printf_ln(s, GIT_COLOR_NORMAL,
> -			    whence == FROM_MERGE
> -				? _("\n"
> -					"It looks like you may be committing a merge.\n"
> -					"If this is not correct, please remove the file\n"
> -					"	%s\n"
> -					"and try again.\n")
> -				: _("\n"
> -					"It looks like you may be committing a cherry-pick.\n"
> -					"If this is not correct, please remove the file\n"
> -					"	%s\n"
> -					"and try again.\n"),
> -				whence == FROM_MERGE ?
> -					git_path_merge_head(the_repository) :
> -					git_path_cherry_pick_head(the_repository));
> +			if (whence == FROM_MERGE)
> +				status_printf_ln(
> +					s, GIT_COLOR_NORMAL,
> +
> +					_("\n"
> +					  "It looks like you may be committing a merge.\n"
> +					  "If this is not correct, please remove the file\n"
> +					  "	%s\n"
> +					  "and try again.\n"),
> +					git_path_merge_head(the_repository));
> +			else
> +				status_printf_ln(
> +					s, GIT_COLOR_NORMAL,
> +
> +					_("\n"
> +					  "It looks like you may be committing a cherry-pick.\n"
> +					  "If this is not correct, please run\n"
> +					  "	git cherry-pick --abort\n"
> +					  "and try again.\n"));
>  		}

I do not know about this change (see above).

> diff --git a/builtin/merge.c b/builtin/merge.c
> index 74829a838e..b9a89ba858 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -1348,7 +1348,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>  		else
>  			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
>  	}
> -	if (file_exists(git_path_cherry_pick_head(the_repository))) {
> +	if (ref_exists("CHERRY_PICK_HEAD")) {

This, and all the rest, look quite sensible.

> diff --git a/wt-status.c b/wt-status.c
> index d75399085d..c6abf2f3ca 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1672,8 +1672,8 @@ void wt_status_get_state(struct repository *r,
>  		state->merge_in_progress = 1;
>  	} else if (wt_status_check_rebase(NULL, state)) {
>  		;		/* all set */
> -	} else if (!stat(git_path_cherry_pick_head(r), &st) &&
> -			!get_oid("CHERRY_PICK_HEAD", &oid)) {
> +	} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
> +		   !get_oid("CHERRY_PICK_HEAD", &oid)) {
>  		state->cherry_pick_in_progress = 1;
>  		oidcpy(&state->cherry_pick_head_oid, &oid);
>  	}

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/3] Treat REVERT_HEAD as a pseudo ref
  2020-08-18 12:17 ` [PATCH 3/3] Treat REVERT_HEAD " Han-Wen Nienhuys via GitGitGadget
@ 2020-08-18 21:06   ` Junio C Hamano
  0 siblings, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2020-08-18 21:06 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---

This does what was advertised by the proposed log message in the
previous patch for REVERT_HEAD.  I see nothing questionable here.

Nice.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-18 21:05   ` Junio C Hamano
@ 2020-08-19 15:04     ` Han-Wen Nienhuys
  2020-08-19 16:14       ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Han-Wen Nienhuys @ 2020-08-19 15:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Han-Wen Nienhuys via GitGitGadget, git, Han-Wen Nienhuys

On Tue, Aug 18, 2020 at 11:05 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Han-Wen Nienhuys <hanwen@google.com>
> >
> > Check for existence and delete CHERRY_PICK_HEAD through ref functions.
> > This will help cherry-pick work with alternate ref storage backends.
>
> These two sentences are true, but this patch does another thing that
> is not advertised here.  It stops recommending removal of
> CHERRY_PICK_HEAD from the filesystem with "rm" (or using "git
> update-ref -d" for that matter) as a way to avoid recording the
> current commit as a cherry-pick.
..
> Does "git cherry-pick --abort" only remove CHERRY_PICK_HEAD without
> doing any other damage to the working tree files and to the index?

Good catch. I just added cherry-pick --abort without much thinking. I
reverted to update-ref -d which should be equivalent to what is
currently recommended.

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v2 0/4] Use refs API for handling sundry pseudorefs
  2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
                   ` (3 preceding siblings ...)
  2020-08-18 20:33 ` [PATCH 0/3] Use refs API for handling sundry pseudorefs Junio C Hamano
@ 2020-08-19 15:15 ` Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
                     ` (4 more replies)
  4 siblings, 5 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-19 15:15 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys

This series changes the handling of CHERRY_PICK_HEAD and REVERT_HEAD to use
the refs API, as a preliminary refactor for reftable. 

No functional changes.

Han-Wen Nienhuys (4):
  refs: make refs_ref_exists public
  sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  builtin/commit: suggest update-ref for pseudoref removal
  sequencer: treat REVERT_HEAD as a pseudo ref

 builtin/commit.c | 30 +++++++++++++-------------
 builtin/merge.c  |  2 +-
 path.c           |  2 --
 path.h           |  9 ++++----
 refs.c           |  2 +-
 refs.h           |  2 ++
 sequencer.c      | 56 +++++++++++++++++++++++++++++-------------------
 wt-status.c      |  6 +++---
 8 files changed, 60 insertions(+), 49 deletions(-)


base-commit: 2befe97201e1f3175cce557866c5822793624b5a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-706%2Fhanwen%2Fstray-pseudorefs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-706/hanwen/stray-pseudorefs-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/706

Range-diff vs v1:

 1:  5e29fa74dc ! 1:  a8467a0d66 Make refs_ref_exists public
     @@ Metadata
      Author: Han-Wen Nienhuys <hanwen@google.com>
      
       ## Commit message ##
     -    Make refs_ref_exists public
     +    refs: make refs_ref_exists public
     +
     +    This will be necessary to replace file existence checks for pseudorefs.
      
          Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
      
 2:  06a8e8cbd1 ! 2:  2797e98446 Treat CHERRY_PICK_HEAD as a pseudo ref
     @@ Metadata
      Author: Han-Wen Nienhuys <hanwen@google.com>
      
       ## Commit message ##
     -    Treat CHERRY_PICK_HEAD as a pseudo ref
     +    sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
      
          Check for existence and delete CHERRY_PICK_HEAD through ref functions.
          This will help cherry-pick work with alternate ref storage backends.
      
          Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
      
     - ## builtin/commit.c ##
     -@@ builtin/commit.c: static int prepare_to_commit(const char *index_file, const char *prefix,
     - 			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
     - 				!merge_contains_scissors)
     - 				wt_status_add_cut_line(s->fp);
     --			status_printf_ln(s, GIT_COLOR_NORMAL,
     --			    whence == FROM_MERGE
     --				? _("\n"
     --					"It looks like you may be committing a merge.\n"
     --					"If this is not correct, please remove the file\n"
     --					"	%s\n"
     --					"and try again.\n")
     --				: _("\n"
     --					"It looks like you may be committing a cherry-pick.\n"
     --					"If this is not correct, please remove the file\n"
     --					"	%s\n"
     --					"and try again.\n"),
     --				whence == FROM_MERGE ?
     --					git_path_merge_head(the_repository) :
     --					git_path_cherry_pick_head(the_repository));
     -+			if (whence == FROM_MERGE)
     -+				status_printf_ln(
     -+					s, GIT_COLOR_NORMAL,
     -+
     -+					_("\n"
     -+					  "It looks like you may be committing a merge.\n"
     -+					  "If this is not correct, please remove the file\n"
     -+					  "	%s\n"
     -+					  "and try again.\n"),
     -+					git_path_merge_head(the_repository));
     -+			else
     -+				status_printf_ln(
     -+					s, GIT_COLOR_NORMAL,
     -+
     -+					_("\n"
     -+					  "It looks like you may be committing a cherry-pick.\n"
     -+					  "If this is not correct, please run\n"
     -+					  "	git cherry-pick --abort\n"
     -+					  "and try again.\n"));
     - 		}
     - 
     - 		fprintf(s->fp, "\n");
     -
       ## builtin/merge.c ##
      @@ builtin/merge.c: int cmd_merge(int argc, const char **argv, const char *prefix)
       		else
 -:  ---------- > 3:  2681638651 builtin/commit: suggest update-ref for pseudoref removal
 3:  173d81dbb4 ! 4:  9dcc10f807 Treat REVERT_HEAD as a pseudo ref
     @@ Metadata
      Author: Han-Wen Nienhuys <hanwen@google.com>
      
       ## Commit message ##
     -    Treat REVERT_HEAD as a pseudo ref
     +    sequencer: treat REVERT_HEAD as a pseudo ref
      
          Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
      

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v2 1/4] refs: make refs_ref_exists public
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
@ 2020-08-19 15:15   ` Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-19 15:15 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This will be necessary to replace file existence checks for pseudorefs.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 refs.c | 2 +-
 refs.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/refs.c b/refs.c
index cf91711968..d46080f4b6 100644
--- a/refs.c
+++ b/refs.c
@@ -313,7 +313,7 @@ int read_ref(const char *refname, struct object_id *oid)
 	return read_ref_full(refname, RESOLVE_REF_READING, oid, NULL);
 }
 
-static int refs_ref_exists(struct ref_store *refs, const char *refname)
+int refs_ref_exists(struct ref_store *refs, const char *refname)
 {
 	return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
 }
diff --git a/refs.h b/refs.h
index 29e28124cd..04bd25019f 100644
--- a/refs.h
+++ b/refs.h
@@ -105,6 +105,8 @@ int refs_verify_refname_available(struct ref_store *refs,
 				  const struct string_list *skip,
 				  struct strbuf *err);
 
+int refs_ref_exists(struct ref_store *refs, const char *refname);
+
 int ref_exists(const char *refname);
 
 int should_autocreate_reflog(const char *refname);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
@ 2020-08-19 15:15   ` Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-19 15:15 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Check for existence and delete CHERRY_PICK_HEAD through ref functions.
This will help cherry-pick work with alternate ref storage backends.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/merge.c |  2 +-
 path.c          |  1 -
 path.h          |  7 ++++---
 sequencer.c     | 42 ++++++++++++++++++++++++++----------------
 wt-status.c     |  4 ++--
 5 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index 74829a838e..b9a89ba858 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1348,7 +1348,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		else
 			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
 	}
-	if (file_exists(git_path_cherry_pick_head(the_repository))) {
+	if (ref_exists("CHERRY_PICK_HEAD")) {
 		if (advice_resolve_conflict)
 			die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
 			    "Please, commit your changes before you merge."));
diff --git a/path.c b/path.c
index 8b2c753191..783cc2ae81 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(cherry_pick_head, "CHERRY_PICK_HEAD")
 REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
diff --git a/path.h b/path.h
index 1f1bf8f87a..8941c018a9 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *cherry_pick_head;
 	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
@@ -182,9 +181,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+#define PATH_CACHE_INIT                                              \
+	{                                                            \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+	}
 
-const char *git_path_cherry_pick_head(struct repository *r);
 const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index cc3f8fa88e..09e2ff659e 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -381,7 +381,8 @@ static void print_advice(struct repository *r, int show_hint,
 		 * (typically rebase --interactive) wants to take care
 		 * of the commit itself so remove CHERRY_PICK_HEAD
 		 */
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		return;
 	}
 
@@ -1455,7 +1456,8 @@ static int do_commit(struct repository *r,
 				    author, opts, flags, &oid);
 		strbuf_release(&sb);
 		if (!res) {
-			unlink(git_path_cherry_pick_head(r));
+			refs_delete_ref(get_main_ref_store(r), "",
+					"CHERRY_PICK_HEAD", NULL, 0);
 			unlink(git_path_merge_msg(r));
 			if (!is_rebase_i(opts))
 				print_commit_summary(r, NULL, &oid,
@@ -1966,7 +1968,8 @@ static int do_pick_commit(struct repository *r,
 		flags |= ALLOW_EMPTY;
 	} else if (allow == 2) {
 		drop_commit = 1;
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		unlink(git_path_merge_msg(r));
 		fprintf(stderr,
 			_("dropping %s %s -- patch contents already upstream\n"),
@@ -2305,8 +2308,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 	struct replay_opts opts = REPLAY_OPTS_INIT;
 	int need_cleanup = 0;
 
-	if (file_exists(git_path_cherry_pick_head(r))) {
-		if (!unlink(git_path_cherry_pick_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "",
+				     "CHERRY_PICK_HEAD", NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a cherry picking in progress"));
 		opts.action = REPLAY_PICK;
 		need_cleanup = 1;
@@ -2671,8 +2676,9 @@ static int create_seq_dir(struct repository *r)
 	enum replay_action action;
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
-	unsigned int advise_skip = file_exists(git_path_revert_head(r)) ||
-				file_exists(git_path_cherry_pick_head(r));
+	unsigned int advise_skip =
+		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
 		switch (action) {
@@ -2771,7 +2777,7 @@ static int rollback_single_pick(struct repository *r)
 {
 	struct object_id head_oid;
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
@@ -2874,7 +2880,8 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 		}
 		break;
 	case REPLAY_PICK:
-		if (!file_exists(git_path_cherry_pick_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r),
+				     "CHERRY_PICK_HEAD")) {
 			if (action != REPLAY_PICK)
 				return error(_("no cherry-pick in progress"));
 			if (!rollback_is_safe())
@@ -3569,7 +3576,8 @@ static int do_merge(struct repository *r,
 				    oid_to_hex(&j->item->object.oid));
 
 		strbuf_release(&ref_name);
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		rollback_lock_file(&lock);
 
 		rollback_lock_file(&lock);
@@ -4201,7 +4209,7 @@ static int continue_single_pick(struct repository *r)
 {
 	const char *argv[] = { "commit", NULL };
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
@@ -4318,9 +4326,10 @@ static int commit_staged_changes(struct repository *r,
 	}
 
 	if (is_clean) {
-		const char *cherry_pick_head = git_path_cherry_pick_head(r);
-
-		if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") &&
+		    refs_delete_ref(get_main_ref_store(r), "",
+				    "CHERRY_PICK_HEAD", NULL, 0))
 			return error(_("could not remove CHERRY_PICK_HEAD"));
 		if (!final_fixup)
 			return 0;
@@ -4379,7 +4388,8 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 
 	if (!is_rebase_i(opts)) {
 		/* Verify that the conflict has been resolved */
-		if (file_exists(git_path_cherry_pick_head(r)) ||
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") ||
 		    file_exists(git_path_revert_head(r))) {
 			res = continue_single_pick(r);
 			if (res)
@@ -5442,7 +5452,7 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
 
 int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
 {
-	if (file_exists(git_path_cherry_pick_head(r))) {
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
 		struct object_id cherry_pick_head, rebase_head;
 
 		if (file_exists(git_path_seq_dir()))
diff --git a/wt-status.c b/wt-status.c
index d75399085d..c6abf2f3ca 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1672,8 +1672,8 @@ void wt_status_get_state(struct repository *r,
 		state->merge_in_progress = 1;
 	} else if (wt_status_check_rebase(NULL, state)) {
 		;		/* all set */
-	} else if (!stat(git_path_cherry_pick_head(r), &st) &&
-			!get_oid("CHERRY_PICK_HEAD", &oid)) {
+	} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
+		   !get_oid("CHERRY_PICK_HEAD", &oid)) {
 		state->cherry_pick_in_progress = 1;
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
  2020-08-19 15:15   ` [PATCH v2 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-19 15:15   ` Han-Wen Nienhuys via GitGitGadget
  2020-08-19 21:24     ` Junio C Hamano
  2020-08-19 15:15   ` [PATCH v2 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  4 siblings, 1 reply; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-19 15:15 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

When pseudorefs move to a different ref storage mechanism, pseudorefs no longer
can be removed with 'rm'. Instead, suggest a "update-ref -d" command, which will
work regardless of ref storage backend.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/commit.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 69ac78d5e5..a4e5e395ba 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -844,24 +844,24 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		struct ident_split ci, ai;
 
 		if (whence != FROM_COMMIT) {
+			const char *pseudoref = (whence == FROM_MERGE) ?
+							      "MERGE_HEAD" :
+							      "CHERRY_PICK_HEAD";
+			const char *what = (whence == FROM_MERGE) ?
+							 "merge" :
+							 "cherry-pick";
+
 			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
 				!merge_contains_scissors)
 				wt_status_add_cut_line(s->fp);
-			status_printf_ln(s, GIT_COLOR_NORMAL,
-			    whence == FROM_MERGE
-				? _("\n"
-					"It looks like you may be committing a merge.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n")
-				: _("\n"
-					"It looks like you may be committing a cherry-pick.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n"),
-				whence == FROM_MERGE ?
-					git_path_merge_head(the_repository) :
-					git_path_cherry_pick_head(the_repository));
+			status_printf_ln(
+				s, GIT_COLOR_NORMAL,
+				_("\n"
+				  "It looks like you may be committing a %s.\n"
+				  "If this is not correct, please remove %s with\n"
+				  "	git update-ref -d %s\n"
+				  "and try again.\n"),
+				what, pseudoref, pseudoref);
 		}
 
 		fprintf(s->fp, "\n");
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 4/4] sequencer: treat REVERT_HEAD as a pseudo ref
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
                     ` (2 preceding siblings ...)
  2020-08-19 15:15   ` [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
@ 2020-08-19 15:15   ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-19 15:15 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 path.c      |  1 -
 path.h      |  8 +++-----
 sequencer.c | 16 +++++++++-------
 wt-status.c |  2 +-
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/path.c b/path.c
index 783cc2ae81..7b385e5eb2 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
 REPO_GIT_PATH_FUNC(merge_rr, "MERGE_RR")
diff --git a/path.h b/path.h
index 8941c018a9..e7e77da6aa 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
 	const char *merge_rr;
@@ -181,12 +180,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT                                              \
-	{                                                            \
-		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+#define PATH_CACHE_INIT                                        \
+	{                                                      \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
 	}
 
-const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
 const char *git_path_merge_rr(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index 09e2ff659e..d116ea69bd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2317,8 +2317,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 		need_cleanup = 1;
 	}
 
-	if (file_exists(git_path_revert_head(r))) {
-		if (!unlink(git_path_revert_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "", "REVERT_HEAD",
+				     NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a revert in progress"));
 		opts.action = REPLAY_REVERT;
 		need_cleanup = 1;
@@ -2677,7 +2679,7 @@ static int create_seq_dir(struct repository *r)
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
 	unsigned int advise_skip =
-		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") ||
 		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
@@ -2778,7 +2780,7 @@ static int rollback_single_pick(struct repository *r)
 	struct object_id head_oid;
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
 		return error(_("cannot resolve HEAD"));
@@ -2872,7 +2874,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 	 */
 	switch (opts->action) {
 	case REPLAY_REVERT:
-		if (!file_exists(git_path_revert_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			if (action != REPLAY_REVERT)
 				return error(_("no revert in progress"));
 			if (!rollback_is_safe())
@@ -4210,7 +4212,7 @@ static int continue_single_pick(struct repository *r)
 	const char *argv[] = { "commit", NULL };
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
 }
@@ -4390,7 +4392,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 		/* Verify that the conflict has been resolved */
 		if (refs_ref_exists(get_main_ref_store(r),
 				    "CHERRY_PICK_HEAD") ||
-		    file_exists(git_path_revert_head(r))) {
+		    refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			res = continue_single_pick(r);
 			if (res)
 				goto release_todo_list;
diff --git a/wt-status.c b/wt-status.c
index c6abf2f3ca..ecbe570e28 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1678,7 +1678,7 @@ void wt_status_get_state(struct repository *r,
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
 	wt_status_check_bisect(NULL, state);
-	if (!stat(git_path_revert_head(r), &st) &&
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
 	    !get_oid("REVERT_HEAD", &oid)) {
 		state->revert_in_progress = 1;
 		oidcpy(&state->revert_head_oid, &oid);
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-19 15:04     ` Han-Wen Nienhuys
@ 2020-08-19 16:14       ` Junio C Hamano
  0 siblings, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2020-08-19 16:14 UTC (permalink / raw)
  To: Han-Wen Nienhuys; +Cc: Han-Wen Nienhuys via GitGitGadget, git, Han-Wen Nienhuys

Han-Wen Nienhuys <hanwen@google.com> writes:

>> Does "git cherry-pick --abort" only remove CHERRY_PICK_HEAD without
>> doing any other damage to the working tree files and to the index?
>
> Good catch. I just added cherry-pick --abort without much thinking. I
> reverted to update-ref -d which should be equivalent to what is
> currently recommended.

I think that is a good change, although it is unfortunate that the
command line completion considers "git update-ref -d CHERRY_P<TAB>"
something it should help the user with.

I tried "cherry-pick --abort" to see what happens after

    $ edit A B
    $ git add A
    $ git rev-parse HEAD~200 >.git/CHERRY_PICK_HEAD
    $ git commit

and aborting the last "git commit" step.  As "cherry-pick --abort"
involves running "git reset --merge" internally, of course some
states the user wanted to commit were wiped out and lost.

Thanks.


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal
  2020-08-19 15:15   ` [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
@ 2020-08-19 21:24     ` Junio C Hamano
  2020-08-21 14:57       ` Han-Wen Nienhuys
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2020-08-19 21:24 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> When pseudorefs move to a different ref storage mechanism, pseudorefs no longer
> can be removed with 'rm'. Instead, suggest a "update-ref -d" command, which will
> work regardless of ref storage backend.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  builtin/commit.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)

The spirit is good, but the execution of this patch hurts i18n by
consolidating messages that have been deliberately split and
duplicated to avoid sentence lego.  Limiting the scope of the change
to doing

    -please remove the file
    -    %s
    +please remove %s with
    +    git update-ref -d '%s'

twice may be (unfortunately) more preferrable.

As we'd be repeating the same pseudoref variable twice, introduction
of an extra variable pseudoref may be a good idea.

Or would it work better to use %1$s twice, e.g.

    status_printf_ln(...
		     _(...
			"... please remove %1$s with\n"
			"    git update-ref -d '%1$s'\n"
			"and try again.\n"), pseudoref);

I dunno.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal
  2020-08-19 21:24     ` Junio C Hamano
@ 2020-08-21 14:57       ` Han-Wen Nienhuys
  0 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys @ 2020-08-21 14:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Han-Wen Nienhuys via GitGitGadget, git, Han-Wen Nienhuys

On Wed, Aug 19, 2020 at 11:25 PM Junio C Hamano <gitster@pobox.com> wrote:
> The spirit is good, but the execution of this patch hurts i18n by
> consolidating messages that have been deliberately split and
> duplicated to avoid sentence lego.  Limiting the scope of the change
> to doing

Fair enough. I've just written out the complete command in the next version.

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v3 0/4] Use refs API for handling sundry pseudorefs
  2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
                     ` (3 preceding siblings ...)
  2020-08-19 15:15   ` [PATCH v2 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 16:59   ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
                       ` (4 more replies)
  4 siblings, 5 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-21 16:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys

This series changes the handling of CHERRY_PICK_HEAD and REVERT_HEAD to use
the refs API, as a preliminary refactor for reftable. 

No functional changes.

Han-Wen Nienhuys (4):
  refs: make refs_ref_exists public
  sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  builtin/commit: suggest update-ref for pseudoref removal
  sequencer: treat REVERT_HEAD as a pseudo ref

 builtin/commit.c | 26 +++++++++++-----------
 builtin/merge.c  |  2 +-
 path.c           |  2 --
 path.h           |  9 ++++----
 refs.c           |  2 +-
 refs.h           |  2 ++
 sequencer.c      | 56 +++++++++++++++++++++++++++++-------------------
 wt-status.c      |  6 +++---
 8 files changed, 57 insertions(+), 48 deletions(-)


base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-706%2Fhanwen%2Fstray-pseudorefs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-706/hanwen/stray-pseudorefs-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/706

Range-diff vs v2:

 1:  a8467a0d66 = 1:  bfea176682 refs: make refs_ref_exists public
 2:  2797e98446 = 2:  5ff5d2c663 sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
 3:  2681638651 ! 3:  8aacde69c8 builtin/commit: suggest update-ref for pseudoref removal
     @@ Commit message
      
       ## builtin/commit.c ##
      @@ builtin/commit.c: static int prepare_to_commit(const char *index_file, const char *prefix,
     - 		struct ident_split ci, ai;
     - 
     - 		if (whence != FROM_COMMIT) {
     -+			const char *pseudoref = (whence == FROM_MERGE) ?
     -+							      "MERGE_HEAD" :
     -+							      "CHERRY_PICK_HEAD";
     -+			const char *what = (whence == FROM_MERGE) ?
     -+							 "merge" :
     -+							 "cherry-pick";
     -+
       			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
       				!merge_contains_scissors)
       				wt_status_add_cut_line(s->fp);
     @@ builtin/commit.c: static int prepare_to_commit(const char *index_file, const cha
      -					"If this is not correct, please remove the file\n"
      -					"	%s\n"
      -					"and try again.\n"),
     --				whence == FROM_MERGE ?
     --					git_path_merge_head(the_repository) :
     --					git_path_cherry_pick_head(the_repository));
      +			status_printf_ln(
      +				s, GIT_COLOR_NORMAL,
     -+				_("\n"
     -+				  "It looks like you may be committing a %s.\n"
     -+				  "If this is not correct, please remove %s with\n"
     -+				  "	git update-ref -d %s\n"
     -+				  "and try again.\n"),
     -+				what, pseudoref, pseudoref);
     + 				whence == FROM_MERGE ?
     +-					git_path_merge_head(the_repository) :
     +-					git_path_cherry_pick_head(the_repository));
     ++					      _("\n"
     ++					  "It looks like you may be committing a merge.\n"
     ++					  "If this is not correct, please run\n"
     ++					  "	git update-ref -d MERGE_HEAD\n"
     ++					  "and try again.\n") :
     ++					      _("\n"
     ++					  "It looks like you may be committing a cherry-pick.\n"
     ++					  "If this is not correct, please run\n"
     ++					  "	git update-ref -d CHERRY_PICK_HEAD\n"
     ++					  "and try again.\n"));
       		}
       
       		fprintf(s->fp, "\n");
 4:  9dcc10f807 = 4:  9ba0136645 sequencer: treat REVERT_HEAD as a pseudo ref

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v3 1/4] refs: make refs_ref_exists public
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 16:59     ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-21 16:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This will be necessary to replace file existence checks for pseudorefs.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 refs.c | 2 +-
 refs.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/refs.c b/refs.c
index cf91711968..d46080f4b6 100644
--- a/refs.c
+++ b/refs.c
@@ -313,7 +313,7 @@ int read_ref(const char *refname, struct object_id *oid)
 	return read_ref_full(refname, RESOLVE_REF_READING, oid, NULL);
 }
 
-static int refs_ref_exists(struct ref_store *refs, const char *refname)
+int refs_ref_exists(struct ref_store *refs, const char *refname)
 {
 	return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
 }
diff --git a/refs.h b/refs.h
index 29e28124cd..04bd25019f 100644
--- a/refs.h
+++ b/refs.h
@@ -105,6 +105,8 @@ int refs_verify_refname_available(struct ref_store *refs,
 				  const struct string_list *skip,
 				  struct strbuf *err);
 
+int refs_ref_exists(struct ref_store *refs, const char *refname);
+
 int ref_exists(const char *refname);
 
 int should_autocreate_reflog(const char *refname);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 16:59     ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-21 16:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Check for existence and delete CHERRY_PICK_HEAD through ref functions.
This will help cherry-pick work with alternate ref storage backends.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/merge.c |  2 +-
 path.c          |  1 -
 path.h          |  7 ++++---
 sequencer.c     | 42 ++++++++++++++++++++++++++----------------
 wt-status.c     |  4 ++--
 5 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index 74829a838e..b9a89ba858 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1348,7 +1348,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		else
 			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
 	}
-	if (file_exists(git_path_cherry_pick_head(the_repository))) {
+	if (ref_exists("CHERRY_PICK_HEAD")) {
 		if (advice_resolve_conflict)
 			die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
 			    "Please, commit your changes before you merge."));
diff --git a/path.c b/path.c
index 8b2c753191..783cc2ae81 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(cherry_pick_head, "CHERRY_PICK_HEAD")
 REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
diff --git a/path.h b/path.h
index 1f1bf8f87a..8941c018a9 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *cherry_pick_head;
 	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
@@ -182,9 +181,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+#define PATH_CACHE_INIT                                              \
+	{                                                            \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+	}
 
-const char *git_path_cherry_pick_head(struct repository *r);
 const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index 2425896911..3f538a0851 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -381,7 +381,8 @@ static void print_advice(struct repository *r, int show_hint,
 		 * (typically rebase --interactive) wants to take care
 		 * of the commit itself so remove CHERRY_PICK_HEAD
 		 */
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		return;
 	}
 
@@ -1455,7 +1456,8 @@ static int do_commit(struct repository *r,
 				    author, opts, flags, &oid);
 		strbuf_release(&sb);
 		if (!res) {
-			unlink(git_path_cherry_pick_head(r));
+			refs_delete_ref(get_main_ref_store(r), "",
+					"CHERRY_PICK_HEAD", NULL, 0);
 			unlink(git_path_merge_msg(r));
 			if (!is_rebase_i(opts))
 				print_commit_summary(r, NULL, &oid,
@@ -1966,7 +1968,8 @@ static int do_pick_commit(struct repository *r,
 		flags |= ALLOW_EMPTY;
 	} else if (allow == 2) {
 		drop_commit = 1;
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		unlink(git_path_merge_msg(r));
 		fprintf(stderr,
 			_("dropping %s %s -- patch contents already upstream\n"),
@@ -2305,8 +2308,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 	struct replay_opts opts = REPLAY_OPTS_INIT;
 	int need_cleanup = 0;
 
-	if (file_exists(git_path_cherry_pick_head(r))) {
-		if (!unlink(git_path_cherry_pick_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "",
+				     "CHERRY_PICK_HEAD", NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a cherry picking in progress"));
 		opts.action = REPLAY_PICK;
 		need_cleanup = 1;
@@ -2671,8 +2676,9 @@ static int create_seq_dir(struct repository *r)
 	enum replay_action action;
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
-	unsigned int advise_skip = file_exists(git_path_revert_head(r)) ||
-				file_exists(git_path_cherry_pick_head(r));
+	unsigned int advise_skip =
+		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
 		switch (action) {
@@ -2771,7 +2777,7 @@ static int rollback_single_pick(struct repository *r)
 {
 	struct object_id head_oid;
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
@@ -2874,7 +2880,8 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 		}
 		break;
 	case REPLAY_PICK:
-		if (!file_exists(git_path_cherry_pick_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r),
+				     "CHERRY_PICK_HEAD")) {
 			if (action != REPLAY_PICK)
 				return error(_("no cherry-pick in progress"));
 			if (!rollback_is_safe())
@@ -3569,7 +3576,8 @@ static int do_merge(struct repository *r,
 				    oid_to_hex(&j->item->object.oid));
 
 		strbuf_release(&ref_name);
-		unlink(git_path_cherry_pick_head(r));
+		refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
+				NULL, 0);
 		rollback_lock_file(&lock);
 
 		rollback_lock_file(&lock);
@@ -4201,7 +4209,7 @@ static int continue_single_pick(struct repository *r)
 {
 	const char *argv[] = { "commit", NULL };
 
-	if (!file_exists(git_path_cherry_pick_head(r)) &&
+	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
 	    !file_exists(git_path_revert_head(r)))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
@@ -4318,9 +4326,10 @@ static int commit_staged_changes(struct repository *r,
 	}
 
 	if (is_clean) {
-		const char *cherry_pick_head = git_path_cherry_pick_head(r);
-
-		if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") &&
+		    refs_delete_ref(get_main_ref_store(r), "",
+				    "CHERRY_PICK_HEAD", NULL, 0))
 			return error(_("could not remove CHERRY_PICK_HEAD"));
 		if (!final_fixup)
 			return 0;
@@ -4379,7 +4388,8 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 
 	if (!is_rebase_i(opts)) {
 		/* Verify that the conflict has been resolved */
-		if (file_exists(git_path_cherry_pick_head(r)) ||
+		if (refs_ref_exists(get_main_ref_store(r),
+				    "CHERRY_PICK_HEAD") ||
 		    file_exists(git_path_revert_head(r))) {
 			res = continue_single_pick(r);
 			if (res)
@@ -5443,7 +5453,7 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
 
 int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
 {
-	if (file_exists(git_path_cherry_pick_head(r))) {
+	if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
 		struct object_id cherry_pick_head, rebase_head;
 
 		if (file_exists(git_path_seq_dir()))
diff --git a/wt-status.c b/wt-status.c
index d75399085d..c6abf2f3ca 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1672,8 +1672,8 @@ void wt_status_get_state(struct repository *r,
 		state->merge_in_progress = 1;
 	} else if (wt_status_check_rebase(NULL, state)) {
 		;		/* all set */
-	} else if (!stat(git_path_cherry_pick_head(r), &st) &&
-			!get_oid("CHERRY_PICK_HEAD", &oid)) {
+	} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
+		   !get_oid("CHERRY_PICK_HEAD", &oid)) {
 		state->cherry_pick_in_progress = 1;
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 3/4] builtin/commit: suggest update-ref for pseudoref removal
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 16:59     ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 16:59     ` [PATCH v3 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
  2020-08-21 18:34     ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Junio C Hamano
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-21 16:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

When pseudorefs move to a different ref storage mechanism, pseudorefs no longer
can be removed with 'rm'. Instead, suggest a "update-ref -d" command, which will
work regardless of ref storage backend.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/commit.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 69ac78d5e5..671721c385 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -847,21 +847,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
 				!merge_contains_scissors)
 				wt_status_add_cut_line(s->fp);
-			status_printf_ln(s, GIT_COLOR_NORMAL,
-			    whence == FROM_MERGE
-				? _("\n"
-					"It looks like you may be committing a merge.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n")
-				: _("\n"
-					"It looks like you may be committing a cherry-pick.\n"
-					"If this is not correct, please remove the file\n"
-					"	%s\n"
-					"and try again.\n"),
+			status_printf_ln(
+				s, GIT_COLOR_NORMAL,
 				whence == FROM_MERGE ?
-					git_path_merge_head(the_repository) :
-					git_path_cherry_pick_head(the_repository));
+					      _("\n"
+					  "It looks like you may be committing a merge.\n"
+					  "If this is not correct, please run\n"
+					  "	git update-ref -d MERGE_HEAD\n"
+					  "and try again.\n") :
+					      _("\n"
+					  "It looks like you may be committing a cherry-pick.\n"
+					  "If this is not correct, please run\n"
+					  "	git update-ref -d CHERRY_PICK_HEAD\n"
+					  "and try again.\n"));
 		}
 
 		fprintf(s->fp, "\n");
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 4/4] sequencer: treat REVERT_HEAD as a pseudo ref
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
                       ` (2 preceding siblings ...)
  2020-08-21 16:59     ` [PATCH v3 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 16:59     ` Han-Wen Nienhuys via GitGitGadget
  2020-08-21 18:34     ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Junio C Hamano
  4 siblings, 0 replies; 23+ messages in thread
From: Han-Wen Nienhuys via GitGitGadget @ 2020-08-21 16:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 path.c      |  1 -
 path.h      |  8 +++-----
 sequencer.c | 16 +++++++++-------
 wt-status.c |  2 +-
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/path.c b/path.c
index 783cc2ae81..7b385e5eb2 100644
--- a/path.c
+++ b/path.c
@@ -1528,7 +1528,6 @@ char *xdg_cache_home(const char *filename)
 	return NULL;
 }
 
-REPO_GIT_PATH_FUNC(revert_head, "REVERT_HEAD")
 REPO_GIT_PATH_FUNC(squash_msg, "SQUASH_MSG")
 REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
 REPO_GIT_PATH_FUNC(merge_rr, "MERGE_RR")
diff --git a/path.h b/path.h
index 8941c018a9..e7e77da6aa 100644
--- a/path.h
+++ b/path.h
@@ -170,7 +170,6 @@ void report_linked_checkout_garbage(void);
 	}
 
 struct path_cache {
-	const char *revert_head;
 	const char *squash_msg;
 	const char *merge_msg;
 	const char *merge_rr;
@@ -181,12 +180,11 @@ struct path_cache {
 	const char *shallow;
 };
 
-#define PATH_CACHE_INIT                                              \
-	{                                                            \
-		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
+#define PATH_CACHE_INIT                                        \
+	{                                                      \
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
 	}
 
-const char *git_path_revert_head(struct repository *r);
 const char *git_path_squash_msg(struct repository *r);
 const char *git_path_merge_msg(struct repository *r);
 const char *git_path_merge_rr(struct repository *r);
diff --git a/sequencer.c b/sequencer.c
index 3f538a0851..d7db076715 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2317,8 +2317,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 		need_cleanup = 1;
 	}
 
-	if (file_exists(git_path_revert_head(r))) {
-		if (!unlink(git_path_revert_head(r)) && verbose)
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
+		if (!refs_delete_ref(get_main_ref_store(r), "", "REVERT_HEAD",
+				     NULL, 0) &&
+		    verbose)
 			warning(_("cancelling a revert in progress"));
 		opts.action = REPLAY_REVERT;
 		need_cleanup = 1;
@@ -2677,7 +2679,7 @@ static int create_seq_dir(struct repository *r)
 	const char *in_progress_error = NULL;
 	const char *in_progress_advice = NULL;
 	unsigned int advise_skip =
-		file_exists(git_path_revert_head(r)) ||
+		refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") ||
 		refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
 
 	if (!sequencer_get_last_command(r, &action)) {
@@ -2778,7 +2780,7 @@ static int rollback_single_pick(struct repository *r)
 	struct object_id head_oid;
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	if (read_ref_full("HEAD", 0, &head_oid, NULL))
 		return error(_("cannot resolve HEAD"));
@@ -2872,7 +2874,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 	 */
 	switch (opts->action) {
 	case REPLAY_REVERT:
-		if (!file_exists(git_path_revert_head(r))) {
+		if (!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			if (action != REPLAY_REVERT)
 				return error(_("no revert in progress"));
 			if (!rollback_is_safe())
@@ -4210,7 +4212,7 @@ static int continue_single_pick(struct repository *r)
 	const char *argv[] = { "commit", NULL };
 
 	if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
-	    !file_exists(git_path_revert_head(r)))
+	    !refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
 		return error(_("no cherry-pick or revert in progress"));
 	return run_command_v_opt(argv, RUN_GIT_CMD);
 }
@@ -4390,7 +4392,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 		/* Verify that the conflict has been resolved */
 		if (refs_ref_exists(get_main_ref_store(r),
 				    "CHERRY_PICK_HEAD") ||
-		    file_exists(git_path_revert_head(r))) {
+		    refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
 			res = continue_single_pick(r);
 			if (res)
 				goto release_todo_list;
diff --git a/wt-status.c b/wt-status.c
index c6abf2f3ca..ecbe570e28 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1678,7 +1678,7 @@ void wt_status_get_state(struct repository *r,
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
 	wt_status_check_bisect(NULL, state);
-	if (!stat(git_path_revert_head(r), &st) &&
+	if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
 	    !get_oid("REVERT_HEAD", &oid)) {
 		state->revert_in_progress = 1;
 		oidcpy(&state->revert_head_oid, &oid);
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 0/4] Use refs API for handling sundry pseudorefs
  2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
                       ` (3 preceding siblings ...)
  2020-08-21 16:59     ` [PATCH v3 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
@ 2020-08-21 18:34     ` Junio C Hamano
  4 siblings, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2020-08-21 18:34 UTC (permalink / raw)
  To: Han-Wen Nienhuys via GitGitGadget; +Cc: git, Han-Wen Nienhuys

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> This series changes the handling of CHERRY_PICK_HEAD and REVERT_HEAD to use
> the refs API, as a preliminary refactor for reftable. 
>
> No functional changes.
>
> Han-Wen Nienhuys (4):
>   refs: make refs_ref_exists public
>   sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
>   builtin/commit: suggest update-ref for pseudoref removal
>   sequencer: treat REVERT_HEAD as a pseudo ref

Thanks.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-08-21 18:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 12:17 [PATCH 0/3] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
2020-08-18 12:17 ` [PATCH 1/3] Make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
2020-08-18 20:39   ` Junio C Hamano
2020-08-18 12:17 ` [PATCH 2/3] Treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
2020-08-18 21:05   ` Junio C Hamano
2020-08-19 15:04     ` Han-Wen Nienhuys
2020-08-19 16:14       ` Junio C Hamano
2020-08-18 12:17 ` [PATCH 3/3] Treat REVERT_HEAD " Han-Wen Nienhuys via GitGitGadget
2020-08-18 21:06   ` Junio C Hamano
2020-08-18 20:33 ` [PATCH 0/3] Use refs API for handling sundry pseudorefs Junio C Hamano
2020-08-19 15:15 ` [PATCH v2 0/4] " Han-Wen Nienhuys via GitGitGadget
2020-08-19 15:15   ` [PATCH v2 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
2020-08-19 15:15   ` [PATCH v2 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
2020-08-19 15:15   ` [PATCH v2 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
2020-08-19 21:24     ` Junio C Hamano
2020-08-21 14:57       ` Han-Wen Nienhuys
2020-08-19 15:15   ` [PATCH v2 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
2020-08-21 16:59   ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Han-Wen Nienhuys via GitGitGadget
2020-08-21 16:59     ` [PATCH v3 1/4] refs: make refs_ref_exists public Han-Wen Nienhuys via GitGitGadget
2020-08-21 16:59     ` [PATCH v3 2/4] sequencer: treat CHERRY_PICK_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
2020-08-21 16:59     ` [PATCH v3 3/4] builtin/commit: suggest update-ref for pseudoref removal Han-Wen Nienhuys via GitGitGadget
2020-08-21 16:59     ` [PATCH v3 4/4] sequencer: treat REVERT_HEAD as a pseudo ref Han-Wen Nienhuys via GitGitGadget
2020-08-21 18:34     ` [PATCH v3 0/4] Use refs API for handling sundry pseudorefs Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).