git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Quick question: end of lines
@ 2006-02-28 18:32 Emmanuel Guerin
  2006-02-28 20:07 ` Johannes Schindelin
  2006-02-28 20:15 ` Martin Langhoff
  0 siblings, 2 replies; 6+ messages in thread
From: Emmanuel Guerin @ 2006-02-28 18:32 UTC (permalink / raw
  To: git

Hi all,

I  began recently to use git, and there is one thing I still do not
know how to do.

Is it possible to checkout sources out of the GIT repository with
Windows style end of lines?
In a manner much like the one Subversion is using?

To be more precise, I need to be able to checkout files on Unix and
Windows, and it is important that the end of lines are set
accordingly.

Thanks for any hints or pointers,

Regards,

Manu

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

* Re: Quick question: end of lines
  2006-02-28 18:32 Quick question: end of lines Emmanuel Guerin
@ 2006-02-28 20:07 ` Johannes Schindelin
  2006-02-28 20:15 ` Martin Langhoff
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2006-02-28 20:07 UTC (permalink / raw
  To: Emmanuel Guerin; +Cc: git

Hi,

On Tue, 28 Feb 2006, Emmanuel Guerin wrote:

> Is it possible to checkout sources out of the GIT repository with
> Windows style end of lines?

No.

As far as git is concerned, every versioned file is equal. IMHO this 
decision is good, since

- different handling is more complicated (you have to keep track of the 
file type), and
- it is not really worth doing.

Windows can handle Unix line endings quite properly (with the notable 
exception of notepad.exe), and even Apple has learnt that it might be a 
stupid idea to insist on being different when it's just not worth it.

The only reason I would accept: you have to work with MS-DOS tools. But 
even in this case, I'd rather write a wrapper which converts to DOS line 
endings, executes the tool, and converts back.

Hth,
Dscho

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

* Re: Quick question: end of lines
  2006-02-28 18:32 Quick question: end of lines Emmanuel Guerin
  2006-02-28 20:07 ` Johannes Schindelin
@ 2006-02-28 20:15 ` Martin Langhoff
  2006-03-01  0:12   ` Emmanuel Guerin
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Langhoff @ 2006-02-28 20:15 UTC (permalink / raw
  To: Emmanuel Guerin; +Cc: git

On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:
> To be more precise, I need to be able to checkout files on Unix and
> Windows, and it is important that the end of lines are set
> accordingly.

Why is this important?

(I am thinking: any reasonably good text editor will know how to deal
with unix newlines, but you may have different reasons).


martin

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

* Re: Quick question: end of lines
  2006-02-28 20:15 ` Martin Langhoff
@ 2006-03-01  0:12   ` Emmanuel Guerin
  2006-03-01  8:31     ` Martin Langhoff
  0 siblings, 1 reply; 6+ messages in thread
From: Emmanuel Guerin @ 2006-03-01  0:12 UTC (permalink / raw
  To: git

2006/3/1, Martin Langhoff <martin.langhoff@gmail.com>:
> Why is this important?
>
> (I am thinking: any reasonably good text editor will know how to deal
> with unix newlines, but you may have different reasons).

Actually, you have found the problem. My particular setup is that
Visual Studio is used on Windows. The editor will handle unix end of
lines all right, but tends to insert windows ones when modifications
are made. This leads to files with inconsistent end of lines, and
nightmares with merges. We use Subversion for the moment, and we have
to make sure that all text files are declared properly in svn to avoid
conflicts.

What I begin to realize is that the only possibility probably lies in
using a tool that converts the modified files "on the fly" before
commits. I just want to make sure that no other solution was found by
others facing a similar problem.

Anyway, thanks for the answers,

Emmanuel

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

* Re: Quick question: end of lines
  2006-03-01  0:12   ` Emmanuel Guerin
@ 2006-03-01  8:31     ` Martin Langhoff
  2006-03-01  9:01       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Langhoff @ 2006-03-01  8:31 UTC (permalink / raw
  To: Emmanuel Guerin; +Cc: git

On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:
> What I begin to realize is that the only possibility probably lies in
> using a tool that converts the modified files "on the fly" before
> commits. I just want to make sure that no other solution was found by
> others facing a similar problem.

Perhaps a pre-commit hook? Read the documentation (and search the list
archives). I'm pretty sure you can do newline cleanup before commit or
at least newline checks before commits.

There's always the option of filing a bug in MS's bugzilla ;-)

cheers,


martin

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

* Re: Quick question: end of lines
  2006-03-01  8:31     ` Martin Langhoff
@ 2006-03-01  9:01       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-03-01  9:01 UTC (permalink / raw
  To: Emmanuel Guerin; +Cc: git, Martin Langhoff

"Martin Langhoff" <martin.langhoff@gmail.com> writes:

> On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:
>> What I begin to realize is that the only possibility probably lies in
>> using a tool that converts the modified files "on the fly" before
>> commits. I just want to make sure that no other solution was found by
>> others facing a similar problem.
>
> Perhaps a pre-commit hook? Read the documentation (and search the list
> archives). I'm pretty sure you can do newline cleanup before commit or
> at least newline checks before commits.
>
> There's always the option of filing a bug in MS's bugzilla ;-)

You can use .git/hooks/pre-commit hook in the repository the
editor that munges line-termination, to fix things up.

The hook is called with GIT_INDEX_FILE set to the appropriate
index file, so you could "git-diff-index --cached --name-only
HEAD" to obtain the list of files being committed, sanitize the
working tree files and update-index them again before returning
true from the hook.

This is a silly example to standardize on uppercase.

        git-diff-index --cached --name-only HEAD |
        xargs sh -c '
                while case "$#" in 0) break ;; esac
                do
                        perl -p -i -e "\$_ = uc(\$_)" "$1"
                        git-update-index "$1"
                        shift
                done
        ' dummy
        exit 0

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

end of thread, other threads:[~2006-03-01  9:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-28 18:32 Quick question: end of lines Emmanuel Guerin
2006-02-28 20:07 ` Johannes Schindelin
2006-02-28 20:15 ` Martin Langhoff
2006-03-01  0:12   ` Emmanuel Guerin
2006-03-01  8:31     ` Martin Langhoff
2006-03-01  9:01       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).