Git development
 help / color / mirror / Atom feed
* [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives
       [not found] <1a7cc4db062b7df0dae0f27b29dba66c9d917e59.1221767629.git.charles@hashpling.org>
@ 2008-09-18 20:01 ` Charles Bailey
  2008-09-18 20:08   ` Charles Bailey
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Charles Bailey @ 2008-09-18 20:01 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

There is currently no call to git_config at the start of cmd_archive.
When creating tar archives the core config is read as a side-effect of
reading the tar specific config, but this doesn't happen for zip
archives.

The consequence is that in a configuration with core.autocrlf set,
although files in a tar archive are created with crlf line endings,
files in a zip archive retain unix line endings.

Signed-off-by: Charles Bailey <charles@hashpling.org>
---

It took me a while to find the cause of the difference in behaviour
between tar and zip format archives when all the crlf fixing code
seemed to be in code shared by both archiving processes. I'm 99% sure
that creating zip archives from repositories with core.autocrlf set to
true should create zip entries with crlf line endings but it would be
good to have that confirmed.

 builtin-archive.c       |    2 ++
 t/t0024-crlf-archive.sh |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/builtin-archive.c b/builtin-archive.c
index 5ceec43..432ce2a 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
 {
 	const char *remote = NULL;
 
+	git_config(git_default_config, NULL);
+
 	remote = extract_remote_arg(&argc, argv);
 	if (remote)
 		return run_remote_archiver(remote, argc, argv);
diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index 3511439..e533039 100644
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -33,7 +33,7 @@ if [ $? -eq 127 ]; then
 	exit
 fi
 
-test_expect_failure 'zip archive' '
+test_expect_success 'zip archive' '
 
 	git archive --format=zip HEAD >test.zip &&
 
-- 
1.6.0.1.309.g4f56

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

* Re: [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives
  2008-09-18 20:01 ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives Charles Bailey
@ 2008-09-18 20:08   ` Charles Bailey
  2008-09-18 20:21   ` Andreas Ericsson
  2008-09-18 20:41   ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives René Scharfe
  2 siblings, 0 replies; 6+ messages in thread
From: Charles Bailey @ 2008-09-18 20:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Apologies for the bad threading headers and the weird characters in
the subject.

While I though I'd remembered how git format-patch and my mail client
worked together, it's obvious that I hadn't.

I'll make sure that I get it right in the final patch, but in the mean
time are there any comments on this?

Charles.

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

* Re: [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives
  2008-09-18 20:01 ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives Charles Bailey
  2008-09-18 20:08   ` Charles Bailey
@ 2008-09-18 20:21   ` Andreas Ericsson
  2008-09-18 20:29     ` [PATCH 1/1] Make git archive respect core.autocrlf when creating Charles Bailey
  2008-09-18 20:41   ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives René Scharfe
  2 siblings, 1 reply; 6+ messages in thread
From: Andreas Ericsson @ 2008-09-18 20:21 UTC (permalink / raw)
  To: Charles Bailey; +Cc: git, Junio C Hamano

Charles Bailey wrote:
> There is currently no call to git_config at the start of cmd_archive.
> When creating tar archives the core config is read as a side-effect of
> reading the tar specific config, but this doesn't happen for zip
> archives.
> 
> The consequence is that in a configuration with core.autocrlf set,
> although files in a tar archive are created with crlf line endings,
> files in a zip archive retain unix line endings.
> 
> Signed-off-by: Charles Bailey <charles@hashpling.org>
> ---
> 
> It took me a while to find the cause of the difference in behaviour
> between tar and zip format archives when all the crlf fixing code
> seemed to be in code shared by both archiving processes. I'm 99% sure
> that creating zip archives from repositories with core.autocrlf set to
> true should create zip entries with crlf line endings but it would be
> good to have that confirmed.
> 

If it fixes the broken test while all the other tests still
pass, I can only assume it's doing something right.

The topic is a bit long though. Could you change it to
"git archive: respect core.autocrlf when creating zip archives"
so that it fits comfortably in one line when running "git log"
on 80 char wide terminals?

As a side-note, you needn't put "1/1" in the [PATCH] section.
That's usually done to make sure patches are applied in the
right order when sending a series, but since a series of 1
is kinda hard to jumble.. ;-)

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

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

* Re: [PATCH 1/1] Make git archive respect core.autocrlf when creating ...
  2008-09-18 20:21   ` Andreas Ericsson
@ 2008-09-18 20:29     ` Charles Bailey
  2008-09-18 20:53       ` Sverre Rabbelier
  0 siblings, 1 reply; 6+ messages in thread
From: Charles Bailey @ 2008-09-18 20:29 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git, Junio C Hamano

On Thu, Sep 18, 2008 at 10:21:05PM +0200, Andreas Ericsson wrote:
> If it fixes the broken test while all the other tests still
> pass, I can only assume it's doing something right.

Only if you believe that I added a sensible test in the first place :-)

> The topic is a bit long though. Could you change it to
> "git archive: respect core.autocrlf when creating zip archives"
> so that it fits comfortably in one line when running "git log"
> on 80 char wide terminals?

Sorry, I made it <= 72 chars in my commit message and then forgot that
git format-patch adds the [PATCH] tag.

> As a side-note, you needn't put "1/1" in the [PATCH] section.
> That's usually done to make sure patches are applied in the
> right order when sending a series, but since a series of 1
> is kinda hard to jumble.. ;-)

I thought that the patch (a single commit) didn't really warrant a patch
series - being a one liner - but I made the test 0 of 1 so that people
could see the test failure first before deciding whether my proposed
patch was good or not. Sorry for the confusion.

Charles.

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

* Re: [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives
  2008-09-18 20:01 ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives Charles Bailey
  2008-09-18 20:08   ` Charles Bailey
  2008-09-18 20:21   ` Andreas Ericsson
@ 2008-09-18 20:41   ` René Scharfe
  2 siblings, 0 replies; 6+ messages in thread
From: René Scharfe @ 2008-09-18 20:41 UTC (permalink / raw)
  To: Charles Bailey; +Cc: git, Junio C Hamano

Charles Bailey schrieb:
> There is currently no call to git_config at the start of cmd_archive.
> When creating tar archives the core config is read as a side-effect of
> reading the tar specific config, but this doesn't happen for zip
> archives.
> 
> The consequence is that in a configuration with core.autocrlf set,
> although files in a tar archive are created with crlf line endings,
> files in a zip archive retain unix line endings.

The patches look good, but it took me a while to realize that there are
two of them (0/1 and 1/1). :)

Thanks,
René

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

* Re: [PATCH 1/1] Make git archive respect core.autocrlf when creating ...
  2008-09-18 20:29     ` [PATCH 1/1] Make git archive respect core.autocrlf when creating Charles Bailey
@ 2008-09-18 20:53       ` Sverre Rabbelier
  0 siblings, 0 replies; 6+ messages in thread
From: Sverre Rabbelier @ 2008-09-18 20:53 UTC (permalink / raw)
  To: Charles Bailey; +Cc: Andreas Ericsson, git, Junio C Hamano

On Thu, Sep 18, 2008 at 22:29, Charles Bailey <charles@hashpling.org> wrote:
> I thought that the patch (a single commit) didn't really warrant a patch
> series - being a one liner - but I made the test 0 of 1 so that people
> could see the test failure first before deciding whether my proposed
> patch was good or not. Sorry for the confusion.

Shouldn't the tests be part of the patch? ;) To prevent it from being
broken again that is.

-- 
Cheers,

Sverre Rabbelier

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

end of thread, other threads:[~2008-09-18 20:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1a7cc4db062b7df0dae0f27b29dba66c9d917e59.1221767629.git.charles@hashpling.org>
2008-09-18 20:01 ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives Charles Bailey
2008-09-18 20:08   ` Charles Bailey
2008-09-18 20:21   ` Andreas Ericsson
2008-09-18 20:29     ` [PATCH 1/1] Make git archive respect core.autocrlf when creating Charles Bailey
2008-09-18 20:53       ` Sverre Rabbelier
2008-09-18 20:41   ` [PATCH 1/1] Make git archive respect core.autocrlf when creating zip format archives René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox