git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] config.c: remove unnecessary header in minimum configuration file.
@ 2005-11-25 22:22 Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2005-11-25 22:22 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

It is just silly to start the file called "config" a comment
that says "This is the config file."

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 config.c               |    8 --------
 t/t1300-repo-config.sh |   20 --------------------
 2 files changed, 0 insertions(+), 28 deletions(-)

applies-to: f316bfd81eaa2064c1d9e01a336eaed8d7a5bd4f
55c2454c6f18323b5ff04504593603848084aa4d
diff --git a/config.c b/config.c
index 5cc8535..52659f9 100644
--- a/config.c
+++ b/config.c
@@ -445,12 +445,6 @@ int git_config_set_multivar(const char* 
 	 * If .git/config does not exist yet, write a minimal version.
 	 */
 	if (stat(config_filename, &st)) {
-		static const char contents[] =
-			"#\n"
-			"# This is the config file\n"
-			"#\n"
-			"\n";
-
 		free(store.key);
 
 		/* if nothing to unset, error out */
@@ -461,8 +455,6 @@ int git_config_set_multivar(const char* 
 		}
 
 		store.key = (char*)key;
-
-		write(fd, contents, sizeof(contents)-1);
 		store_write_section(fd, key);
 		store_write_pair(fd, key, value);
 	} else{
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 5e994ff..207dd3d 100644
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -12,10 +12,6 @@ test -f .git/config && rm .git/config
 git-repo-config core.penguin "little blue"
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 EOF
@@ -25,10 +21,6 @@ test_expect_success 'initial' 'cmp .git/
 git-repo-config Core.Movie BadPhysics
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -39,10 +31,6 @@ test_expect_success 'mixed case' 'cmp .g
 git-repo-config Cores.WhatEver Second
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -55,10 +43,6 @@ test_expect_success 'similar section' 'c
 git-repo-config CORE.UPPERCASE true
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -76,10 +60,6 @@ test_expect_success 'replace with non-ma
 	'git-repo-config core.penguin "very blue" !kingpin'
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = very blue
 	Movie = BadPhysics
---
0.99.9.GIT

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

* [PATCH] config.c: remove unnecessary header in minimum configuration file.
@ 2005-11-25 22:22 Junio C Hamano
  2005-12-05  0:27 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-11-25 22:22 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

It is just silly to start the file called "config" with a
comment that says "This is the config file."

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 config.c               |    8 --------
 t/t1300-repo-config.sh |   20 --------------------
 2 files changed, 0 insertions(+), 28 deletions(-)

applies-to: f316bfd81eaa2064c1d9e01a336eaed8d7a5bd4f
55c2454c6f18323b5ff04504593603848084aa4d
diff --git a/config.c b/config.c
index 5cc8535..52659f9 100644
--- a/config.c
+++ b/config.c
@@ -445,12 +445,6 @@ int git_config_set_multivar(const char* 
 	 * If .git/config does not exist yet, write a minimal version.
 	 */
 	if (stat(config_filename, &st)) {
-		static const char contents[] =
-			"#\n"
-			"# This is the config file\n"
-			"#\n"
-			"\n";
-
 		free(store.key);
 
 		/* if nothing to unset, error out */
@@ -461,8 +455,6 @@ int git_config_set_multivar(const char* 
 		}
 
 		store.key = (char*)key;
-
-		write(fd, contents, sizeof(contents)-1);
 		store_write_section(fd, key);
 		store_write_pair(fd, key, value);
 	} else{
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 5e994ff..207dd3d 100644
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -12,10 +12,6 @@ test -f .git/config && rm .git/config
 git-repo-config core.penguin "little blue"
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 EOF
@@ -25,10 +21,6 @@ test_expect_success 'initial' 'cmp .git/
 git-repo-config Core.Movie BadPhysics
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -39,10 +31,6 @@ test_expect_success 'mixed case' 'cmp .g
 git-repo-config Cores.WhatEver Second
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -55,10 +43,6 @@ test_expect_success 'similar section' 'c
 git-repo-config CORE.UPPERCASE true
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = little blue
 	Movie = BadPhysics
@@ -76,10 +60,6 @@ test_expect_success 'replace with non-ma
 	'git-repo-config core.penguin "very blue" !kingpin'
 
 cat > expect << EOF
-#
-# This is the config file
-#
-
 [core]
 	penguin = very blue
 	Movie = BadPhysics
---
0.99.9.GIT

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-11-25 22:22 [PATCH] config.c: remove unnecessary header in minimum configuration file Junio C Hamano
@ 2005-12-05  0:27 ` Junio C Hamano
  2005-12-05 11:32   ` Andreas Ericsson
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-05  0:27 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

Junio C Hamano <junkio@cox.net> writes:

> It is just silly to start the file called "config" with a
> comment that says "This is the config file."

Any likes or dislikes?

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05  0:27 ` Junio C Hamano
@ 2005-12-05 11:32   ` Andreas Ericsson
  2005-12-05 20:25     ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Ericsson @ 2005-12-05 11:32 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:
> Junio C Hamano <junkio@cox.net> writes:
> 
> 
>>It is just silly to start the file called "config" with a
>>comment that says "This is the config file."
> 
> 
> Any likes or dislikes?
> 

I believe we all agree in silent consensus.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05 11:32   ` Andreas Ericsson
@ 2005-12-05 20:25     ` Johannes Schindelin
  2005-12-05 20:56       ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-05 20:25 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git

Hi,

On Mon, 5 Dec 2005, Andreas Ericsson wrote:

> Junio C Hamano wrote:
> > Junio C Hamano <junkio@cox.net> writes:
> > 
> > 
> > > It is just silly to start the file called "config" with a
> > > comment that says "This is the config file."
> > 
> > 
> > Any likes or dislikes?
> > 
> 
> I believe we all agree in silent consensus.

I don't really care, since I know very well that it is a config file... 
However, you should also remove the header which is generated in init-db.c 
when it is determined that the file system does not respect the executable 
flag.

Ciao,
Dscho

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05 20:25     ` Johannes Schindelin
@ 2005-12-05 20:56       ` Junio C Hamano
  2005-12-05 21:05         ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-05 20:56 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> However, you should also remove the header which is generated in init-db.c 
> when it is determined that the file system does not respect the executable 
> flag.

I suspect that code is not there anymore.

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05 20:56       ` Junio C Hamano
@ 2005-12-05 21:05         ` Johannes Schindelin
  2005-12-05 21:47           ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-05 21:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Mon, 5 Dec 2005, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > However, you should also remove the header which is generated in init-db.c 
> > when it is determined that the file system does not respect the executable 
> > flag.
> 
> I suspect that code is not there anymore.

Oops. I missed that one (probably because it did not say anything about 
the filemode test in the shortlog).

However, reading the code I am not satisfied. If there is no template for 
the config file, it does not test the filemode at all.

In fact, it reverses my design: I did *not* touch an existing config file, 
but only created one if none existed. And if the filemode was not set, I 
threw the config file away.

Ciao,
Dscho

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05 21:05         ` Johannes Schindelin
@ 2005-12-05 21:47           ` Junio C Hamano
  2005-12-05 22:16             ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-05 21:47 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> However, reading the code I am not satisfied. If there is no template for 
> the config file, it does not test the filemode at all.

I have a feeling that you have not tried the code you are
arguing against.

It always creates the config file because it needs to record the
repository format version (among other things), so the config
file exists even if you do not have templates.  Even if you do
not have a valid template directory that is supposed to work,
but obviously you have not tried it ;-).

Now, it is arguable that the current format version being 0, and
not having the format version is equivalent to having 0 as the
format version, it is not necessary to create an empty
configuration file at this moment, but by making sure we record
the format version the tool that created the repository supports
now in the version 0, we do not have to risk forgetting to add
that logic later when we _do_ need to write something non-zero.

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

* Re: [PATCH] config.c: remove unnecessary header in minimum configuration file.
  2005-12-05 21:47           ` Junio C Hamano
@ 2005-12-05 22:16             ` Johannes Schindelin
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-05 22:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Mon, 5 Dec 2005, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > However, reading the code I am not satisfied. If there is no template for 
> > the config file, it does not test the filemode at all.
> 
> I have a feeling that you have not tried the code you are
> arguing against.

Got me right there.

Sorry.

Ciao,
Dscho

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

end of thread, other threads:[~2005-12-05 22:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-25 22:22 [PATCH] config.c: remove unnecessary header in minimum configuration file Junio C Hamano
2005-12-05  0:27 ` Junio C Hamano
2005-12-05 11:32   ` Andreas Ericsson
2005-12-05 20:25     ` Johannes Schindelin
2005-12-05 20:56       ` Junio C Hamano
2005-12-05 21:05         ` Johannes Schindelin
2005-12-05 21:47           ` Junio C Hamano
2005-12-05 22:16             ` Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2005-11-25 22:22 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).