On Wed, Mar 25, 2015 at 2:22 PM, Alexander Kuleshov <kuleshovmail@xxxxxxxxx> wrote: > For now we can clone repository with the `git clone` command and pass > -c/--config with configuration option to it and these configuration > options will be set in the clonned repository config. s/clonned/cloned/ > This patch provides the same functional, but for the `git init` command. s/functional/functionality/ > It allows to pass -c/--config option to the `git init` command and > given configuration option will be added to the newly created repository, > after it will be created. > > This option can be used multiply times. If given configuration option s/multiply/multiple/ > is the same that in the default config, given option will overwrite. > > Main purpose of this option is to get rid of the manual editing of > the config. > > Signed-off-by: Alexander Kuleshov <kuleshovmail@xxxxxxxxx> > --- > diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt > index 8174d27..3ecbf2a 100644 > --- a/Documentation/git-init.txt > +++ b/Documentation/git-init.txt > @@ -111,6 +111,15 @@ into it. > If you provide a 'directory', the command is run inside it. If this directory > does not exist, it will be created. > > +--config <key>=<value>:: > +-c <key>=<value>:: > +Set a new configuration option in the new repository. The <key> expected in > +the same format as linkgit:git-config[1] (e.g., `core.eol=true`). If "If" what? > +This option can be used multiply times. If multiply options are given with s/multiply/multiple/g > +the same keys, each value will be written to the config. If given key is > +the same that used in the default configuration file, previous value > +will be overwritten. > diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index 7de8d85..8ce3537 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -339,4 +339,20 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' ' > test_path_is_dir realgitdir/refs > ' > > +test_expect_success 'git init -c key=value' ' > + rm -rf newdir realgitdir && > + git init -c core.foo=bar newdir && > + echo bar >expect && > + git --git-dir=newdir/.git config core.foo >actual && Maybe "git -C newdir ..." instead? > + test_cmp expect actual > +' > + > +test_expect_success 'git init -c key=value override default value' ' > + rm -rf newdir && > + git init -c core.filemode=false newdir && > + echo false >expect && > + git --git-dir=newdir/.git config core.filemode >actual && > + test_cmp expect actual git-init automatically detects an appropriate value for core.filemode, so this test may not be telling us anything useful on some platforms. > +' > + > test_done > -- > 2.3.3.611.g09038fc.dirty -- 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