Re: CRLF problems with Git on Win32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 07, 2008 at 10:57:52AM +0100, Steffen Prohaska wrote:

> or you can manually do what clone would do for you, i.e.
>
>     mkdir turqstat
>     cd turqstat
>     git init
>     git config core.autocrlf true
>     git remote add origin git://git.debian.org/git/turqstat/turqstat.git
>     git fetch origin
>     git checkout -b master origin/master
>
> (this is what I typically do).
>
> BTW, I think that git clone should be improved to avoid the
> workaround described above.  Maybe it could ask the user if it
> should set up a specific line ending conversion before checkout.
> Unfortunately, I had no time to write a patch, yet.

I don't know if there are other options that might impact how clone
works, but something like the patch below might make sense. It would
allow:

  git clone -c core.autocrlf=true ...

Note that the patch should not be applied; it doesn't handle values with
whitespace (and hopefully builtin clone will come soon after v1.5.4,
which would make doing it right much simpler).

---

diff --git a/git-clone.sh b/git-clone.sh
index b4e858c..a002550 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -23,6 +23,7 @@ reference=           reference repository
 o,origin=            use <name> instead of 'origin' to track upstream
 u,upload-pack=       path to git-upload-pack on the remote
 depth=               create a shallow clone of that depth
+c,config=            set a config option of the form key=value
 
 use-separate-remote  compatibility, do not use
 no-separate-remote   compatibility, do not use"
@@ -127,6 +128,7 @@ use_separate_remote=t
 depth=
 no_progress=
 local_explicitly_asked_for=
+config=
 test -t 1 || no_progress=--no-progress
 
 while test $# != 0
@@ -173,6 +175,9 @@ do
 	--depth)
 		shift
 		depth="--depth=$1" ;;
+	-c|--config)
+		shift
+		config="$config $1" ;;
 	--)
 		shift
 		break ;;
@@ -242,6 +247,12 @@ fi &&
 export GIT_DIR &&
 GIT_CONFIG="$GIT_DIR/config" git-init $quiet ${template+"$template"} || usage
 
+for i in $config; do
+	key=`echo $i | cut -d= -f1`
+	value=`echo $i | cut -d= -f2-`
+	git config $key $value
+done
+
 if test -n "$bare"
 then
 	GIT_CONFIG="$GIT_DIR/config" git config core.bare true

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux