Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Enforcing autocrlf=false

Thank you,

I can work with this.
However it would be nice to be able to set static options on the Repository class so that this setting can be applied before cloning a repository.
In my case I have to do a reset after cloning because cloning is done with autocrlf=true.

Git git = Git.cloneRepository()
    .setCloneAllBranches(true)
    .setURI(URI)
    .setDirectory(DIR)
    .setCredentialsProvider(CD)
    .call();
   
StoredConfig config = git.getRepository().getConfig();
config.setBoolean("core", null, "autocrlf", false);

git.reset()
.setMode(ResetType.HARD)
.call();

git.clean()
.setCleanDirectories(true)
.call();



Gabriel


On 5/6/2016 12:23 AM, Matthias Sohn wrote:
Get the repository's config and set the core.autocrlf option to false

StoredConfig config = Repository.getConfig();
config.setBoolean("core", null, "autocrlf", false);
config.save();

-Matthias

On Thu, May 5, 2016 at 4:45 PM, Gabriel Titerlea <gabriel_titerlea@xxxxxxx> wrote:
Hello,

I am using JGit in an environment where I cannot modify the global .gitconfig file.
(application is given to users who may or may not have git installed and may be on windows or linux).

I would like to set the core.autocrlf value to false programatically (overriding the value from the .gitconfig file).
Is that possible?

Thanks,
Gabriel

_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jgit-dev



Back to the top