From: Elijah Newren <newren@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Elijah Newren <newren@gmail.com>
Subject: [PATCH 14/17] merge-ort: add a new toplevel_dir field
Date: Mon, 4 Jan 2021 15:50:03 -0800 [thread overview]
Message-ID: <20210104235006.2867404-15-newren@gmail.com> (raw)
In-Reply-To: <20210104235006.2867404-1-newren@gmail.com>
Due to the string-equality-iff-pointer-equality requirements placed on
merged_info.directory_name, apply_directory_rename_modifications() will
need to have access to the exact toplevel directory name string pointer
and can't just use a new empty string. Store it in a field that we can
use.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
merge-ort.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/merge-ort.c b/merge-ort.c
index d0fb8f4282..230224e680 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -171,12 +171,15 @@ struct merge_options_internal {
struct rename_info renames;
/*
- * current_dir_name: temporary var used in collect_merge_info_callback()
+ * current_dir_name, toplevel_dir: temporary vars
*
- * Used to set merged_info.directory_name; see documentation for that
- * variable and the requirements placed on that field.
+ * These are used in collect_merge_info_callback(), and will set the
+ * various merged_info.directory_name for the various paths we get;
+ * see documentation for that variable and the requirements placed on
+ * that field.
*/
const char *current_dir_name;
+ const char *toplevel_dir;
/* call_depth: recursion level counter for merging merge bases */
int call_depth;
@@ -734,10 +737,10 @@ static int collect_merge_info(struct merge_options *opt,
int ret;
struct tree_desc t[3];
struct traverse_info info;
- const char *toplevel_dir_placeholder = "";
- opt->priv->current_dir_name = toplevel_dir_placeholder;
- setup_traverse_info(&info, toplevel_dir_placeholder);
+ opt->priv->toplevel_dir = "";
+ opt->priv->current_dir_name = opt->priv->toplevel_dir;
+ setup_traverse_info(&info, opt->priv->toplevel_dir);
info.fn = collect_merge_info_callback;
info.data = opt;
info.show_all_errors = 1;
--
2.29.1.106.g3ff750dc32.dirty
next prev parent reply other threads:[~2021-01-04 23:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 23:49 [PATCH 00/17] Add directory rename detection to merge-ort Elijah Newren
2021-01-04 23:49 ` [PATCH 01/17] merge-ort: add new data structures for directory rename detection Elijah Newren
2021-01-04 23:49 ` [PATCH 02/17] merge-ort: initialize and free new directory rename data structures Elijah Newren
2021-01-04 23:49 ` [PATCH 03/17] merge-ort: collect which directories are removed in dirs_removed Elijah Newren
2021-01-04 23:49 ` [PATCH 04/17] merge-ort: add outline for computing directory renames Elijah Newren
2021-01-04 23:49 ` [PATCH 05/17] merge-ort: add outline of get_provisional_directory_renames() Elijah Newren
2021-01-04 23:49 ` [PATCH 06/17] merge-ort: copy get_renamed_dir_portion() from merge-recursive.c Elijah Newren
2021-01-04 23:49 ` [PATCH 07/17] merge-ort: implement compute_rename_counts() Elijah Newren
2021-01-04 23:49 ` [PATCH 08/17] merge-ort: implement handle_directory_level_conflicts() Elijah Newren
2021-01-04 23:49 ` [PATCH 09/17] merge-ort: modify collect_renames() for directory rename handling Elijah Newren
2021-01-04 23:49 ` [PATCH 10/17] merge-ort: implement compute_collisions() Elijah Newren
2021-01-04 23:50 ` [PATCH 11/17] merge-ort: implement apply_dir_rename() and check_dir_renamed() Elijah Newren
2021-01-04 23:50 ` [PATCH 12/17] merge-ort: implement check_for_directory_rename() Elijah Newren
2021-01-04 23:50 ` [PATCH 13/17] merge-ort: implement handle_path_level_conflicts() Elijah Newren
2021-01-04 23:50 ` Elijah Newren [this message]
2021-01-04 23:50 ` [PATCH 15/17] merge-ort: implement apply_directory_rename_modifications() Elijah Newren
2021-01-04 23:50 ` [PATCH 16/17] merge-ort: process_renames() now needs more defensiveness Elijah Newren
2021-01-04 23:50 ` [PATCH 17/17] merge-ort: fix a directory rename detection bug Elijah Newren
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=20210104235006.2867404-15-newren@gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 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).