blob: 81d2b80abb11a900f716d1997d8c9cc827fafc2f [file] [log] [blame]
Junio C Hamanoe0238c22012-02-23 22:45:501<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamanoe0238c22012-02-23 22:45:507<title>config API</title>
8<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamanoe0238c22012-02-23 22:45:5024}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
30a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
37
38em {
39 font-style: italic;
40 color: navy;
41}
42
43strong {
44 font-weight: bold;
45 color: #083194;
46}
47
Junio C Hamanoe0238c22012-02-23 22:45:5048h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamanoe0238c22012-02-23 22:45:5050 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
55h1, h2, h3 {
56 border-bottom: 2px solid silver;
57}
58h2 {
59 padding-top: 0.5em;
60}
61h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamanoe0238c22012-02-23 22:45:5070
71div.sectionbody {
Junio C Hamanoe0238c22012-02-23 22:45:5072 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
84ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamanoe0238c22012-02-23 22:45:5089
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamanoe0238c22012-02-23 22:45:5094 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamanoe0238c22012-02-23 22:45:50100
Junio C Hamano9d971152012-12-19 00:43:11101#author {
Junio C Hamanoe0238c22012-02-23 22:45:50102 color: #527bbd;
Junio C Hamanoe0238c22012-02-23 22:45:50103 font-weight: bold;
104 font-size: 1.1em;
105}
Junio C Hamano9d971152012-12-19 00:43:11106#email {
Junio C Hamanoe0238c22012-02-23 22:45:50107}
Junio C Hamano9d971152012-12-19 00:43:11108#revnumber, #revdate, #revremark {
Junio C Hamanoe0238c22012-02-23 22:45:50109}
110
Junio C Hamano9d971152012-12-19 00:43:11111#footer {
Junio C Hamanoe0238c22012-02-23 22:45:50112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9d971152012-12-19 00:43:11117#footer-text {
Junio C Hamanoe0238c22012-02-23 22:45:50118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9d971152012-12-19 00:43:11121#footer-badges {
Junio C Hamanoe0238c22012-02-23 22:45:50122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9d971152012-12-19 00:43:11126#preamble {
Junio C Hamanoe0238c22012-02-23 22:45:50127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9d971152012-12-19 00:43:11130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamanoe0238c22012-02-23 22:45:50131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
133 margin-top: 1.0em;
134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
149 color: #527bbd;
Junio C Hamanoe0238c22012-02-23 22:45:50150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamanoe0238c22012-02-23 22:45:50173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamanoe0238c22012-02-23 22:45:50180 padding: 0.5em;
181}
182
183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
186 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamanoe0238c22012-02-23 22:45:50189}
190
191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
193 text-align: right;
194}
195
Junio C Hamano9d971152012-12-19 00:43:11196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamanoe0238c22012-02-23 22:45:50199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
205div.verseblock + div.attribution {
206 text-align: left;
207}
208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
219 border-left: 3px solid #dddddd;
220}
221
222div.exampleblock > div.content {
223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
225}
226
227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamanoe0238c22012-02-23 22:45:50229a.image:visited { color: white; }
230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
238 font-style: normal;
239 color: navy;
240}
241dd > *:first-child {
242 margin-top: 0.1em;
243}
244
245ul, ol {
246 list-style-position: outside;
247}
248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
252 list-style-type: lower-alpha;
253}
254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
270
Junio C Hamanoe0238c22012-02-23 22:45:50271tfoot {
272 font-weight: bold;
273}
274td > div.verse {
275 white-space: pre;
276}
Junio C Hamanoe0238c22012-02-23 22:45:50277
278div.hdlist {
279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
282div.hdlist tr {
283 padding-bottom: 15px;
284}
285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
289 vertical-align: top;
290 font-style: normal;
291 padding-right: 0.8em;
292 color: navy;
293}
294td.hdlist2 {
295 vertical-align: top;
296}
297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
305
306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9d971152012-12-19 00:43:11333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamanoe0238c22012-02-23 22:45:50340}
341
Junio C Hamano9d971152012-12-19 00:43:11342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamanoe0238c22012-02-23 22:45:50347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9d971152012-12-19 00:43:11350#toctitle {
Junio C Hamanoe0238c22012-02-23 22:45:50351 color: #527bbd;
Junio C Hamanoe0238c22012-02-23 22:45:50352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoe0238c22012-02-23 22:45:50359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamanoe0238c22012-02-23 22:45:50374
Junio C Hamano9d971152012-12-19 00:43:11375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9d971152012-12-19 00:43:11418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
Junio C Hamanoe0238c22012-02-23 22:45:50427}
Junio C Hamano9d971152012-12-19 00:43:11428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
Junio C Hamanoe0238c22012-02-23 22:45:50432 font-weight: bold;
Junio C Hamano9d971152012-12-19 00:43:11433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
Junio C Hamanoe0238c22012-02-23 22:45:50449}
450
Junio C Hamano9d971152012-12-19 00:43:11451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
Junio C Hamanoe0238c22012-02-23 22:45:50480}
481
Junio C Hamano9d971152012-12-19 00:43:11482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
Junio C Hamanoe0238c22012-02-23 22:45:50501 text-align: right;
502}
503
Junio C Hamano9d971152012-12-19 00:43:11504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
Junio C Hamanoe0238c22012-02-23 22:45:50506}
Junio C Hamano9d971152012-12-19 00:43:11507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
Junio C Hamanoe0238c22012-02-23 22:45:50512}
513
Junio C Hamano9d971152012-12-19 00:43:11514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
526body.manpage h2 {
527 border-style: none;
528}
529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamanoe0238c22012-02-23 22:45:50531}
532
Junio C Hamano9d971152012-12-19 00:43:11533@media print {
534 body.manpage div#toc { display: none; }
535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamanoe0238c22012-02-23 22:45:50538</style>
539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamanoe0238c22012-02-23 22:45:50541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamanoe0238c22012-02-23 22:45:50583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamanoe0238c22012-02-23 22:45:50621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamanoe0238c22012-02-23 22:45:50650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamanoe0238c22012-02-23 22:45:50666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9d971152012-12-19 00:43:11672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamanoe0238c22012-02-23 22:45:50682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamanoe0238c22012-02-23 22:45:50686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9d971152012-12-19 00:43:11705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamanoe0238c22012-02-23 22:45:50727}
728
729}
Junio C Hamano9d971152012-12-19 00:43:11730asciidoc.install();
Junio C Hamanoe0238c22012-02-23 22:45:50731/*]]>*/
732</script>
733</head>
Junio C Hamano9d971152012-12-19 00:43:11734<body class="article">
Junio C Hamanoe0238c22012-02-23 22:45:50735<div id="header">
736<h1>config API</h1>
737</div>
738<div id="content">
739<div id="preamble">
740<div class="sectionbody">
Junio C Hamano076ffcc2013-02-06 05:13:21741<div class="paragraph"><p>The config API gives callers a way to access Git configuration files
Junio C Hamano719b8a32012-06-08 18:40:53742(and files which have the same syntax). See <a href="../git-config.html">git-config(1)</a> for a
Junio C Hamanoe0238c22012-02-23 22:45:50743discussion of the config file syntax.</p></div>
744</div>
745</div>
Junio C Hamano9d971152012-12-19 00:43:11746<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:50747<h2 id="_general_usage">General Usage</h2>
748<div class="sectionbody">
749<div class="paragraph"><p>Config files are parsed linearly, and each variable found is passed to a
750caller-provided callback function. The callback function is responsible
751for any actions to be taken on the config option, and is free to ignore
752some options. It is not uncommon for the configuration to be parsed
Junio C Hamano076ffcc2013-02-06 05:13:21753several times during the run of a Git program, with different callbacks
Junio C Hamanoe0238c22012-02-23 22:45:50754picking out different variables useful to themselves.</p></div>
755<div class="paragraph"><p>A config callback function takes three parameters:</p></div>
756<div class="ulist"><ul>
757<li>
758<p>
759the name of the parsed variable. This is in canonical "flat" form: the
760 section, subsection, and variable segments will be separated by dots,
761 and the section and variable segments will be all lowercase. E.g.,
Junio C Hamanoc14e6ad2014-10-31 20:25:53762 <code>core.ignorecase</code>, <code>diff.SomeType.textconv</code>.
Junio C Hamanoe0238c22012-02-23 22:45:50763</p>
764</li>
765<li>
766<p>
767the value of the found variable, as a string. If the variable had no
768 value specified, the value will be NULL (typically this means it
769 should be interpreted as boolean true).
770</p>
771</li>
772<li>
773<p>
774a void pointer passed in by the caller of the config API; this can
775 contain callback-specific data
776</p>
777</li>
778</ul></div>
779<div class="paragraph"><p>A config callback should return 0 for success, or -1 if the variable
780could not be parsed properly.</p></div>
781</div>
Junio C Hamano9d971152012-12-19 00:43:11782</div>
783<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:50784<h2 id="_basic_config_querying">Basic Config Querying</h2>
785<div class="sectionbody">
786<div class="paragraph"><p>Most programs will simply want to look up variables in all config files
Junio C Hamano076ffcc2013-02-06 05:13:21787that Git knows about, using the normal precedence rules. To do this,
Junio C Hamanoc14e6ad2014-10-31 20:25:53788call <code>git_config</code> with a callback function and void data pointer.</p></div>
789<div class="paragraph"><p><code>git_config</code> will read all config sources in order of increasing
Junio C Hamanoe0238c22012-02-23 22:45:50790priority. Thus a callback should typically overwrite previously-seen
Junio C Hamanoc14e6ad2014-10-31 20:25:53791entries with new ones (e.g., if both the user-wide <code>~/.gitconfig</code> and
792repo-specific <code>.git/config</code> contain <code>color.ui</code>, the config machinery
Junio C Hamanoe0238c22012-02-23 22:45:50793will first feed the user-wide one to the callback, and then the
794repo-specific one; by overwriting, the higher-priority repo-specific
795value is left at the end).</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53796<div class="paragraph"><p>The <code>git_config_with_options</code> function lets the caller examine config
797while adjusting some of the default behavior of <code>git_config</code>. It should
Junio C Hamano076ffcc2013-02-06 05:13:21798almost never be used by "regular" Git code that is looking up
Junio C Hamanoe0238c22012-02-23 22:45:50799configuration variables. It is intended for advanced callers like
Junio C Hamanoc14e6ad2014-10-31 20:25:53800<code>git-config</code>, which are intentionally tweaking the normal config-lookup
Junio C Hamanoe0238c22012-02-23 22:45:50801process. It takes two extra parameters:</p></div>
802<div class="dlist"><dl>
803<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53804<code>filename</code>
Junio C Hamanoe0238c22012-02-23 22:45:50805</dt>
806<dd>
807<p>
808If this parameter is non-NULL, it specifies the name of a file to
809parse for configuration, rather than looking in the usual files. Regular
Junio C Hamanoc14e6ad2014-10-31 20:25:53810<code>git_config</code> defaults to <code>NULL</code>.
Junio C Hamanoe0238c22012-02-23 22:45:50811</p>
812</dd>
813<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53814<code>respect_includes</code>
Junio C Hamanoe0238c22012-02-23 22:45:50815</dt>
816<dd>
817<p>
818Specify whether include directives should be followed in parsed files.
Junio C Hamanoc14e6ad2014-10-31 20:25:53819Regular <code>git_config</code> defaults to <code>1</code>.
Junio C Hamanoe0238c22012-02-23 22:45:50820</p>
821</dd>
822</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53823<div class="paragraph"><p>There is a special version of <code>git_config</code> called <code>git_config_early</code>.
Junio C Hamanoe0238c22012-02-23 22:45:50824This version takes an additional parameter to specify the repository
Junio C Hamanoc14e6ad2014-10-31 20:25:53825config, instead of having it looked up via <code>git_path</code>. This is useful
Junio C Hamano076ffcc2013-02-06 05:13:21826early in a Git program before the repository has been found. Unless
Junio C Hamanoe0238c22012-02-23 22:45:50827you&#8217;re working with early setup code, you probably don&#8217;t want to use
828this.</p></div>
829</div>
Junio C Hamano9d971152012-12-19 00:43:11830</div>
831<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:50832<h2 id="_reading_specific_files">Reading Specific Files</h2>
833<div class="sectionbody">
834<div class="paragraph"><p>To read a specific file in git-config format, use
Junio C Hamanoc14e6ad2014-10-31 20:25:53835<code>git_config_from_file</code>. This takes the same callback and data parameters
836as <code>git_config</code>.</p></div>
Junio C Hamanoe0238c22012-02-23 22:45:50837</div>
Junio C Hamano9d971152012-12-19 00:43:11838</div>
839<div class="sect1">
Junio C Hamano8a1433a2014-09-02 21:46:24840<h2 id="_querying_for_specific_variables">Querying For Specific Variables</h2>
841<div class="sectionbody">
842<div class="paragraph"><p>For programs wanting to query for specific variables in a non-callback
Junio C Hamanoc14e6ad2014-10-31 20:25:53843manner, the config API provides two functions <code>git_config_get_value</code>
844and <code>git_config_get_value_multi</code>. They both read values from an internal
Junio C Hamano8a1433a2014-09-02 21:46:24845cache generated previously from reading the config files.</p></div>
846<div class="dlist"><dl>
847<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53848<code>int git_config_get_value(const char *key, const char **value)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24849</dt>
850<dd>
851<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53852 Finds the highest-priority value for the configuration variable <code>key</code>,
853 stores the pointer to it in <code>value</code> and returns 0. When the
854 configuration variable <code>key</code> is not found, returns 1 without touching
855 <code>value</code>. The caller should not free or modify <code>value</code>, as it is owned
Junio C Hamano8a1433a2014-09-02 21:46:24856 by the cache.
857</p>
858</dd>
859<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53860<code>const struct string_list *git_config_get_value_multi(const char *key)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24861</dt>
862<dd>
863<p>
864 Finds and returns the value list, sorted in order of increasing priority
Junio C Hamanoc14e6ad2014-10-31 20:25:53865 for the configuration variable <code>key</code>. When the configuration variable
866 <code>key</code> is not found, returns NULL. The caller should not free or modify
Junio C Hamano8a1433a2014-09-02 21:46:24867 the returned pointer, as it is owned by the cache.
868</p>
869</dd>
870<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53871<code>void git_config_clear(void)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24872</dt>
873<dd>
874<p>
875 Resets and invalidates the config cache.
876</p>
877</dd>
878</dl></div>
879<div class="paragraph"><p>The config API also provides type specific API functions which do conversion
880as well as retrieval for the queried variable, including:</p></div>
881<div class="dlist"><dl>
882<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53883<code>int git_config_get_int(const char *key, int *dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24884</dt>
885<dd>
886<p>
887 Finds and parses the value to an integer for the configuration variable
Junio C Hamanoc14e6ad2014-10-31 20:25:53888 <code>key</code>. Dies on error; otherwise, stores the value of the parsed integer in
889 <code>dest</code> and returns 0. When the configuration variable <code>key</code> is not found,
890 returns 1 without touching <code>dest</code>.
Junio C Hamano8a1433a2014-09-02 21:46:24891</p>
892</dd>
893<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53894<code>int git_config_get_ulong(const char *key, unsigned long *dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24895</dt>
896<dd>
897<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53898 Similar to <code>git_config_get_int</code> but for unsigned longs.
Junio C Hamano8a1433a2014-09-02 21:46:24899</p>
900</dd>
901<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53902<code>int git_config_get_bool(const char *key, int *dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24903</dt>
904<dd>
905<p>
906 Finds and parses the value into a boolean value, for the configuration
Junio C Hamanoc14e6ad2014-10-31 20:25:53907 variable <code>key</code> respecting keywords like "true" and "false". Integer
Junio C Hamano8a1433a2014-09-02 21:46:24908 values are converted into true/false values (when they are non-zero or
909 zero, respectively). Other values cause a die(). If parsing is successful,
Junio C Hamanoc14e6ad2014-10-31 20:25:53910 stores the value of the parsed result in <code>dest</code> and returns 0. When the
911 configuration variable <code>key</code> is not found, returns 1 without touching
912 <code>dest</code>.
Junio C Hamano8a1433a2014-09-02 21:46:24913</p>
914</dd>
915<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53916<code>int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24917</dt>
918<dd>
919<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53920 Similar to <code>git_config_get_bool</code>, except that integers are copied as-is,
921 and <code>is_bool</code> flag is unset.
Junio C Hamano8a1433a2014-09-02 21:46:24922</p>
923</dd>
924<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53925<code>int git_config_get_maybe_bool(const char *key, int *dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24926</dt>
927<dd>
928<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53929 Similar to <code>git_config_get_bool</code>, except that it returns -1 on error
Junio C Hamano8a1433a2014-09-02 21:46:24930 rather than dying.
931</p>
932</dd>
933<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53934<code>int git_config_get_string_const(const char *key, const char **dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24935</dt>
936<dd>
937<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53938 Allocates and copies the retrieved string into the <code>dest</code> parameter for
939 the configuration variable <code>key</code>; if NULL string is given, prints an
940 error message and returns -1. When the configuration variable <code>key</code> is
941 not found, returns 1 without touching <code>dest</code>.
Junio C Hamano8a1433a2014-09-02 21:46:24942</p>
943</dd>
944<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53945<code>int git_config_get_string(const char *key, char **dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24946</dt>
947<dd>
948<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53949 Similar to <code>git_config_get_string_const</code>, except that retrieved value
950 copied into the <code>dest</code> parameter is a mutable string.
Junio C Hamano8a1433a2014-09-02 21:46:24951</p>
952</dd>
953<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53954<code>int git_config_get_pathname(const char *key, const char **dest)</code>
Junio C Hamano8a1433a2014-09-02 21:46:24955</dt>
956<dd>
957<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53958 Similar to <code>git_config_get_string</code>, but expands <code>~</code> or <code>~user</code> into
Junio C Hamano8a1433a2014-09-02 21:46:24959 the user&#8217;s home directory when found at the beginning of the path.
960</p>
961</dd>
Junio C Hamano8e61f1f2014-09-11 21:53:45962<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53963<code>git_die_config(const char *key, const char *err, ...)</code>
Junio C Hamano8e61f1f2014-09-11 21:53:45964</dt>
965<dd>
966<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53967 First prints the error message specified by the caller in <code>err</code> and then
Junio C Hamano8e61f1f2014-09-11 21:53:45968 dies printing the line number and the file name of the highest priority
Junio C Hamanoc14e6ad2014-10-31 20:25:53969 value for the configuration variable <code>key</code>.
Junio C Hamano8e61f1f2014-09-11 21:53:45970</p>
971</dd>
972<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53973<code>void git_die_config_linenr(const char *key, const char *filename, int linenr)</code>
Junio C Hamano8e61f1f2014-09-11 21:53:45974</dt>
975<dd>
976<p>
977 Helper function which formats the die error message according to the
Junio C Hamanoc14e6ad2014-10-31 20:25:53978 parameters entered. Used by <code>git_die_config()</code>. It can be used by callers
979 handling <code>git_config_get_value_multi()</code> to print the correct error message
Junio C Hamano8e61f1f2014-09-11 21:53:45980 for the desired value.
981</p>
982</dd>
Junio C Hamano8a1433a2014-09-02 21:46:24983</dl></div>
984<div class="paragraph"><p>See test-config.c for usage examples.</p></div>
985</div>
986</div>
987<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:50988<h2 id="_value_parsing_helpers">Value Parsing Helpers</h2>
989<div class="sectionbody">
990<div class="paragraph"><p>To aid in parsing string values, the config API provides callbacks with
991a number of helper functions, including:</p></div>
992<div class="dlist"><dl>
993<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53994<code>git_config_int</code>
Junio C Hamanoe0238c22012-02-23 22:45:50995</dt>
996<dd>
997<p>
998Parse the string to an integer, including unit factors. Dies on error;
999otherwise, returns the parsed result.
1000</p>
1001</dd>
1002<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531003<code>git_config_ulong</code>
Junio C Hamanoe0238c22012-02-23 22:45:501004</dt>
1005<dd>
1006<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531007Identical to <code>git_config_int</code>, but for unsigned longs.
Junio C Hamanoe0238c22012-02-23 22:45:501008</p>
1009</dd>
1010<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531011<code>git_config_bool</code>
Junio C Hamanoe0238c22012-02-23 22:45:501012</dt>
1013<dd>
1014<p>
1015Parse a string into a boolean value, respecting keywords like "true" and
1016"false". Integer values are converted into true/false values (when they
1017are non-zero or zero, respectively). Other values cause a die(). If
1018parsing is successful, the return value is the result.
1019</p>
1020</dd>
1021<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531022<code>git_config_bool_or_int</code>
Junio C Hamanoe0238c22012-02-23 22:45:501023</dt>
1024<dd>
1025<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531026Same as <code>git_config_bool</code>, except that integers are returned as-is, and
1027an <code>is_bool</code> flag is unset.
Junio C Hamanoe0238c22012-02-23 22:45:501028</p>
1029</dd>
1030<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531031<code>git_config_maybe_bool</code>
Junio C Hamanoe0238c22012-02-23 22:45:501032</dt>
1033<dd>
1034<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531035Same as <code>git_config_bool</code>, except that it returns -1 on error rather
Junio C Hamanoe0238c22012-02-23 22:45:501036than dying.
1037</p>
1038</dd>
1039<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531040<code>git_config_string</code>
Junio C Hamanoe0238c22012-02-23 22:45:501041</dt>
1042<dd>
1043<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531044Allocates and copies the value string into the <code>dest</code> parameter; if no
Junio C Hamanoe0238c22012-02-23 22:45:501045string is given, prints an error message and returns -1.
1046</p>
1047</dd>
1048<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531049<code>git_config_pathname</code>
Junio C Hamanoe0238c22012-02-23 22:45:501050</dt>
1051<dd>
1052<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531053Similar to <code>git_config_string</code>, but expands <code>~</code> or <code>~user</code> into the
Junio C Hamanoe0238c22012-02-23 22:45:501054user&#8217;s home directory when found at the beginning of the path.
1055</p>
1056</dd>
1057</dl></div>
1058</div>
Junio C Hamano9d971152012-12-19 00:43:111059</div>
1060<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:501061<h2 id="_include_directives">Include Directives</h2>
1062<div class="sectionbody">
1063<div class="paragraph"><p>By default, the config parser does not respect include directives.
Junio C Hamanoc14e6ad2014-10-31 20:25:531064However, a caller can use the special <code>git_config_include</code> wrapper
Junio C Hamanoe0238c22012-02-23 22:45:501065callback to support them. To do so, you simply wrap your "real" callback
Junio C Hamanoc14e6ad2014-10-31 20:25:531066function and data pointer in a <code>struct config_include_data</code>, and pass
Junio C Hamanoe0238c22012-02-23 22:45:501067the wrapper to the regular config-reading functions. For example:</p></div>
1068<div class="listingblock">
1069<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531070<pre><code>int read_file_with_include(const char *file, config_fn_t fn, void *data)
Junio C Hamanoe0238c22012-02-23 22:45:501071{
1072 struct config_include_data inc = CONFIG_INCLUDE_INIT;
1073 inc.fn = fn;
1074 inc.data = data;
1075 return git_config_from_file(git_config_include, file, &amp;inc);
Junio C Hamanoc14e6ad2014-10-31 20:25:531076}</code></pre>
Junio C Hamanoe0238c22012-02-23 22:45:501077</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531078<div class="paragraph"><p><code>git_config</code> respects includes automatically. The lower-level
1079<code>git_config_from_file</code> does not.</p></div>
Junio C Hamanoe0238c22012-02-23 22:45:501080</div>
Junio C Hamano9d971152012-12-19 00:43:111081</div>
1082<div class="sect1">
Junio C Hamano8a1433a2014-09-02 21:46:241083<h2 id="_custom_configsets">Custom Configsets</h2>
1084<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:531085<div class="paragraph"><p>A <code>config_set</code> can be used to construct an in-memory cache for
1086config-like files that the caller specifies (i.e., files like <code>.gitmodules</code>,
1087<code>~/.gitconfig</code> etc.). For example,</p></div>
Junio C Hamano8a1433a2014-09-02 21:46:241088<div class="listingblock">
1089<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531090<pre><code>struct config_set gm_config;
Junio C Hamano8a1433a2014-09-02 21:46:241091git_configset_init(&amp;gm_config);
1092int b;
1093/* we add config files to the config_set */
1094git_configset_add_file(&amp;gm_config, ".gitmodules");
1095git_configset_add_file(&amp;gm_config, ".gitmodules_alt");
1096
1097if (!git_configset_get_bool(gm_config, "submodule.frotz.ignore", &amp;b)) {
1098 /* hack hack hack */
1099}
1100
1101/* when we are done with the configset */
Junio C Hamanoc14e6ad2014-10-31 20:25:531102git_configset_clear(&amp;gm_config);</code></pre>
Junio C Hamano8a1433a2014-09-02 21:46:241103</div></div>
1104<div class="paragraph"><p>Configset API provides functions for the above mentioned work flow, including:</p></div>
1105<div class="dlist"><dl>
1106<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531107<code>void git_configset_init(struct config_set *cs)</code>
Junio C Hamano8a1433a2014-09-02 21:46:241108</dt>
1109<dd>
1110<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531111 Initializes the config_set <code>cs</code>.
Junio C Hamano8a1433a2014-09-02 21:46:241112</p>
1113</dd>
1114<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531115<code>int git_configset_add_file(struct config_set *cs, const char *filename)</code>
Junio C Hamano8a1433a2014-09-02 21:46:241116</dt>
1117<dd>
1118<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531119 Parses the file and adds the variable-value pairs to the <code>config_set</code>,
Junio C Hamano8a1433a2014-09-02 21:46:241120 dies if there is an error in parsing the file. Returns 0 on success, or
1121 -1 if the file does not exist or is inaccessible. The user has to decide
1122 if he wants to free the incomplete configset or continue using it when
1123 the function returns -1.
1124</p>
1125</dd>
1126<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531127<code>int git_configset_get_value(struct config_set *cs, const char *key, const char **value)</code>
Junio C Hamano8a1433a2014-09-02 21:46:241128</dt>
1129<dd>
1130<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531131 Finds the highest-priority value for the configuration variable <code>key</code>
1132 and config set <code>cs</code>, stores the pointer to it in <code>value</code> and returns 0.
1133 When the configuration variable <code>key</code> is not found, returns 1 without
1134 touching <code>value</code>. The caller should not free or modify <code>value</code>, as it
Junio C Hamano8a1433a2014-09-02 21:46:241135 is owned by the cache.
1136</p>
1137</dd>
1138<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531139<code>const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key)</code>
Junio C Hamano8a1433a2014-09-02 21:46:241140</dt>
1141<dd>
1142<p>
1143 Finds and returns the value list, sorted in order of increasing priority
Junio C Hamanoc14e6ad2014-10-31 20:25:531144 for the configuration variable <code>key</code> and config set <code>cs</code>. When the
1145 configuration variable <code>key</code> is not found, returns NULL. The caller
Junio C Hamano8a1433a2014-09-02 21:46:241146 should not free or modify the returned pointer, as it is owned by the cache.
1147</p>
1148</dd>
1149<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531150<code>void git_configset_clear(struct config_set *cs)</code>
Junio C Hamano8a1433a2014-09-02 21:46:241151</dt>
1152<dd>
1153<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531154 Clears <code>config_set</code> structure, removes all saved variable-value pairs.
Junio C Hamano8a1433a2014-09-02 21:46:241155</p>
1156</dd>
1157</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531158<div class="paragraph"><p>In addition to above functions, the <code>config_set</code> API provides type specific
1159functions in the vein of <code>git_config_get_int</code> and family but with an extra
1160parameter, pointer to struct <code>config_set</code>.
1161They all behave similarly to the <code>git_config_get*()</code> family described in
Junio C Hamano8a1433a2014-09-02 21:46:241162"Querying For Specific Variables" above.</p></div>
1163</div>
1164</div>
1165<div class="sect1">
Junio C Hamanoe0238c22012-02-23 22:45:501166<h2 id="_writing_config_files">Writing Config Files</h2>
1167<div class="sectionbody">
Junio C Hamanofc1cf4a2014-08-04 21:40:551168<div class="paragraph"><p>Git gives multiple entry points in the Config API to write config values to
Junio C Hamanoc14e6ad2014-10-31 20:25:531169files namely <code>git_config_set_in_file</code> and <code>git_config_set</code>, which write to
1170a specific config file or to <code>.git/config</code> respectively. They both take a
Junio C Hamanofc1cf4a2014-08-04 21:40:551171key/value pair as parameter.
Junio C Hamanoc14e6ad2014-10-31 20:25:531172In the end they both call <code>git_config_set_multivar_in_file</code> which takes four
Junio C Hamanofc1cf4a2014-08-04 21:40:551173parameters:</p></div>
1174<div class="ulist"><ul>
1175<li>
1176<p>
1177the name of the file, as a string, to which key/value pairs will be written.
1178</p>
1179</li>
1180<li>
1181<p>
1182the name of key, as a string. This is in canonical "flat" form: the section,
1183 subsection, and variable segments will be separated by dots, and the section
1184 and variable segments will be all lowercase.
Junio C Hamanoc14e6ad2014-10-31 20:25:531185 E.g., <code>core.ignorecase</code>, <code>diff.SomeType.textconv</code>.
Junio C Hamanofc1cf4a2014-08-04 21:40:551186</p>
1187</li>
1188<li>
1189<p>
1190the value of the variable, as a string. If value is equal to NULL, it will
1191 remove the matching key from the config file.
1192</p>
1193</li>
1194<li>
1195<p>
1196the value regex, as a string. It will disregard key/value pairs where value
1197 does not match.
1198</p>
1199</li>
1200<li>
1201<p>
1202a multi_replace value, as an int. If value is equal to zero, nothing or only
1203 one matching key/value is replaced, else all matching key/values (regardless
1204 how many) are removed, before the new pair is written.
1205</p>
1206</li>
1207</ul></div>
1208<div class="paragraph"><p>It returns 0 on success.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531209<div class="paragraph"><p>Also, there are functions <code>git_config_rename_section</code> and
1210<code>git_config_rename_section_in_file</code> with parameters <code>old_name</code> and <code>new_name</code>
Junio C Hamanofc1cf4a2014-08-04 21:40:551211for renaming or removing sections in the config files. If NULL is passed
Junio C Hamanoc14e6ad2014-10-31 20:25:531212through <code>new_name</code> parameter, the section will be removed from the config file.</p></div>
Junio C Hamanoe0238c22012-02-23 22:45:501213</div>
1214</div>
Junio C Hamano9d971152012-12-19 00:43:111215</div>
Junio C Hamanoe0238c22012-02-23 22:45:501216<div id="footnotes"><hr /></div>
1217<div id="footer">
1218<div id="footer-text">
Junio C Hamano8e61f1f2014-09-11 21:53:451219Last updated 2014-09-11 14:53:10 PDT
Junio C Hamanoe0238c22012-02-23 22:45:501220</div>
1221</div>
1222</body>
1223</html>