* [PATCH 1/2] fmt-merge-msg: respect core.commentchar in people credits
@ 2013-04-07 15:25 Ralf Thielow
2013-04-07 15:25 ` [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely Ralf Thielow
0 siblings, 1 reply; 12+ messages in thread
From: Ralf Thielow @ 2013-04-07 15:25 UTC (permalink / raw)
To: git; +Cc: gitster, Ralf Thielow
Commit eff80a9 (Allow custom "comment char") introduced a custom
comment character for commit messages but forgot to use it in
people credits which can be a part of a commit message.
With this commit, the custom comment character is also used
in people credits.
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
builtin/fmt-merge-msg.c | 6 +++---
t/t6200-fmt-merge-msg.sh | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 265a925..88df93a 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -287,10 +287,10 @@ static void credit_people(struct strbuf *out,
const char *me;
if (kind == 'a') {
- label = "\n# By ";
+ label = "By";
me = git_author_info(IDENT_NO_DATE);
} else {
- label = "\n# Via ";
+ label = "Via";
me = git_committer_info(IDENT_NO_DATE);
}
@@ -300,7 +300,7 @@ static void credit_people(struct strbuf *out,
(me = skip_prefix(me, them->items->string)) != NULL &&
skip_prefix(me, " <")))
return;
- strbuf_addstr(out, label);
+ strbuf_addf(out, "\n%c %s ", comment_line_char, label);
add_people_count(out, them);
}
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 992c2a0..84e10fd 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -180,6 +180,24 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
test_cmp expected actual
'
+test_expect_success '--log=5 with custom comment character' '
+ cat >expected <<-EOF &&
+ Merge branch ${apos}left${apos}
+
+ / By Another Author (3) and A U Thor (2)
+ / Via Another Committer
+ * left:
+ Left #5
+ Left #4
+ Left #3
+ Common #2
+ Common #1
+ EOF
+
+ git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'merge.log=0 disables shortlog' '
echo "Merge branch ${apos}left${apos}" >expected
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
--
1.8.2.470.g21ccebe
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely
2013-04-07 15:25 [PATCH 1/2] fmt-merge-msg: respect core.commentchar in people credits Ralf Thielow
@ 2013-04-07 15:25 ` Ralf Thielow
2013-04-18 6:42 ` t6200: avoid path mangling issue on Windows Johannes Sixt
0 siblings, 1 reply; 12+ messages in thread
From: Ralf Thielow @ 2013-04-07 15:25 UTC (permalink / raw)
To: git; +Cc: gitster, Ralf Thielow
Commit eff80a9 (Allow custom "comment char") introduced a custom
comment character for commit messages but didn't use it completely
in the tag signature part.
This commit fixes that.
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
builtin/fmt-merge-msg.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 88df93a..1c04070 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -503,14 +503,18 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
} else {
if (tag_number == 2) {
struct strbuf tagline = STRBUF_INIT;
- strbuf_addf(&tagline, "\n# %s\n",
- origins.items[first_tag].string);
+ strbuf_addch(&tagline, '\n');
+ strbuf_add_commented_lines(&tagline,
+ origins.items[first_tag].string,
+ strlen(origins.items[first_tag].string));
strbuf_insert(&tagbuf, 0, tagline.buf,
tagline.len);
strbuf_release(&tagline);
}
- strbuf_addf(&tagbuf, "\n# %s\n",
- origins.items[i].string);
+ strbuf_addch(&tagbuf, '\n');
+ strbuf_add_commented_lines(&tagbuf,
+ origins.items[i].string,
+ strlen(origins.items[i].string));
fmt_tag_signature(&tagbuf, &sig, buf, len);
}
strbuf_release(&sig);
--
1.8.2.470.g21ccebe
^ permalink raw reply related [flat|nested] 12+ messages in thread
* t6200: avoid path mangling issue on Windows
2013-04-07 15:25 ` [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely Ralf Thielow
@ 2013-04-18 6:42 ` Johannes Sixt
2013-04-18 17:05 ` Junio C Hamano
0 siblings, 1 reply; 12+ messages in thread
From: Johannes Sixt @ 2013-04-18 6:42 UTC (permalink / raw)
To: Ralf Thielow; +Cc: git, gitster
From: Johannes Sixt <j6t@kdbg.org>
MSYS bash interprets the slash in the argument core.commentchar="/"
as root directory and mangles it into a Windows style path. Use a
different core.commentchar to dodge the issue.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t6200-fmt-merge-msg.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index e7e945d..54b5744 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -179,8 +179,8 @@ test_expect_success '--log=5 with custom comment character' '
cat >expected <<-EOF &&
Merge branch ${apos}left${apos}
- / By Another Author (3) and A U Thor (2)
- / Via Another Committer
+ x By Another Author (3) and A U Thor (2)
+ x Via Another Committer
* left:
Left #5
Left #4
@@ -189,7 +189,7 @@ test_expect_success '--log=5 with custom comment character' '
Common #1
EOF
- git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
+ git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
test_cmp expected actual
'
--
1.8.2.1.1678.gf713add
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-18 6:42 ` t6200: avoid path mangling issue on Windows Johannes Sixt
@ 2013-04-18 17:05 ` Junio C Hamano
2013-04-19 5:48 ` Johannes Sixt
0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2013-04-18 17:05 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Ralf Thielow, git
Johannes Sixt <j.sixt@viscovery.net> writes:
> From: Johannes Sixt <j6t@kdbg.org>
>
> MSYS bash interprets the slash in the argument core.commentchar="/"
> as root directory and mangles it into a Windows style path. Use a
> different core.commentchar to dodge the issue.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ...
> - git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
> + git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
Sigh... Again?
Are folks working on Msys bash aware that sometimes the users may
want to say key=value on their command line without the value
getting molested in any way and giving them some escape hatch would
help them? Perhaps they have already decided that it is not
feasible after thinking about the issue, in which case I do not have
new ideas to offer.
I'll apply the patch as-is, but this feels really painful to the
users.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-18 17:05 ` Junio C Hamano
@ 2013-04-19 5:48 ` Johannes Sixt
2013-04-19 16:33 ` Junio C Hamano
0 siblings, 1 reply; 12+ messages in thread
From: Johannes Sixt @ 2013-04-19 5:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ralf Thielow, git
Am 4/18/2013 19:05, schrieb Junio C Hamano:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>
>> From: Johannes Sixt <j6t@kdbg.org>
>>
>> MSYS bash interprets the slash in the argument core.commentchar="/"
>> as root directory and mangles it into a Windows style path. Use a
>> different core.commentchar to dodge the issue.
>>
>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>> ...
>> - git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>> + git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>
> Sigh... Again?
>
> Are folks working on Msys bash aware that sometimes the users may
> want to say key=value on their command line without the value
> getting molested in any way and giving them some escape hatch would
> help them? Perhaps they have already decided that it is not
> feasible after thinking about the issue, in which case I do not have
> new ideas to offer.
What is "the issue"? And in which way would an escape hatch help us here?
We would have to apply a patch anyway after a glitch like this shows up,
because disabling path mangling whole-sale (if there were a method --
there is none currently) is a no-go in the context of our test suite, let
a lone in our scripted tool set.
When "foo=/" appears on the command line, the most obvious interpretation
of the slash for a program without mind-reading mode is that it is an
absolute path, and then path mangling must happen (if and only if the
invoked program is a non-MSYS program such as git).
> I'll apply the patch as-is, but this feels really painful to the
> users.
No, generally, path mangling is a service for the user.
-- Hannes
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-19 5:48 ` Johannes Sixt
@ 2013-04-19 16:33 ` Junio C Hamano
2013-04-19 19:46 ` Johannes Sixt
0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2013-04-19 16:33 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Ralf Thielow, git
Johannes Sixt <j.sixt@viscovery.net> writes:
> Am 4/18/2013 19:05, schrieb Junio C Hamano:
>> Johannes Sixt <j.sixt@viscovery.net> writes:
>>
>>> From: Johannes Sixt <j6t@kdbg.org>
>>>
>>> MSYS bash interprets the slash in the argument core.commentchar="/"
>>> as root directory and mangles it into a Windows style path. Use a
>>> different core.commentchar to dodge the issue.
>>>
>>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>>> ...
>>> - git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>>> + git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>>
>> Sigh... Again?
>>
>> Are folks working on Msys bash aware that sometimes the users may
>> want to say key=value on their command line without the value
>> getting molested in any way and giving them some escape hatch would
>> help them? Perhaps they have already decided that it is not
>> feasible after thinking about the issue, in which case I do not have
>> new ideas to offer.
>
> What is "the issue"? And in which way would an escape hatch help us here?
When the user passes key=value and value begins with a slash, value
may be a path in the filesystem very often, and adjusting it to the
local filesystem convention helps Windows users a lot.
But there are cases outside that very often when the user wants the
value passed literally. There seems to be no way to do so.
That is the issue I was wondering. If there is a clean solution to
disable path mangling per token, we could cleanly solve it.
For example, while making sure that a value that begins with slash
in normal cases is still adjusted, i.e. mangling all of the
following,
xyzzy key=/a/b/c
xyzzy key="/a/b/c"
value=/a/b/c; xyzzy key="$value"
value=/a/b/c; xyzzy "key=$value"
if bash could be told with a very unnatural and not so hard to type
way that the particular value is not to be mangled, e.g.
xyzzy key="""/a/b/c"""
value=/a/b/c; xyzzy """key=$value"""
which a normal bash would interpret as the concatenation of an empty
string inside dq, /a/b/c/ (or key=$value) inside dq, and an empty
string inside dq, which is the same as /a/b/c (or key=$value) inside
dq, it would help the less common case. Nobody would type a string
surrounded by two empty strings to be concatenated on purpose
(i.e. very unnatural) and typing the same dq four more times than
you would normally do is not too much of a hassle (not so hard to
type). The problematic case can then be fixed to
git -c core.commentchar="""/""" fmt-merge-msg ...
and it will work the same way on and off Windows.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-19 16:33 ` Junio C Hamano
@ 2013-04-19 19:46 ` Johannes Sixt
2013-04-19 21:22 ` Junio C Hamano
0 siblings, 1 reply; 12+ messages in thread
From: Johannes Sixt @ 2013-04-19 19:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ralf Thielow, git
Am 19.04.2013 18:33, schrieb Junio C Hamano:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>
>> Am 4/18/2013 19:05, schrieb Junio C Hamano:
>>> Johannes Sixt <j.sixt@viscovery.net> writes:
>>>
>>>> From: Johannes Sixt <j6t@kdbg.org>
>>>>
>>>> MSYS bash interprets the slash in the argument core.commentchar="/"
>>>> as root directory and mangles it into a Windows style path. Use a
>>>> different core.commentchar to dodge the issue.
>>>>
>>>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>>>> ...
>>>> - git -c core.commentchar="/" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>>>> + git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
>>>
>>> Sigh... Again?
>>>
>>> Are folks working on Msys bash aware that sometimes the users may
>>> want to say key=value on their command line without the value
>>> getting molested in any way and giving them some escape hatch would
>>> help them? Perhaps they have already decided that it is not
>>> feasible after thinking about the issue, in which case I do not have
>>> new ideas to offer.
>>
>> What is "the issue"? And in which way would an escape hatch help us here?
>
> When the user passes key=value and value begins with a slash, value
> may be a path in the filesystem very often, and adjusting it to the
> local filesystem convention helps Windows users a lot.
>
> But there are cases outside that very often when the user wants the
> value passed literally. There seems to be no way to do so.
> ...
> if bash could be told with a very unnatural and not so hard to type
> way that the particular value is not to be mangled, e.g.
>
> xyzzy key="""/a/b/c"""
I'll not argue whether such a feature would make sense or not, or
whether it can be implemented, because it is aimed at the user, but
misses one important point: It does in no way help our development process.
A patch auther whose first instinct is to write 'foo=/' will never write
'foo=x', let alone 'foo="""/"""'. Someone will have to discover the
issue eventually and write a patch to fix it, and someone will have to
apply it.
I don't think that we can do anything about it.
-- Hannes
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-19 19:46 ` Johannes Sixt
@ 2013-04-19 21:22 ` Junio C Hamano
2013-04-21 0:05 ` Jonathan Nieder
0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2013-04-19 21:22 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Ralf Thielow, git
Johannes Sixt <j6t@kdbg.org> writes:
> A patch auther whose first instinct is to write 'foo=/' will never write
> 'foo=x', let alone 'foo="""/"""'. Someone will have to discover the
> issue eventually and write a patch to fix it, and someone will have to
> apply it.
That is a separate issue. Didn't I say I'll apply it as-is at the
very beginning?
Our _tests_ can afford to use an unrealistic setting like
git -c core.commentchar="x" fmt-merge-msg
to work it around, because the tests do not _care_ how the final
outcome looks like. It only cares what we specified gets used.
But a _real user_ who wants to use a slash there has no way of doing
so. It is still not realistic, as it is more likely that she would
want to use a double-slash, but that would not fit in a commentchar,
and she is a lot more likely to have it in the configuration file,
but I wouldn't imagine that there are things other than "-c var=val"
that are more commonly given on the command line that share the same
pain point as this one.
That is what I meant by "feels painful to the users" and wondered if
bash on Windows can be more helpful to them.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-19 21:22 ` Junio C Hamano
@ 2013-04-21 0:05 ` Jonathan Nieder
2013-04-21 6:22 ` Johannes Sixt
2013-04-21 7:12 ` Junio C Hamano
0 siblings, 2 replies; 12+ messages in thread
From: Jonathan Nieder @ 2013-04-21 0:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Sixt, Ralf Thielow, git
Junio C Hamano wrote:
> But a _real user_ who wants to use a slash there has no way of doing
> so.
Doesn't foo=// do that in the msys world? If I am reading
mingw/msys/rt/src/winsup/cygwin/path.cc correctly then the way to pass
a true double-slash is foo=///.
Jonathan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-21 0:05 ` Jonathan Nieder
@ 2013-04-21 6:22 ` Johannes Sixt
2013-04-21 6:35 ` Jonathan Nieder
2013-04-21 7:12 ` Junio C Hamano
1 sibling, 1 reply; 12+ messages in thread
From: Johannes Sixt @ 2013-04-21 6:22 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Ralf Thielow, git
Am 21.04.2013 02:05, schrieb Jonathan Nieder:
> Junio C Hamano wrote:
>
>> But a _real user_ who wants to use a slash there has no way of doing
>> so.
>
> Doesn't foo=// do that in the msys world? If I am reading
> mingw/msys/rt/src/winsup/cygwin/path.cc correctly then the way to pass
> a true double-slash is foo=///.
That would be totally unexpected.
-- Hannes
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-21 6:22 ` Johannes Sixt
@ 2013-04-21 6:35 ` Jonathan Nieder
0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Nieder @ 2013-04-21 6:35 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, Ralf Thielow, git
Johannes Sixt wrote:
> Am 21.04.2013 02:05, schrieb Jonathan Nieder:
>> Junio C Hamano wrote:
>>> But a _real user_ who wants to use a slash there has no way of doing
>>> so.
>>
>> Doesn't foo=// do that in the msys world? If I am reading
>> mingw/msys/rt/src/winsup/cygwin/path.cc correctly then the way to pass
>> a true double-slash is foo=///.
>
> That would be totally unexpected.
There is an exception to the path mangling for //unc/paths, if that's
what you mean.
>From [1]:
if (path[0] == '/' && path[1] == '/')
{
int tidx = 2;
while (spath[tidx] && spath[tidx] == '/')
tidx++;
if (strchr (&spath[tidx], '/'))
{
retpathcpy (spath);
}
else
{
retpathcpy (&spath[1]);
}
return ScrubRetpath (retpath);
}
I haven't tested, since I don't have easy access to a Windows test
setup.
Regards,
Jonathan
[1] http://mingw.cvs.sourceforge.net/viewvc/mingw/msys/rt/src/winsup/cygwin/path.cc?content-type=text%2Fplain
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: t6200: avoid path mangling issue on Windows
2013-04-21 0:05 ` Jonathan Nieder
2013-04-21 6:22 ` Johannes Sixt
@ 2013-04-21 7:12 ` Junio C Hamano
1 sibling, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2013-04-21 7:12 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Johannes Sixt, Ralf Thielow, git
Jonathan Nieder <jrnieder@gmail.com> writes:
> Junio C Hamano wrote:
>
>> But a _real user_ who wants to use a slash there has no way of doing
>> so.
>
> Doesn't foo=// do that in the msys world?
"that" refers to...? Do you mean:
$ value=/; mycmd key="$value"
breaks msys, but you can say
$ value=//; mycmd key="$value"
instead to pass a value that is a single slash.
then that is not a valid workaround; it would work differently
between Windows (passes one slash?) and everybody else (passes two
slashes).
I do not mean to say the "'' (empty string) and what you want to say
and '' (empty string) concatenated together" I suggested in the
previous message is a workable (let alone the best) proposition, but
if
$ value=/; mycmd key=''"$value"''
worked as a way to temporarily turn off the path mangling, it at
least would be a usable workaround that would work the same way
between Windows and everybody else.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-04-21 7:12 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-07 15:25 [PATCH 1/2] fmt-merge-msg: respect core.commentchar in people credits Ralf Thielow
2013-04-07 15:25 ` [PATCH 2/2] fmt-merge-msg: use core.commentchar in tag signatures completely Ralf Thielow
2013-04-18 6:42 ` t6200: avoid path mangling issue on Windows Johannes Sixt
2013-04-18 17:05 ` Junio C Hamano
2013-04-19 5:48 ` Johannes Sixt
2013-04-19 16:33 ` Junio C Hamano
2013-04-19 19:46 ` Johannes Sixt
2013-04-19 21:22 ` Junio C Hamano
2013-04-21 0:05 ` Jonathan Nieder
2013-04-21 6:22 ` Johannes Sixt
2013-04-21 6:35 ` Jonathan Nieder
2013-04-21 7:12 ` 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).