This will no longer work:
$ git repo-config 'key.with
newline' some-value
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
On Fri, 19 Jan 2007, Junio C Hamano wrote:
> I think the current repo-config handles sane cases alright, but
> it is still fragile in error cases. For example:
>
> $ git repo-config 'foo.bar=bzz
> baz.boo' foobar
>
> does not currently barf, but results in a corrupted config file.
Now it barfs.
config.c | 5 +++++
t/t1300-repo-config.sh | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/config.c b/config.c
index b6082f5..c08c668 100644
--- a/config.c
+++ b/config.c
@@ -661,6 +661,11 @@ int git_config_set_multivar(const char* key, const char* value,
goto out_free;
}
c = tolower(c);
+ } else if (c == '\n') {
+ fprintf(stderr, "invalid key (newline): %s\n", key);
+ free(store.key);
+ ret = 1;
+ goto out_free;
}
store.key[i] = c;
}
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 60acdd3..eb7455b 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -418,5 +418,11 @@ EOF
test_expect_success 'quoting' 'cmp .git/config expect'
+test_expect_failure 'key with newline' 'git repo-config key.with\\\
+newline 123'
+
+test_expect_success 'value with newline' 'git repo-config key.sub value.with\\\
+newline'
+
test_done
--
1.5.0.rc1.g5a400-dirty
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Ryan Hope | reiser4 for 2.6.27-rc1 |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
| Tim Tassonis | reiser4 for 2.6.27-rc1 |
| Chuck Ebbert | Why do so many machines need "noapic"? |
git: | |
| Alan Chandler | Question around git-shell usage in Everyday Git |
| Kyle Moffett | Using GIT to store /etc (Or: How to make GIT store all file permission bits) |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Jakub Narebski | [PATCH] gitweb: Use File::Find::find in git_get_projects_list |
| Richard Stallman | Real men don't attack straw men |
| Bertram Scharpf | First install: Grub doesn't find partitions |
| Girish Venkatachalam | Hazy top of mind questions on spam control with OpenBSD |
| Jussi Peltola | Re: Remote Admin Card - Dell DRAC or HP ILO2 ? |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Les Andrzejewski | X386/WD90C31/SUMSUNG SYNC MASTER 4 |
| Stephen Pierce | SLS |
| Sander van Malssen | uemacs |
