From 85fc7669254d7a3f1048eaa2921e8867ffd886ba Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Mon, 7 Jun 2021 13:04:07 +0200 Subject: [PATCH] git: update config and add defaults for merging and rebasing --- group_vars/git.yml | 65 ++++++++++++++++---------------- roles/git/defaults/main.yml | 8 ++++ roles/git/templates/gitconfig.j2 | 43 ++++++++++++++------- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/group_vars/git.yml b/group_vars/git.yml index 1dee6ba..5cbeab5 100644 --- a/group_vars/git.yml +++ b/group_vars/git.yml @@ -1,33 +1,34 @@ $ANSIBLE_VAULT;1.1;AES256 -32386666323431653636393561303562643033346535393363653032363062656533373731656661 -6566616235363731313062316162323331336131663438370a346632343238643531656564323664 -66323531383535383365323638646562633835306461393534303639353761373637386136363937 -3535333462313430660a663638616230356261326532626332663336346237643033373639353864 -62636434313332333338343064373437323562316162306264356136393637653335663534363463 -31383035303861366336326235613330643762373031656636616431303135313762376231636338 -30663432656335646333363337396332643638353533366363326430363131346239343061383466 -36313735656139373262616239366162306361353365343833376563323239363462396231653530 -63633861306335386335613433616461646135396634323036343230363465356438313131333966 -37376463396661376436653634383837653464623032373331643738663264613066383933643032 -31666431376337383437636230366330383435663938346433633366316236626135663735323330 -64306362336232356435343438656566393263326464663033383230306263623338656134383935 -65623065313131663966383765623631393065343530653964303061663138313865613866306262 -65356336373965343263313864376437336563653433666531656262383535323639356332356664 -39396166663639653666323732393939623865643863333837613238343932643466613235336534 -30346639323664366236343337326139383364643962316564613563313535636639346437386431 -34316364346538643937643535363763653661313036643038366132353731393664646237386561 -63613363653134363735656265666462633665653535303130303964306138333433343263376631 -32653665343466656266373764613335393937383266393636613764383264663865333137366563 -65346130656432643933383135343537643764613764333932633261323233353363303362653832 -62313130633339323466356631666137643634383937373635373237346465613639396530353636 -65393365346637313362343965383863333932303866353865373930323836626639313638346364 -35326164333434616136343731623662633365313366343033313037636332656632633163656130 -61333163353739366138343136316432313539633261616364393862633738343333383166666333 -62633035643530383331316230396137643033333563363937393161343139306662353535623064 -65393635623538326432313634393036306461303130386136333338616565626164323936343236 -30656236646464326337396465363430623162646566353633666461623864386331396236656537 -32336632393932353832613963636561306466336235303733333736353566643663366437633135 -36303932653731346634653530353861626132353832393137326333346465373538366664353362 -63353831623633323936383166643032356638316262386463343139333766326261666636303365 -64323037613536393638653636613464353037366437653963643165383037666663623735626163 -34356162333239623066 +64363730336134663064313633316132396335613761386239613966313864656565376230323338 +3863396633383931393031643837323037356332326664630a393662323135643562643230363437 +31343065363266353662643365303663633131393037353130316638623035356138383164346166 +6234323936383061340a366634373336333363656463656433333139333362393530363131623535 +32396534633831343632323263336565353836343035396138353132356464383763396535393337 +64353137653266653262643164613534333865666336663561376462346663663934376466343261 +64656535343937643031616663666566626265313661623034386163336232336538663365626566 +32346463363333616261643364363263363163316431623364383333353364363836613062373537 +64636337343466643333666465643162323266353663366662313639623638393961333230373838 +63363633383134623931373062396665353161636435343463646536663962333232656264306331 +37323564306135363064363663656239313165326331303865643338333463303935356436626262 +38353738366632663839626166303964396535333639646162666435363630633132646531313930 +36343439373230616433623539393938326562343465633763363865323262323366316135393339 +62616132333063643433353039353765663736633334613138363936306336303962643339313163 +35646562663861613966346437666534313839373436376666313433353338653333643263373331 +32306136333564343831343439346466626135313835346433666337653435313833383033633665 +64613430383666653036393938643734613330623066333866643965343863636166363063306534 +39343163366161373862383466313830646336333731333438663465336339313865306438353262 +37363538383132373933313566366265616538356636633636343633343830363739383237316632 +33616636666464366462613866383837323736353931623463323565356431346166393066326263 +31623561323538373437366164376464663639633932383035346165353462303264373433393231 +62353866616532313236363337306466626536306666333232613065373066663762663739633831 +39316635663761663934323733656666396661653462383665336631373537356533383332323533 +38633465326566663331383564643066366235613337356531396530323937323138313966393635 +62353365383839383762303034633562353130353434656232636539313165346134373231316333 +62656534386439623435353264313134623035303366313763316164656336346436353130363834 +36306662633139663538383238646561346166353737636163323965663030373232613564393335 +39353632333139336132636536326538353033373736643132346635613666346635616637386539 +38643031626439373830316230643331303037313363633661333539383166356137333665623336 +64376334353837353262373461663666646630323366356538313138363038626635353231626164 +64346437383261643638306566356262383534646163343164333838373738303535623535323666 +35623861663933613366306131656231353833643234373933316262633338666236386662636135 +3563 diff --git a/roles/git/defaults/main.yml b/roles/git/defaults/main.yml index 1fb408f..7b61b90 100644 --- a/roles/git/defaults/main.yml +++ b/roles/git/defaults/main.yml @@ -4,7 +4,13 @@ git_user: your-username git_email: your-email@example.com git_signkey: git_signingkey: + git_do_sign: false +git_merge_autostash: true +git_rebase_autostash: true +git_pull_rebase: true +git_pull_ff_only: true +git_default_branch: main git_user_home: "/home/{{ git_system_user }}" git_system_user: "{{ git_user }}" @@ -15,3 +21,5 @@ git_gpg_program: ~ git_aliases: [] git_credentials: [] + +git_config_preferred_editor: vim diff --git a/roles/git/templates/gitconfig.j2 b/roles/git/templates/gitconfig.j2 index b7aede9..053c2bb 100644 --- a/roles/git/templates/gitconfig.j2 +++ b/roles/git/templates/gitconfig.j2 @@ -1,30 +1,45 @@ -# This is Git's per-user configuration file. -[user] -# Please adapt and uncomment the following lines: - name = {{ git_user }} - email = {{ git_email }} -{% if git_do_sign %} - signkey = {{ git_signkey }} - signingkey = {{ git_signingkey }} -{% endif %} - +# This is Git's per-user configuration file, +# this file is managed by ansible. {% if git_do_sign %} [gpg] program = {{ git_gpg_program }} - {% endif %} -[commit] +[user] + name = "{{ git_author }}" + email = {{ git_email }} +{% if git_do_sign %} + signingkey = {{ git_signingkey }} +{% endif %} + +[commit] {% if git_do_sign %} gpgsign = true {% endif %} - [alias] {% for alias in git_aliases %} - {{ alias.name }} = {{ alias.cmd }} + {{ alias.name }} = {{ alias.cmd }} {% endfor %} +[pull] + rebase = {{ git_pull_rebase|bool|lower }} +{% if git_pull_ff_only|bool %} + ff = only +{% endif %} + +[rebase] + autostash = {{ git_rebase_autostash|bool|lower }} + +[merge] + autostash = {{ git_merge_autostash|bool|lower }} + +[init] + defaultBranch = {{ git_default_branch }} + +[core] + editor = {{ git_config_preferred_editor }} + {% for cred in git_credentials %} [credential "{{ cred.remote_url }}"] username = {{ cred.username }}