{"id":34,"date":"2006-05-17T19:59:09","date_gmt":"2006-05-17T13:46:24","guid":{"rendered":""},"modified":"2017-03-07T16:18:33","modified_gmt":"2017-03-07T16:18:33","slug":"random_git_stuff","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ferdy\/2006\/05\/17\/random_git_stuff\/","title":{"rendered":"Random Git Stuff"},"content":{"rendered":"<p>Switching between projects using different SCMs is painful sometimes, and I always fail to remember the branch I&#8217;m on in my Git repositories. I use some bashrc\/PS1 magic to show some SCM information in my PS1, I thought someone would find it useful: <a href=\"http:\/\/dev.gentoo.org\/~ferdy\/stuff\/bashrc-scm\">bashrc-scm<\/a>.<\/p>\n<p>Lately I&#8217;ve been working on <a href=\"http:\/\/dev.gentoo.org\/~yoswink\/repodoc\/\">RepoDoc<\/a> whenever I&#8217;ve found a bit of free time. We are using <a href=\"http:\/\/git.or.cz\/\">Git<\/a> as our SCM mainly because it is easy and very flexible and we can follow a pseudo-centralized workflow that probably only suits us \ud83d\ude42 We faced some problems with it but given the flexibility of Git, fixing them was really easy.<\/p>\n<p>We keep a <a href=\"http:\/\/gentoo-es.org\/~ferdy\/git\/?p=repodoc.git;a=summary\">central repository<\/a> with one branch per committer plus master. Those are the top-level branches, and not everybody can update every brach, so the traditional Unix filesystem permissions doesn&#8217;t solve our problem. Then we can create as many temporal branches as we want under the tmp\/ directory.<\/p>\n<p>Also, we decided to keep a &#8216;fast-forward only&#8217; policy on top-level branches, so everything has to be cooked in temporal branches first and then cleanly merged into top-level branches.<\/p>\n<p>To enforce both policies (permissions and &#8216;fast-forward only&#8217;) we call a script from the update hook who does all the magic: <a href=\"http:\/\/dev.gentoo.org\/~ferdy\/stuff\/enforce-perms\">http:\/\/dev.gentoo.org\/~ferdy\/stuff\/enforce-perms<\/a>. The <tt>users-allowed<\/tt> file is something like:<\/p>\n<pre>refs\/heads\/master$  alice bob\r\nrefs\/heads\/alice$   alice\r\nrefs\/heads\/bob$     bob\r\nrefs\/heads\/eve$     eve\r\nrefs\/heads\/tmp\/     ^\r\nrefs\/tags\/          alice<\/pre>\n<p>Today I also decided to hack a CIA bot to send repodoc stats. It was fairly easy since the ciabot.pl included in Cogito did almost everything I wanted. However, being a perl-ignorant I rewrote the whole thing in bash to suit my needs, grab it from <a href=\"http:\/\/dev.gentoo.org\/~ferdy\/stuff\/ciabot.bash\">http:\/\/dev.gentoo.org\/~ferdy\/stuff\/ciabot.bash<\/a>.<\/p>\n<p>For those with the ability to read or understand some Spanish I wrote a little introduction to Git: http:\/\/dev.gentoo.org\/~ferdy\/git-intro\/<\/p>\n<p>I have also been trying to import the gentoo-x86 module into Git without much luck, both parsecvs and git-cvsimport failed, I&#8217;ll probably try Tailor later. I haven&#8217;t payed much attention to it anyway, since I&#8217;m a bit busy with university stuff. I guess I should seek help in the Git mailing list once I take it seriously.<\/p>\n<p>Oh, and by the way, there is a new Git version in the tree. Go grab it!<\/p>\n<p>&#8211; ferdy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Switching between projects using different SCMs is painful sometimes, and I always fail to remember the branch I&#8217;m on in my Git repositories. I use some bashrc\/PS1 magic to show some SCM information in my PS1, I thought someone would find it useful: bashrc-scm. Lately I&#8217;ve been working on RepoDoc whenever I&#8217;ve found a bit &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ferdy\/2006\/05\/17\/random_git_stuff\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Random Git Stuff<\/span><\/a><\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/34"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/34\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}