summaryrefslogtreecommitdiff
path: root/builtin/stripspace.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-11-21 14:18:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-11-21 19:00:38 (GMT)
commit92068ae8bf5711b683a0dbeef75d76f56ead5590 (patch)
treeb9da2131ef490cfd77b5cd046fac9deef95d3a23 /builtin/stripspace.c
parent6645838845c523952f60a855f8c646d49e59cee0 (diff)
downloadgit-92068ae8bf5711b683a0dbeef75d76f56ead5590.zip
git-92068ae8bf5711b683a0dbeef75d76f56ead5590.tar.gz
git-92068ae8bf5711b683a0dbeef75d76f56ead5590.tar.bz2
stripspace: respect repository config
The way "git stripspace" reads the configuration was not quite kosher, in that the code forgot to probe for a possibly existing repository (note: stripspace is designed to be usable outside the repository as well). It read .git/config only when it was run from the top-level of the working tree by accident. A recent change b9605bc4f2 ("config: only read .git/config from configured repos", 2016-09-12) stopped reading the repository-local configuration file ".git/config" unless the repository discovery process is done, so that .git/config is never read even when run from the top-level, exposing the old bug more. When rebasing interactively with a commentChar defined in the current repository's config, the help text at the bottom of the edit script potentially used an incorrect comment character. This was not only funny-looking, but also resulted in tons of warnings like this one: Warning: the command isn't recognized in the following line - # Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/stripspace.c')
-rw-r--r--builtin/stripspace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index 15e716e..1e62a00 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -44,8 +44,10 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
if (argc)
usage_with_options(stripspace_usage, options);
- if (mode == STRIP_COMMENTS || mode == COMMENT_LINES)
+ if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
+ setup_git_directory_gently(NULL);
git_config(git_default_config, NULL);
+ }
if (strbuf_read(&buf, 0, 1024) < 0)
die_errno("could not read the input");