Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-07 Thread Jeff King
On Thu, Jan 02, 2014 at 11:08:51AM -0800, Junio C Hamano wrote: Jeff King p...@peff.net writes: ... But the test suite, of course, always uses askpass because it cannot rely on accessing a terminal (we'd have to do some magic with lib-terminal, I think). So it doesn't detect the

Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-07 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Thu, Jan 02, 2014 at 11:08:51AM -0800, Junio C Hamano wrote: Jeff King p...@peff.net writes: ... But the test suite, of course, always uses askpass because it cannot rely on accessing a terminal (we'd have to do some magic with lib-terminal, I think).

Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-07 Thread Jeff King
On Tue, Jan 07, 2014 at 11:44:00AM -0800, Junio C Hamano wrote: test-terminal only handles stdout and stderr streams as fake terminals. We could pretty easily add stdin for input, as it uses fork() to work asynchronously. But the credential code does not actually read from stdin. It

Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-02 Thread Junio C Hamano
Jeff King p...@peff.net writes: ... But the test suite, of course, always uses askpass because it cannot rely on accessing a terminal (we'd have to do some magic with lib-terminal, I think). So it doesn't detect the problem in your patch, but I wonder if it is worth applying the patch below

[PATCH] drop unnecessary copying in credential_ask_one

2014-01-01 Thread Tay Ray Chuan
We were leaking memory in there, as after obtaining a string from git_getpass, we returned a copy of it, yet no one else held the original string, apart from credential_ask_one. Signed-off-by: Tay Ray Chuan rcta...@gmail.com --- credential.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-01 Thread Jeff King
On Thu, Jan 02, 2014 at 09:06:33AM +0800, Tay Ray Chuan wrote: We were leaking memory in there, as after obtaining a string from git_getpass, we returned a copy of it, yet no one else held the original string, apart from credential_ask_one. I don't think this change is correct by itself.

Re: [PATCH] drop unnecessary copying in credential_ask_one

2014-01-01 Thread Jeff King
On Wed, Jan 01, 2014 at 10:03:30PM -0500, Jeff King wrote: On Thu, Jan 02, 2014 at 09:06:33AM +0800, Tay Ray Chuan wrote: We were leaking memory in there, as after obtaining a string from git_getpass, we returned a copy of it, yet no one else held the original string, apart from