diff mbox series

[GSoC,v2,5/9] submodule--helper: remove constness of sm_path

Message ID 20210805074054.29916-6-raykar.ath@gmail.com (mailing list archive)
State Superseded
Headers show
Series submodule: convert the rest of 'add' to C | expand

Commit Message

Atharva Raykar Aug. 5, 2021, 7:40 a.m. UTC
This is needed so that it can be modified by normalize_path_copy() in
the next patch.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <periperidip@gmail.com>
---
 builtin/submodule--helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano Aug. 5, 2021, 8:40 p.m. UTC | #1
Atharva Raykar <raykar.ath@gmail.com> writes:

> This is needed so that it can be modified by normalize_path_copy() in
> the next patch.

This is a hard-to-judge change.  With this alone, we cannot tell if
somebody has already looked at the member (and possibly saved the
pointer elsewhere) before "the next patch" starts modifying the
member in the struct.  It probably should be done in a single patch
to demonstrate why it is needed and how existing users of the field
are OK with this change.

>
> Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: Shourya Shukla <periperidip@gmail.com>
> ---
>  builtin/submodule--helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 9b676c12f8..99aabf1078 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -2748,7 +2748,7 @@ struct add_data {
>  	const char *prefix;
>  	const char *branch;
>  	const char *reference_path;
> -	const char *sm_path;
> +	char *sm_path;
>  	const char *sm_name;
>  	const char *repo;
>  	const char *realrepo;
Atharva Raykar Aug. 6, 2021, 11:16 a.m. UTC | #2
Junio C Hamano <gitster@pobox.com> writes:

> Atharva Raykar <raykar.ath@gmail.com> writes:
>
>> This is needed so that it can be modified by normalize_path_copy() in
>> the next patch.
>
> This is a hard-to-judge change.  With this alone, we cannot tell if
> somebody has already looked at the member (and possibly saved the
> pointer elsewhere) before "the next patch" starts modifying the
> member in the struct.  It probably should be done in a single patch
> to demonstrate why it is needed and how existing users of the field
> are OK with this change.

Okay, I will move this to the next patch.
diff mbox series

Patch

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 9b676c12f8..99aabf1078 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2748,7 +2748,7 @@  struct add_data {
 	const char *prefix;
 	const char *branch;
 	const char *reference_path;
-	const char *sm_path;
+	char *sm_path;
 	const char *sm_name;
 	const char *repo;
 	const char *realrepo;