Re: [PATCH] alias.c: use git_config_string() to get alias_val

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> So you should say in the commit message that you decided to cast to "const 
> char **" despite what is on the Janitor page, and most importantly explain 
> why in the commit message.

Ah, ok.
Didn't knew that such reasoning goes into the commit message,
but, yes, it makes sense.

> > But instead of doing that, the original should be kept, because it is
> > better in code beauty, performance and memory usage. ;-)
> 
> Yes, so perhaps it's not a good idea to convert the original file to 
> git_config_string.

Or to use the cast. ;-)

[...]
> But I don't think it's worth the trouble.

I agree ;-)

So what to do?
Keep it?



And there are still some easy `Janitor tasks', like in builtin-apply.c:
--
diff --git a/builtin-apply.c b/builtin-apply.c
index b5f78ac..ce0a0c3 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2978,12 +2978,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
 
 static int git_apply_config(const char *var, const char *value)
 {
-	if (!strcmp(var, "apply.whitespace")) {
-		if (!value)
-			return config_error_nonbool(var);
-		apply_default_whitespace = xstrdup(value);
-		return 0;
-	}
+	if (!strcmp(var, "apply.whitespace"))
+		return git_config_string(&apply_default_whitespace, var, value);
 	return git_default_config(var, value);
 }
 
--
(Test case: git-apply a patch with trailing whitespaces and check with
apply.whitespace = nowarn / fix / error)

I have attached the patch because I do not want to drop another 
mail for it.
And now there is nothing to argue about, I hope, because it is as simple as
http://git.kernel.org/?p=git/git.git;a=commitdiff;h=9886ea417b7da9722c95630b5980ac174e04c71c


Regards,
 Stephan

-- 
Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F
>From 78d1ac0fd19b274853d3c8439d45922c1a0fe82d Mon Sep 17 00:00:00 2001
From: Stephan Beyer <s-beyer@xxxxxxx>
Date: Sun, 6 Apr 2008 12:37:31 +0200
Subject: [PATCH] builtin-apply.c: use git_config_string() to get apply_default_whitespace

Signed-off-by: Stephan Beyer <s-beyer@xxxxxxx>
---
 builtin-apply.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index b5f78ac..ce0a0c3 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2978,12 +2978,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
 
 static int git_apply_config(const char *var, const char *value)
 {
-	if (!strcmp(var, "apply.whitespace")) {
-		if (!value)
-			return config_error_nonbool(var);
-		apply_default_whitespace = xstrdup(value);
-		return 0;
-	}
+	if (!strcmp(var, "apply.whitespace"))
+		return git_config_string(&apply_default_whitespace, var, value);
 	return git_default_config(var, value);
 }
 
-- 
1.5.5.rc3.8.g78d1a


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux