From 5e402e54e7f0d9eaa85987ced8913f2709f2be5c Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Tue, 12 May 2009 22:20:23 +0200 Subject: [PATCH 01/45] gitk: Update German translation. Signed-off-by: Christian Stimming Signed-off-by: Paul Mackerras --- po/de.po | 680 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 373 insertions(+), 307 deletions(-) diff --git a/po/de.po b/po/de.po index 825dc98f74..53ef0d6359 100644 --- a/po/de.po +++ b/po/de.po @@ -1,14 +1,15 @@ # Translation of gitk to German. # Copyright (C) 2007 Paul Mackerras. # This file is distributed under the same license as the gitk package. -# Christian Stimming , 2007 # +# Christian Stimming , 2007. +# Frederik Schwarzer , 2008. msgid "" msgstr "" "Project-Id-Version: git-gui\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-12-06 20:40+0100\n" -"PO-Revision-Date: 2008-12-06 20:45+0100\n" +"POT-Creation-Date: 2009-05-12 21:55+0200\n" +"PO-Revision-Date: 2009-05-12 22:18+0200\n" "Last-Translator: Christian Stimming \n" "Language-Team: German\n" "MIME-Version: 1.0\n" @@ -17,297 +18,314 @@ msgstr "" #: gitk:113 msgid "Couldn't get list of unmerged files:" -msgstr "Liste der nicht-zusammengeführten Dateien nicht gefunden:" +msgstr "Liste der nicht zusammengeführten Dateien nicht gefunden:" -#: gitk:272 +#: gitk:268 msgid "Error parsing revisions:" msgstr "Fehler beim Laden der Versionen:" -#: gitk:327 +#: gitk:323 msgid "Error executing --argscmd command:" -msgstr "Fehler beim --argscmd Kommando:" +msgstr "Fehler beim Ausführen des --argscmd-Kommandos:" -#: gitk:340 +#: gitk:336 msgid "No files selected: --merge specified but no files are unmerged." msgstr "" -"Keine Dateien ausgewählt: --merge angegeben, es existieren aber keine nicht-" -"zusammengeführten Dateien." +"Keine Dateien ausgewählt: Es wurde --merge angegeben, aber es existieren " +"keine nicht zusammengeführten Dateien." -#: gitk:343 +#: gitk:339 msgid "" "No files selected: --merge specified but no unmerged files are within file " "limit." msgstr "" -"Keine Dateien ausgewähle: --merge angegeben, aber keine nicht-" -"zusammengeführten Dateien sind in der Dateiauswahl." +"Keine Dateien ausgewählt: Es wurde --merge angegeben, aber es sind keine " +"nicht zusammengeführten Dateien in der Dateiauswahl." -#: gitk:365 gitk:503 +#: gitk:361 gitk:508 msgid "Error executing git log:" -msgstr "Fehler beim Ausführen von git-log:" +msgstr "Fehler beim Ausführen von »git log«:" -#: gitk:378 +#: gitk:379 gitk:524 msgid "Reading" msgstr "Lesen" -#: gitk:438 gitk:3462 +#: gitk:439 gitk:4061 msgid "Reading commits..." -msgstr "Versionen lesen..." +msgstr "Versionen werden gelesen ..." -#: gitk:441 gitk:1528 gitk:3465 +#: gitk:442 gitk:1560 gitk:4064 msgid "No commits selected" -msgstr "Keine Versionen ausgewählt." +msgstr "Keine Versionen ausgewählt" -#: gitk:1399 +#: gitk:1436 msgid "Can't parse git log output:" -msgstr "Ausgabe von git-log kann nicht erkannt werden:" +msgstr "Ausgabe von »git log« kann nicht erkannt werden:" -#: gitk:1605 +#: gitk:1656 msgid "No commit information available" msgstr "Keine Versionsinformation verfügbar" -#: gitk:1709 gitk:1731 gitk:3259 gitk:7764 gitk:9293 gitk:9466 +#: gitk:1791 gitk:1815 gitk:3854 gitk:8714 gitk:10250 gitk:10422 msgid "OK" msgstr "Ok" -#: gitk:1733 gitk:3260 gitk:7439 gitk:7510 gitk:7613 gitk:7660 gitk:7766 -#: gitk:9294 gitk:9467 +#: gitk:1817 gitk:3856 gitk:8311 gitk:8385 gitk:8495 gitk:8544 gitk:8716 +#: gitk:10251 gitk:10423 msgid "Cancel" msgstr "Abbrechen" -#: gitk:1811 +#: gitk:1917 msgid "Update" msgstr "Aktualisieren" -#: gitk:1812 +#: gitk:1918 msgid "Reload" msgstr "Neu laden" -#: gitk:1813 +#: gitk:1919 msgid "Reread references" msgstr "Zweige neu laden" -#: gitk:1814 +#: gitk:1920 msgid "List references" msgstr "Zweige/Markierungen auflisten" -#: gitk:1915 +#: gitk:1922 msgid "Start git gui" msgstr "»git gui« starten" -#: gitk:1917 +#: gitk:1924 msgid "Quit" msgstr "Beenden" -#: gitk:1810 +#: gitk:1916 msgid "File" msgstr "Datei" -#: gitk:1818 +#: gitk:1928 msgid "Preferences" msgstr "Einstellungen" -#: gitk:1817 +#: gitk:1927 msgid "Edit" msgstr "Bearbeiten" -#: gitk:1821 +#: gitk:1932 msgid "New view..." -msgstr "Neue Ansicht..." +msgstr "Neue Ansicht ..." -#: gitk:1822 +#: gitk:1933 msgid "Edit view..." -msgstr "Ansicht bearbeiten..." +msgstr "Ansicht bearbeiten ..." -#: gitk:1823 +#: gitk:1934 msgid "Delete view" -msgstr "Ansicht löschen" +msgstr "Ansicht entfernen" -#: gitk:1825 +#: gitk:1936 msgid "All files" msgstr "Alle Dateien" -#: gitk:1820 gitk:3196 +#: gitk:1931 gitk:3666 msgid "View" msgstr "Ansicht" -#: gitk:1828 gitk:2487 +#: gitk:1941 gitk:1951 gitk:2650 msgid "About gitk" msgstr "Über gitk" -#: gitk:1829 +#: gitk:1942 gitk:1956 msgid "Key bindings" msgstr "Tastenkürzel" -#: gitk:1827 +#: gitk:1940 gitk:1955 msgid "Help" msgstr "Hilfe" -#: gitk:1887 +#: gitk:2016 msgid "SHA1 ID: " msgstr "SHA1:" -#: gitk:1918 +#: gitk:2047 msgid "Row" msgstr "Zeile" -#: gitk:1949 +#: gitk:2078 msgid "Find" msgstr "Suche" -#: gitk:1950 +#: gitk:2079 msgid "next" msgstr "nächste" -#: gitk:1951 +#: gitk:2080 msgid "prev" msgstr "vorige" -#: gitk:1952 +#: gitk:2081 msgid "commit" msgstr "Version nach" -#: gitk:1955 gitk:1957 gitk:3617 gitk:3640 gitk:3664 gitk:5550 gitk:5621 +#: gitk:2084 gitk:2086 gitk:4222 gitk:4245 gitk:4269 gitk:6210 gitk:6282 +#: gitk:6366 msgid "containing:" msgstr "Beschreibung:" -#: gitk:1958 gitk:2954 gitk:2959 gitk:3692 +#: gitk:2087 gitk:3158 gitk:3163 gitk:4297 msgid "touching paths:" msgstr "Dateien:" -#: gitk:1959 gitk:3697 +#: gitk:2088 gitk:4302 msgid "adding/removing string:" msgstr "Änderungen:" -#: gitk:1968 gitk:1970 +#: gitk:2097 gitk:2099 msgid "Exact" msgstr "Exakt" -#: gitk:1970 gitk:3773 gitk:5518 +#: gitk:2099 gitk:4377 gitk:6178 msgid "IgnCase" msgstr "Kein Groß/Klein" -#: gitk:1970 gitk:3666 gitk:3771 gitk:5514 +#: gitk:2099 gitk:4271 gitk:4375 gitk:6174 msgid "Regexp" msgstr "Regexp" -#: gitk:1972 gitk:1973 gitk:3792 gitk:3822 gitk:3829 gitk:5641 gitk:5708 +#: gitk:2101 gitk:2102 gitk:4396 gitk:4426 gitk:4433 gitk:6302 gitk:6370 msgid "All fields" msgstr "Alle Felder" -#: gitk:1973 gitk:3790 gitk:3822 gitk:5580 +#: gitk:2102 gitk:4394 gitk:4426 gitk:6241 msgid "Headline" msgstr "Überschrift" -#: gitk:1974 gitk:3790 gitk:5580 gitk:5708 gitk:6109 +#: gitk:2103 gitk:4394 gitk:6241 gitk:6370 gitk:6804 msgid "Comments" msgstr "Beschreibung" -#: gitk:1974 gitk:3790 gitk:3794 gitk:3829 gitk:5580 gitk:6045 gitk:7285 -#: gitk:7300 +#: gitk:2103 gitk:4394 gitk:4398 gitk:4433 gitk:6241 gitk:6739 gitk:7991 +#: gitk:8006 msgid "Author" msgstr "Autor" -#: gitk:1974 gitk:3790 gitk:5580 gitk:6047 +#: gitk:2103 gitk:4394 gitk:6241 gitk:6741 msgid "Committer" msgstr "Eintragender" -#: gitk:2003 +#: gitk:2132 msgid "Search" -msgstr "Suche" +msgstr "Suchen" -#: gitk:2010 +#: gitk:2139 msgid "Diff" msgstr "Vergleich" -#: gitk:2012 +#: gitk:2141 msgid "Old version" msgstr "Alte Version" -#: gitk:2014 +#: gitk:2143 msgid "New version" msgstr "Neue Version" -#: gitk:2016 +#: gitk:2145 msgid "Lines of context" msgstr "Kontextzeilen" -#: gitk:2026 +#: gitk:2155 msgid "Ignore space change" msgstr "Leerzeichenänderungen ignorieren" -#: gitk:2084 +#: gitk:2213 msgid "Patch" msgstr "Patch" -#: gitk:2086 +#: gitk:2215 msgid "Tree" msgstr "Baum" -#: gitk:2213 gitk:2226 +#: gitk:2359 gitk:2376 msgid "Diff this -> selected" -msgstr "Vergleich diese -> gewählte" +msgstr "Vergleich: diese -> gewählte" -#: gitk:2214 gitk:2227 +#: gitk:2360 gitk:2377 msgid "Diff selected -> this" -msgstr "Vergleich gewählte -> diese" +msgstr "Vergleich: gewählte -> diese" -#: gitk:2215 gitk:2228 +#: gitk:2361 gitk:2378 msgid "Make patch" msgstr "Patch erstellen" -#: gitk:2216 gitk:7494 +#: gitk:2362 gitk:8369 msgid "Create tag" msgstr "Markierung erstellen" -#: gitk:2217 gitk:7593 +#: gitk:2363 gitk:8475 msgid "Write commit to file" msgstr "Version in Datei schreiben" -#: gitk:2218 gitk:7647 +#: gitk:2364 gitk:8532 msgid "Create new branch" msgstr "Neuen Zweig erstellen" -#: gitk:2219 +#: gitk:2365 msgid "Cherry-pick this commit" msgstr "Diese Version pflücken" -#: gitk:2220 +#: gitk:2366 msgid "Reset HEAD branch to here" msgstr "HEAD-Zweig auf diese Version zurücksetzen" -#: gitk:2234 +#: gitk:2367 +msgid "Mark this commit" +msgstr "Lesezeichen setzen" + +#: gitk:2368 +msgid "Return to mark" +msgstr "Zum Lesezeichen" + +#: gitk:2369 +msgid "Find descendant of this and mark" +msgstr "Abkömmling von Lesezeichen und dieser Version finden" + +#: gitk:2370 +msgid "Compare with marked commit" +msgstr "Mit Lesezeichen vergleichen" + +#: gitk:2384 msgid "Check out this branch" msgstr "Auf diesen Zweig umstellen" -#: gitk:2235 +#: gitk:2385 msgid "Remove this branch" msgstr "Zweig löschen" -#: gitk:2242 +#: gitk:2392 msgid "Highlight this too" msgstr "Diesen auch hervorheben" -#: gitk:2243 +#: gitk:2393 msgid "Highlight this only" msgstr "Nur diesen hervorheben" -#: gitk:2244 +#: gitk:2394 msgid "External diff" -msgstr "Externer Vergleich" +msgstr "Externes Diff-Programm" -#: gitk:2255 +#: gitk:2395 msgid "Blame parent commit" msgstr "Annotieren der Elternversion" -#: gitk:2360 +#: gitk:2402 msgid "Show origin of this line" msgstr "Herkunft dieser Zeile anzeigen" -#: gitk:2361 +#: gitk:2403 msgid "Run git gui blame on this line" -msgstr "Annotieren (»git gui blame«) von dieser Zeile" +msgstr "Diese Zeile annotieren (»git gui blame«)" -#: gitk:2606 +#: gitk:2652 msgid "" "\n" "Gitk - a commit viewer for git\n" @@ -317,504 +335,552 @@ msgid "" "Use and redistribute under the terms of the GNU General Public License" msgstr "" "\n" -"Gitk - eine Visualisierung der Git Historie\n" +"Gitk - eine Visualisierung der Git-Historie\n" "\n" "Copyright © 2005-2008 Paul Mackerras\n" "\n" "Benutzung und Weiterverbreitung gemäß den Bedingungen der GNU General Public " "License" -#: gitk:2496 gitk:2557 gitk:7943 +#: gitk:2660 gitk:2722 gitk:8897 msgid "Close" msgstr "Schließen" -#: gitk:2515 +#: gitk:2679 msgid "Gitk key bindings" -msgstr "Gitk Tastaturbelegung" +msgstr "Gitk-Tastaturbelegung" -#: gitk:2517 +#: gitk:2682 msgid "Gitk key bindings:" -msgstr "Gitk Tastaturbelegung:" +msgstr "Gitk-Tastaturbelegung:" -#: gitk:2519 +#: gitk:2684 #, tcl-format msgid "<%s-Q>\t\tQuit" msgstr "<%s-Q>\t\tBeenden" -#: gitk:2520 +#: gitk:2685 msgid "\t\tMove to first commit" msgstr "\t\tZur neuesten Version springen" -#: gitk:2521 +#: gitk:2686 msgid "\t\tMove to last commit" msgstr "\t\tZur ältesten Version springen" -#: gitk:2522 +#: gitk:2687 msgid ", p, i\tMove up one commit" msgstr ", p, i\tNächste neuere Version" -#: gitk:2523 +#: gitk:2688 msgid ", n, k\tMove down one commit" msgstr ", n, k\tNächste ältere Version" -#: gitk:2524 +#: gitk:2689 msgid ", z, j\tGo back in history list" msgstr ", z, j\tEine Version zurückgehen" -#: gitk:2525 +#: gitk:2690 msgid ", x, l\tGo forward in history list" msgstr ", x, l\tEine Version weitergehen" -#: gitk:2526 +#: gitk:2691 msgid "\tMove up one page in commit list" msgstr "\tEine Seite nach oben blättern" -#: gitk:2527 +#: gitk:2692 msgid "\tMove down one page in commit list" msgstr "\tEine Seite nach unten blättern" -#: gitk:2528 +#: gitk:2693 #, tcl-format msgid "<%s-Home>\tScroll to top of commit list" msgstr "<%s-Pos1>\tZum oberen Ende der Versionsliste blättern" -#: gitk:2529 +#: gitk:2694 #, tcl-format msgid "<%s-End>\tScroll to bottom of commit list" msgstr "<%s-Ende>\tZum unteren Ende der Versionsliste blättern" -#: gitk:2530 +#: gitk:2695 #, tcl-format msgid "<%s-Up>\tScroll commit list up one line" msgstr "<%s-Hoch>\tVersionsliste eine Zeile nach oben blättern" -#: gitk:2531 +#: gitk:2696 #, tcl-format msgid "<%s-Down>\tScroll commit list down one line" msgstr "<%s-Runter>\tVersionsliste eine Zeile nach unten blättern" -#: gitk:2532 +#: gitk:2697 #, tcl-format msgid "<%s-PageUp>\tScroll commit list up one page" -msgstr "<%s-BildHoch>\tVersionsliste eine Seite hoch blättern" +msgstr "<%s-BildHoch>\tVersionsliste eine Seite nach oben blättern" -#: gitk:2533 +#: gitk:2698 #, tcl-format msgid "<%s-PageDown>\tScroll commit list down one page" msgstr "<%s-BildRunter>\tVersionsliste eine Seite nach unten blättern" -#: gitk:2534 +#: gitk:2699 msgid "\tFind backwards (upwards, later commits)" msgstr "\tRückwärts suchen (nach oben; neuere Versionen)" -#: gitk:2535 +#: gitk:2700 msgid "\tFind forwards (downwards, earlier commits)" msgstr " Suchen (nach unten; ältere Versionen)" -#: gitk:2536 +#: gitk:2701 msgid ", b\tScroll diff view up one page" msgstr ", b\t\tVergleich eine Seite nach oben blättern" -#: gitk:2537 +#: gitk:2702 msgid "\tScroll diff view up one page" msgstr "\tVergleich eine Seite nach oben blättern" -#: gitk:2538 +#: gitk:2703 msgid "\t\tScroll diff view down one page" msgstr "\tVergleich eine Seite nach unten blättern" -#: gitk:2539 +#: gitk:2704 msgid "u\t\tScroll diff view up 18 lines" -msgstr "u\t\tVergleich um 18 Zeilen nach oben (»up«) blättern" +msgstr "u\t\tVergleich um 18 Zeilen nach oben blättern" -#: gitk:2540 +#: gitk:2705 msgid "d\t\tScroll diff view down 18 lines" -msgstr "d\t\tVergleich um 18 Zeilen nach unten (»down«) blättern" +msgstr "d\t\tVergleich um 18 Zeilen nach unten blättern" -#: gitk:2541 +#: gitk:2706 #, tcl-format msgid "<%s-F>\t\tFind" msgstr "<%s-F>\t\tSuchen" -#: gitk:2542 +#: gitk:2707 #, tcl-format msgid "<%s-G>\t\tMove to next find hit" msgstr "<%s-G>\t\tWeitersuchen" -#: gitk:2543 +#: gitk:2708 msgid "\tMove to next find hit" msgstr "\tWeitersuchen" -#: gitk:2544 -msgid "/\t\tMove to next find hit, or redo find" -msgstr "/\t\tWeitersuchen oder neue Suche beginnen" +#: gitk:2709 +msgid "/\t\tFocus the search box" +msgstr "/\t\tTastaturfokus ins Suchfeld" -#: gitk:2545 +#: gitk:2710 msgid "?\t\tMove to previous find hit" msgstr "?\t\tRückwärts weitersuchen" -#: gitk:2546 +#: gitk:2711 msgid "f\t\tScroll diff view to next file" -msgstr "f\t\tVergleich zur nächsten Datei (»file«) blättern" +msgstr "f\t\tVergleich zur nächsten Datei blättern" -#: gitk:2547 +#: gitk:2712 #, tcl-format msgid "<%s-S>\t\tSearch for next hit in diff view" msgstr "<%s-S>\t\tWeitersuchen im Vergleich" -#: gitk:2548 +#: gitk:2713 #, tcl-format msgid "<%s-R>\t\tSearch for previous hit in diff view" msgstr "<%s-R>\t\tRückwärts weitersuchen im Vergleich" -#: gitk:2549 +#: gitk:2714 #, tcl-format msgid "<%s-KP+>\tIncrease font size" -msgstr "<%s-Nummerblock-Plus>\tSchriftgröße vergrößern" +msgstr "<%s-Nummerblock-Plus>\tSchrift vergrößern" -#: gitk:2550 +#: gitk:2715 #, tcl-format msgid "<%s-plus>\tIncrease font size" -msgstr "<%s-Plus>\tSchriftgröße vergrößern" +msgstr "<%s-Plus>\tSchrift vergrößern" -#: gitk:2551 +#: gitk:2716 #, tcl-format msgid "<%s-KP->\tDecrease font size" -msgstr "<%s-Nummernblock-> Schriftgröße verkleinern" +msgstr "<%s-Nummernblock-Minus> Schrift verkleinern" -#: gitk:2552 +#: gitk:2717 #, tcl-format msgid "<%s-minus>\tDecrease font size" -msgstr "<%s-Minus>\tSchriftgröße verkleinern" +msgstr "<%s-Minus>\tSchrift verkleinern" -#: gitk:2553 +#: gitk:2718 msgid "\t\tUpdate" msgstr "\t\tAktualisieren" -#: gitk:2979 +#: gitk:3173 #, tcl-format msgid "Error getting \"%s\" from %s:" msgstr "Fehler beim Holen von »%s« von »%s«:" -#: gitk:3036 gitk:3045 +#: gitk:3230 gitk:3239 #, tcl-format msgid "Error creating temporary directory %s:" -msgstr "Fehler beim Erzeugen eines temporären Verzeichnisses »%s«:" +msgstr "Fehler beim Erzeugen des temporären Verzeichnisses »%s«:" -#: gitk:3058 +#: gitk:3251 msgid "command failed:" msgstr "Kommando fehlgeschlagen:" -#: gitk:3078 +#: gitk:3397 msgid "No such commit" msgstr "Version nicht gefunden" -#: gitk:3083 +#: gitk:3411 msgid "git gui blame: command failed:" msgstr "git gui blame: Kommando fehlgeschlagen:" -#: gitk:3398 +#: gitk:3442 #, tcl-format msgid "Couldn't read merge head: %s" msgstr "Zusammenführungs-Spitze konnte nicht gelesen werden: %s" -#: gitk:3406 +#: gitk:3450 #, tcl-format msgid "Error reading index: %s" msgstr "Fehler beim Lesen der Bereitstellung (»index«): %s" -#: gitk:3431 +#: gitk:3475 #, tcl-format msgid "Couldn't start git blame: %s" msgstr "»git blame« konnte nicht gestartet werden: %s" -#: gitk:3434 gitk:6160 +#: gitk:3478 gitk:6209 msgid "Searching" msgstr "Suchen" -#: gitk:3466 +#: gitk:3510 #, tcl-format msgid "Error running git blame: %s" msgstr "Fehler beim Ausführen von »git blame«: %s" -#: gitk:3494 +#: gitk:3538 #, tcl-format msgid "That line comes from commit %s, which is not in this view" msgstr "" -"Diese Zeile stammt aus Version %s, welche nicht in dieser Ansicht gezeigt " -"wird." +"Diese Zeile stammt aus Version %s, die nicht in dieser Ansicht gezeigt wird" -#: gitk:3508 +#: gitk:3552 msgid "External diff viewer failed:" -msgstr "Externes Vergleich-(Diff-)Programm fehlgeschlagen:" +msgstr "Externes Diff-Programm fehlgeschlagen:" -#: gitk:3210 +#: gitk:3670 msgid "Gitk view definition" -msgstr "Gitk Ansichten" +msgstr "Gitk-Ansichten" -#: gitk:3630 +#: gitk:3674 msgid "Remember this view" msgstr "Diese Ansicht speichern" -#: gitk:3232 +#: gitk:3675 msgid "Commits to include (arguments to git log):" -msgstr "Versionen anzeigen (Argumente von git-log):" +msgstr "Versionen anzeigen (Argumente von git log):" -#: gitk:3632 +#: gitk:3676 msgid "Use all refs" msgstr "Alle Zweige verwenden" -#: gitk:3633 +#: gitk:3677 msgid "Strictly sort by date" msgstr "Streng nach Datum sortieren" -#: gitk:3634 +#: gitk:3678 msgid "Mark branch sides" msgstr "Zweig-Seiten markieren" -#: gitk:3635 +#: gitk:3679 msgid "Since date:" msgstr "Von Datum:" -#: gitk:3636 +#: gitk:3680 msgid "Until date:" msgstr "Bis Datum:" -#: gitk:3637 +#: gitk:3681 msgid "Max count:" msgstr "Max. Anzahl:" -#: gitk:3638 +#: gitk:3682 msgid "Skip:" msgstr "Überspringen:" -#: gitk:3639 +#: gitk:3683 msgid "Limit to first parent" msgstr "Auf erste Elternversion beschränken" -#: gitk:3640 +#: gitk:3684 msgid "Command to generate more commits to include:" msgstr "Versionsliste durch folgendes Kommando erzeugen lassen:" -#: gitk:3749 +#: gitk:3780 +msgid "Gitk: edit view" +msgstr "Gitk: Ansicht bearbeiten" + +#: gitk:3793 msgid "Name" msgstr "Name" -#: gitk:3797 +#: gitk:3841 msgid "Enter files and directories to include, one per line:" msgstr "Folgende Dateien und Verzeichnisse anzeigen (eine pro Zeile):" -#: gitk:3811 +#: gitk:3855 msgid "Apply (F5)" msgstr "Anwenden (F5)" -#: gitk:3849 +#: gitk:3893 msgid "Error in commit selection arguments:" msgstr "Fehler in den ausgewählten Versionen:" -#: gitk:3347 gitk:3399 gitk:3842 gitk:3856 gitk:5060 gitk:10141 gitk:10142 +#: gitk:3946 gitk:3998 gitk:4446 gitk:4460 gitk:5721 gitk:11114 gitk:11115 msgid "None" msgstr "Keine" -#: gitk:3790 gitk:5580 gitk:7287 gitk:7302 +#: gitk:4394 gitk:6241 gitk:7993 gitk:8008 msgid "Date" msgstr "Datum" -#: gitk:3790 gitk:5580 +#: gitk:4394 gitk:6241 msgid "CDate" msgstr "Eintragedatum" -#: gitk:3939 gitk:3944 +#: gitk:4543 gitk:4548 msgid "Descendant" msgstr "Abkömmling" -#: gitk:3940 +#: gitk:4544 msgid "Not descendant" -msgstr "Nicht Abkömmling" +msgstr "Kein Abkömmling" -#: gitk:3947 gitk:3952 +#: gitk:4551 gitk:4556 msgid "Ancestor" msgstr "Vorgänger" -#: gitk:3948 +#: gitk:4552 msgid "Not ancestor" -msgstr "Nicht Vorgänger" +msgstr "Kein Vorgänger" -#: gitk:4187 +#: gitk:4842 msgid "Local changes checked in to index but not committed" msgstr "Lokale Änderungen bereitgestellt, aber nicht eingetragen" -#: gitk:4220 +#: gitk:4878 msgid "Local uncommitted changes, not checked in to index" msgstr "Lokale Änderungen, nicht bereitgestellt" -#: gitk:6673 +#: gitk:6559 +msgid "many" +msgstr "viele" + +#: gitk:6743 msgid "Tags:" msgstr "Markierungen:" -#: gitk:6066 gitk:6072 gitk:7280 +#: gitk:6760 gitk:6766 gitk:7986 msgid "Parent" msgstr "Eltern" -#: gitk:6077 +#: gitk:6771 msgid "Child" msgstr "Kind" -#: gitk:6086 +#: gitk:6780 msgid "Branch" msgstr "Zweig" -#: gitk:6089 +#: gitk:6783 msgid "Follows" msgstr "Folgt auf" -#: gitk:6092 +#: gitk:6786 msgid "Precedes" msgstr "Vorgänger von" -#: gitk:7209 +#: gitk:7279 #, tcl-format msgid "Error getting diffs: %s" msgstr "Fehler beim Laden des Vergleichs: %s" -#: gitk:7748 +#: gitk:7819 msgid "Goto:" msgstr "Gehe zu:" -#: gitk:7115 +#: gitk:7821 msgid "SHA1 ID:" msgstr "SHA1-Hashwert:" -#: gitk:7134 +#: gitk:7840 #, tcl-format msgid "Short SHA1 id %s is ambiguous" msgstr "Kurzer SHA1-Hashwert »%s« ist mehrdeutig" -#: gitk:7146 +#: gitk:7852 #, tcl-format msgid "SHA1 id %s is not known" -msgstr "SHA1-Hashwert »%s« unbekannt" +msgstr "SHA1-Hashwert »%s« ist unbekannt" -#: gitk:7148 +#: gitk:7854 #, tcl-format msgid "Tag/Head %s is not known" msgstr "Markierung/Zweig »%s« ist unbekannt" -#: gitk:7290 +#: gitk:7996 msgid "Children" msgstr "Kinder" -#: gitk:7347 +#: gitk:8053 #, tcl-format msgid "Reset %s branch to here" msgstr "Zweig »%s« hierher zurücksetzen" -#: gitk:7349 +#: gitk:8055 msgid "Detached head: can't reset" msgstr "Zweigspitze ist abgetrennt: Zurücksetzen nicht möglich" -#: gitk:7381 +#: gitk:8164 gitk:8170 +msgid "Skipping merge commit " +msgstr "Überspringe Zusammenführungs-Version " + +#: gitk:8179 gitk:8184 +msgid "Error getting patch ID for " +msgstr "Fehler beim Holen der Patch-ID für " + +#: gitk:8180 gitk:8185 +msgid " - stopping\n" +msgstr " - Abbruch.\n" + +#: gitk:8190 gitk:8193 gitk:8201 gitk:8211 gitk:8220 +msgid "Commit " +msgstr "Version " + +#: gitk:8194 +msgid "" +" is the same patch as\n" +" " +msgstr "" +" ist das gleiche Patch wie\n" +" " + +#: gitk:8202 +msgid "" +" differs from\n" +" " +msgstr "" +" ist unterschiedlich von\n" +" " + +#: gitk:8204 +msgid "- stopping\n" +msgstr "- Abbruch.\n" + +#: gitk:8212 gitk:8221 +#, tcl-format +msgid " has %s children - stopping\n" +msgstr " hat %s Kinder. Abbruch\n" + +#: gitk:8252 msgid "Top" msgstr "Oben" -#: gitk:7382 +#: gitk:8253 msgid "From" msgstr "Von" -#: gitk:7387 +#: gitk:8258 msgid "To" msgstr "bis" -#: gitk:7410 +#: gitk:8282 msgid "Generate patch" msgstr "Patch erstellen" -#: gitk:7412 +#: gitk:8284 msgid "From:" msgstr "Von:" -#: gitk:7421 +#: gitk:8293 msgid "To:" msgstr "bis:" -#: gitk:7430 +#: gitk:8302 msgid "Reverse" msgstr "Umgekehrt" -#: gitk:7432 gitk:7607 +#: gitk:8304 gitk:8489 msgid "Output file:" msgstr "Ausgabedatei:" -#: gitk:7438 +#: gitk:8310 msgid "Generate" msgstr "Erzeugen" -#: gitk:7474 +#: gitk:8348 msgid "Error creating patch:" -msgstr "Fehler beim Patch erzeugen:" +msgstr "Fehler beim Erzeugen des Patches:" -#: gitk:7496 gitk:7595 gitk:7649 +#: gitk:8371 gitk:8477 gitk:8534 msgid "ID:" msgstr "ID:" -#: gitk:7505 +#: gitk:8380 msgid "Tag name:" msgstr "Markierungsname:" -#: gitk:7509 gitk:7659 +#: gitk:8384 gitk:8543 msgid "Create" msgstr "Erstellen" -#: gitk:7524 +#: gitk:8401 msgid "No tag name specified" msgstr "Kein Markierungsname angegeben" -#: gitk:7528 +#: gitk:8405 #, tcl-format msgid "Tag \"%s\" already exists" msgstr "Markierung »%s« existiert bereits." -#: gitk:7534 +#: gitk:8411 msgid "Error creating tag:" -msgstr "Fehler bei Markierung erstellen:" +msgstr "Fehler beim Erstellen der Markierung:" -#: gitk:7604 +#: gitk:8486 msgid "Command:" msgstr "Kommando:" -#: gitk:7612 +#: gitk:8494 msgid "Write" msgstr "Schreiben" -#: gitk:7628 +#: gitk:8512 msgid "Error writing commit:" msgstr "Fehler beim Schreiben der Version:" -#: gitk:7654 +#: gitk:8539 msgid "Name:" msgstr "Name:" -#: gitk:7674 +#: gitk:8562 msgid "Please specify a name for the new branch" msgstr "Bitte geben Sie einen Namen für den neuen Zweig an." -#: gitk:8328 +#: gitk:8567 #, tcl-format msgid "Branch '%s' already exists. Overwrite?" msgstr "Zweig »%s« existiert bereits. Soll er überschrieben werden?" -#: gitk:8394 +#: gitk:8633 #, tcl-format msgid "Commit %s is already included in branch %s -- really re-apply it?" msgstr "" "Version »%s« ist bereits im Zweig »%s« enthalten -- trotzdem erneut " "eintragen?" -#: gitk:7718 +#: gitk:8638 msgid "Cherry-picking" msgstr "Version pflücken" -#: gitk:8408 +#: gitk:8647 #, tcl-format msgid "" "Cherry-pick failed because of local changes to file '%s'.\n" @@ -822,45 +888,45 @@ msgid "" msgstr "" "Pflücken fehlgeschlagen, da noch lokale Änderungen in Datei »%s«\n" "vorliegen. Bitte diese Änderungen eintragen, zurücksetzen oder\n" -"zwischenspeichern (»git stash») und dann erneut versuchen." +"zwischenspeichern (»git stash«) und dann erneut versuchen." -#: gitk:8414 +#: gitk:8653 msgid "" "Cherry-pick failed because of merge conflict.\n" "Do you wish to run git citool to resolve it?" msgstr "" "Pflücken fehlgeschlagen, da ein Zusammenführungs-Konflikt aufgetreten\n" -"ist. Soll das »git citool« (Zusammenführungs-Werkzeug) aufgerufen\n" +"ist. Soll das Zusammenführungs-Werkzeug (»git citool«) aufgerufen\n" "werden, um diesen Konflikt aufzulösen?" -#: gitk:8430 +#: gitk:8669 msgid "No changes committed" msgstr "Keine Änderungen eingetragen" -#: gitk:7745 +#: gitk:8695 msgid "Confirm reset" msgstr "Zurücksetzen bestätigen" -#: gitk:7747 +#: gitk:8697 #, tcl-format msgid "Reset branch %s to %s?" msgstr "Zweig »%s« auf »%s« zurücksetzen?" -#: gitk:7751 +#: gitk:8701 msgid "Reset type:" msgstr "Art des Zurücksetzens:" -#: gitk:7755 +#: gitk:8705 msgid "Soft: Leave working tree and index untouched" msgstr "Harmlos: Arbeitskopie und Bereitstellung unverändert" -#: gitk:7758 +#: gitk:8708 msgid "Mixed: Leave working tree untouched, reset index" msgstr "" "Gemischt: Arbeitskopie unverändert,\n" "Bereitstellung zurückgesetzt" -#: gitk:7761 +#: gitk:8711 msgid "" "Hard: Reset working tree and index\n" "(discard ALL local changes)" @@ -868,21 +934,21 @@ msgstr "" "Hart: Arbeitskopie und Bereitstellung\n" "(Alle lokalen Änderungen werden gelöscht)" -#: gitk:7777 +#: gitk:8728 msgid "Resetting" msgstr "Zurücksetzen" -#: gitk:7834 +#: gitk:8785 msgid "Checking out" msgstr "Umstellen" -#: gitk:7885 +#: gitk:8838 msgid "Cannot delete the currently checked-out branch" msgstr "" "Der Zweig, auf den die Arbeitskopie momentan umgestellt ist, kann nicht " "gelöscht werden." -#: gitk:7891 +#: gitk:8844 #, tcl-format msgid "" "The commits on branch %s aren't on any other branch.\n" @@ -891,174 +957,174 @@ msgstr "" "Die Versionen auf Zweig »%s« existieren auf keinem anderen Zweig.\n" "Zweig »%s« trotzdem löschen?" -#: gitk:7922 +#: gitk:8875 #, tcl-format msgid "Tags and heads: %s" msgstr "Markierungen und Zweige: %s" -#: gitk:7936 +#: gitk:8890 msgid "Filter" msgstr "Filtern" -#: gitk:8230 +#: gitk:9185 msgid "" "Error reading commit topology information; branch and preceding/following " "tag information will be incomplete." msgstr "" -"Fehler beim Lesen der Strukturinformationen; Zweige und Vorgänger/Nachfolger " -"Informationen werden unvollständig sein." +"Fehler beim Lesen der Strukturinformationen; Zweige und Informationen zu " +"Vorgänger/Nachfolger werden unvollständig sein." -#: gitk:9216 +#: gitk:10171 msgid "Tag" msgstr "Markierung" -#: gitk:9216 +#: gitk:10171 msgid "Id" msgstr "Id" -#: gitk:9262 +#: gitk:10219 msgid "Gitk font chooser" -msgstr "Gitk Schriften wählen" +msgstr "Gitk-Schriften wählen" -#: gitk:9279 +#: gitk:10236 msgid "B" msgstr "F" -#: gitk:9282 +#: gitk:10239 msgid "I" msgstr "K" -#: gitk:9375 +#: gitk:10334 msgid "Gitk preferences" -msgstr "Gitk Einstellungen" +msgstr "Gitk-Einstellungen" -#: gitk:9376 +#: gitk:10336 msgid "Commit list display options" -msgstr "Anzeige Versionsliste" +msgstr "Anzeige der Versionsliste" -#: gitk:9379 +#: gitk:10339 msgid "Maximum graph width (lines)" msgstr "Maximale Graphenbreite (Zeilen)" -#: gitk:9383 +#: gitk:10343 #, tcl-format msgid "Maximum graph width (% of pane)" msgstr "Maximale Graphenbreite (% des Fensters)" -#: gitk:9388 +#: gitk:10347 msgid "Show local changes" msgstr "Lokale Änderungen anzeigen" -#: gitk:9393 +#: gitk:10350 msgid "Auto-select SHA1" -msgstr "SHA1-Hashwert automatisch markieren" +msgstr "SHA1-Hashwert automatisch auswählen" -#: gitk:9398 +#: gitk:10354 msgid "Diff display options" -msgstr "Anzeige Vergleich" +msgstr "Anzeige des Vergleichs" -#: gitk:9400 +#: gitk:10356 msgid "Tab spacing" msgstr "Tabulatorbreite" -#: gitk:9404 +#: gitk:10359 msgid "Display nearby tags" -msgstr "Naheliegende Überschriften anzeigen" +msgstr "Naheliegende Markierungen anzeigen" -#: gitk:9409 +#: gitk:10362 msgid "Limit diffs to listed paths" msgstr "Vergleich nur für angezeigte Pfade" -#: gitk:9414 +#: gitk:10365 msgid "Support per-file encodings" msgstr "Zeichenkodierung pro Datei ermitteln" -#: gitk:9421 +#: gitk:10371 gitk:10436 msgid "External diff tool" -msgstr "Externes Vergleich-(Diff-)Programm" +msgstr "Externes Diff-Programm" -#: gitk:9423 +#: gitk:10373 msgid "Choose..." -msgstr "Wählen..." +msgstr "Wählen ..." -#: gitk:9428 +#: gitk:10378 msgid "Colors: press to choose" msgstr "Farben: Klicken zum Wählen" -#: gitk:9431 +#: gitk:10381 msgid "Background" msgstr "Hintergrund" -#: gitk:10153 gitk:10183 +#: gitk:10382 gitk:10412 msgid "background" msgstr "Hintergrund" -#: gitk:10156 +#: gitk:10385 msgid "Foreground" msgstr "Vordergrund" -#: gitk:10157 +#: gitk:10386 msgid "foreground" msgstr "Vordergrund" -#: gitk:10160 +#: gitk:10389 msgid "Diff: old lines" msgstr "Vergleich: Alte Zeilen" -#: gitk:10161 +#: gitk:10390 msgid "diff old lines" msgstr "Vergleich - Alte Zeilen" -#: gitk:10165 +#: gitk:10394 msgid "Diff: new lines" msgstr "Vergleich: Neue Zeilen" -#: gitk:10166 +#: gitk:10395 msgid "diff new lines" msgstr "Vergleich - Neue Zeilen" -#: gitk:10170 +#: gitk:10399 msgid "Diff: hunk header" msgstr "Vergleich: Änderungstitel" -#: gitk:10172 +#: gitk:10401 msgid "diff hunk header" msgstr "Vergleich - Änderungstitel" -#: gitk:10176 +#: gitk:10405 msgid "Marked line bg" -msgstr "Markierte Zeile Hintergrund" +msgstr "Hintergrund für markierte Zeile" -#: gitk:10178 +#: gitk:10407 msgid "marked line background" -msgstr "markierte Zeile Hintergrund" +msgstr "Hintergrund für markierte Zeile" -#: gitk:10182 +#: gitk:10411 msgid "Select bg" -msgstr "Hintergrundfarbe Auswählen" +msgstr "Hintergrundfarbe auswählen" -#: gitk:9459 +#: gitk:10415 msgid "Fonts: press to choose" msgstr "Schriftart: Klicken zum Wählen" -#: gitk:9461 +#: gitk:10417 msgid "Main font" msgstr "Programmschriftart" -#: gitk:9462 +#: gitk:10418 msgid "Diff display font" -msgstr "Vergleich" +msgstr "Schriftart für Vergleich" -#: gitk:9463 +#: gitk:10419 msgid "User interface font" msgstr "Beschriftungen" -#: gitk:9488 +#: gitk:10446 #, tcl-format msgid "Gitk: choose color for %s" msgstr "Gitk: Farbe wählen für %s" -#: gitk:9934 +#: gitk:10893 msgid "" "Sorry, gitk cannot run with this version of Tcl/Tk.\n" " Gitk requires at least Tcl/Tk 8.4." @@ -1066,24 +1132,24 @@ msgstr "" "Gitk läuft nicht mit dieser Version von Tcl/Tk.\n" "Gitk benötigt mindestens Tcl/Tk 8.4." -#: gitk:10047 +#: gitk:11020 msgid "Cannot find a git repository here." msgstr "Kein Git-Projektarchiv gefunden." -#: gitk:10051 +#: gitk:11024 #, tcl-format msgid "Cannot find the git directory \"%s\"." msgstr "Git-Verzeichnis »%s« wurde nicht gefunden." -#: gitk:10098 +#: gitk:11071 #, tcl-format msgid "Ambiguous argument '%s': both revision and filename" msgstr "Mehrdeutige Angabe »%s«: Sowohl Version als auch Dateiname existiert." -#: gitk:10110 +#: gitk:11083 msgid "Bad arguments to gitk:" msgstr "Falsche Kommandozeilen-Parameter für gitk:" -#: gitk:10170 +#: gitk:11167 msgid "Command line" msgstr "Kommandozeile" From b5cda49040f77334dc08485e3f36ef8c8f2928b4 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 28 Apr 2009 14:03:54 +0200 Subject: [PATCH 02/45] gitk: Use --textconv to generate diff text For the most part gitk's focus is on showing history and changes in a human readable form. For this reason, it makes sense to generate the patch text in the diff view using --textconv so that textconv drivers are used if they are defined. gitk can also generate patches, but we do not use --textconv because such patches could not be applied. Signed-off-by: Johannes Sixt Signed-off-by: Paul Mackerras --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index 1a7887b252..dcbfdc6538 100755 --- a/gitk +++ b/gitk @@ -7268,7 +7268,7 @@ proc getblobdiffs {ids} { global limitdiffs vfilelimit curview global diffencoding targetline diffnparents - set cmd [diffcmd $ids "-p -C --cc --no-commit-id -U$diffcontext"] + set cmd [diffcmd $ids "-p --textconv -C --cc --no-commit-id -U$diffcontext"] if {$ignorespace} { append cmd " -w" } From a8138733fcf4d9c175b53ab0d0f06a3f7c232286 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sat, 16 May 2009 21:06:01 +1000 Subject: [PATCH 03/45] gitk: Check git version before using --textconv flag Commit 785b7535 ("gitk: use --textconv to generate diff text") added the --textconv flag to the git diff commands used to display commit diffs. Since some people use newer gitk with older git installations, this adds a check on the git version to check that it understands --textconv before using it. Signed-off-by: Paul Mackerras --- gitk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gitk b/gitk index dcbfdc6538..5710782472 100755 --- a/gitk +++ b/gitk @@ -7267,8 +7267,13 @@ proc getblobdiffs {ids} { global ignorespace global limitdiffs vfilelimit curview global diffencoding targetline diffnparents + global git_version - set cmd [diffcmd $ids "-p --textconv -C --cc --no-commit-id -U$diffcontext"] + set textconv {} + if {[package vcompare $git_version "1.6.1"] >= 0} { + set textconv "--textconv" + } + set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"] if {$ignorespace} { append cmd " -w" } @@ -11090,6 +11095,7 @@ set nullid2 "0000000000000000000000000000000000000001" set nullfile "/dev/null" set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] +set git_version [lindex [exec git version] end] set runq {} set history {} From 13d40b618a78ce236d103ab14272b07305f2f7c9 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 23 Mar 2009 11:57:46 -0600 Subject: [PATCH 04/45] gitk: Make more options easily accessible from Edit View dialog Commit 218a900bd8efd0d49f8a0d9491aa4786a998d4f4 added a number of new individual fields for the Edit View dialog to make them more accessible to end users, while still allowing all options to be specified in the "arguments to git log" field. This extends the dialog further, to include refs, author, committer, commit message, and patch contents. As before everything still remains accessible from the "arguments to git log" input field. Additionally, this provides hints for the format of the various input fields (for example, listing some sample date strings in different formats), and puts related query items into subsections to make it easier to digest the number of options that exist. Signed-off-by: Elijah Newren Signed-off-by: Paul Mackerras --- gitk | 131 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 94 insertions(+), 37 deletions(-) diff --git a/gitk b/gitk index 5710782472..0804e6e36e 100755 --- a/gitk +++ b/gitk @@ -3671,17 +3671,35 @@ proc newview {ishighlight} { } set known_view_options { - {perm b . {} {mc "Remember this view"}} - {args t50= + {} {mc "Commits to include (arguments to git log):"}} - {all b * "--all" {mc "Use all refs"}} - {dorder b . {"--date-order" "-d"} {mc "Strictly sort by date"}} - {lright b . "--left-right" {mc "Mark branch sides"}} - {since t15 + {"--since=*" "--after=*"} {mc "Since date:"}} - {until t15 . {"--until=*" "--before=*"} {mc "Until date:"}} - {limit t10 + "--max-count=*" {mc "Max count:"}} - {skip t10 . "--skip=*" {mc "Skip:"}} - {first b . "--first-parent" {mc "Limit to first parent"}} - {cmd t50= + {} {mc "Command to generate more commits to include:"}} + {perm b . {} {mc "Remember this view"}} + {reflabel l + {} {mc "References (space separated list):"}} + {refs t15 .. {} {mc "Branches & tags:"}} + {allrefs b *. "--all" {mc "All refs"}} + {branches b . "--branches" {mc "All (local) branches"}} + {tags b . "--tags" {mc "All tags"}} + {remotes b . "--remotes" {mc "All remote-tracking branches"}} + {commitlbl l + {} {mc "Commit Info (regular expressions):"}} + {author t15 .. "--author=*" {mc "Author:"}} + {committer t15 . "--committer=*" {mc "Committer:"}} + {loginfo t15 .. "--grep=*" {mc "Commit Message:"}} + {allmatch b .. "--all-match" {mc "Matches all Commit Info criteria"}} + {changes_l l + {} {mc "Changes to Files:"}} + {pickaxe_s r0 . {} {mc "Fixed String"}} + {pickaxe_t r1 . "--pickaxe-regex" {mc "Regular Expression"}} + {pickaxe t15 .. "-S*" {mc "Search string:"}} + {datelabel l + {} {mc "Commit Dates (\"2 weeks ago\", \"2009-03-17 15:27:38\", \"March 17, 2009 15:27:38\"):"}} + {since t15 .. {"--since=*" "--after=*"} {mc "Since:"}} + {until t15 . {"--until=*" "--before=*"} {mc "Until:"}} + {limit_lbl l + {} {mc "Limit and/or skip a number of revisions (positive integer):"}} + {limit t10 *. "--max-count=*" {mc "Number to show:"}} + {skip t10 . "--skip=*" {mc "Number to skip:"}} + {misc_lbl l + {} {mc "Miscellaneous options:"}} + {dorder b *. {"--date-order" "-d"} {mc "Strictly sort by date"}} + {lright b . "--left-right" {mc "Mark branch sides"}} + {first b . "--first-parent" {mc "Limit to first parent"}} + {args t50 *. {} {mc "Additional arguments to git log:"}} + {allpaths path + {} {mc "Enter files and directories to include, one per line:"}} + {cmd t50= + {} {mc "Command to generate more commits to include:"}} } proc encode_view_opts {n} { @@ -3693,13 +3711,19 @@ proc encode_view_opts {n} { if {$patterns eq {}} continue set pattern [lindex $patterns 0] - set val $newviewopts($n,[lindex $opt 0]) - if {[lindex $opt 1] eq "b"} { + set val $newviewopts($n,[lindex $opt 0]) if {$val} { lappend rargs $pattern } + } elseif {[regexp {^r(\d+)$} [lindex $opt 1] type value]} { + regexp {^(.*_)} [lindex $opt 0] uselessvar button_id + set val $newviewopts($n,$button_id) + if {$val eq $value} { + lappend rargs $pattern + } } else { + set val $newviewopts($n,[lindex $opt 0]) set val [string trim $val] if {$val ne {}} { set pfix [string range $pattern 0 end-1] @@ -3707,6 +3731,7 @@ proc encode_view_opts {n} { } } } + set rargs [concat $rargs [shellsplit $newviewopts($n,refs)]] return [concat $rargs [shellsplit $newviewopts($n,args)]] } @@ -3714,14 +3739,22 @@ proc decode_view_opts {n view_args} { global known_view_options newviewopts foreach opt $known_view_options { + set id [lindex $opt 0] if {[lindex $opt 1] eq "b"} { + # Checkboxes + set val 0 + } elseif {[regexp {^r(\d+)$} [lindex $opt 1]]} { + # Radiobuttons + regexp {^(.*_)} $id uselessvar id set val 0 } else { + # Text fields set val {} } - set newviewopts($n,[lindex $opt 0]) $val + set newviewopts($n,$id) $val } set oargs [list] + set refargs [list] foreach arg $view_args { if {[regexp -- {^-([0-9]+)$} $arg arg cnt] && ![info exists found(limit)]} { @@ -3735,11 +3768,17 @@ proc decode_view_opts {n view_args} { if {[info exists found($id)]} continue foreach pattern [lindex $opt 3] { if {![string match $pattern $arg]} continue - if {[lindex $opt 1] ne "b"} { + if {[lindex $opt 1] eq "b"} { + # Check buttons + set val 1 + } elseif {[regexp {^r(\d+)$} [lindex $opt 1] match num]} { + # Radio buttons + regexp {^(.*_)} $id uselessvar id + set val $num + } else { + # Text input fields set size [string length $pattern] set val [string range $arg [expr {$size-1}] end] - } else { - set val 1 } set newviewopts($n,$id) $val set found($id) 1 @@ -3748,8 +3787,13 @@ proc decode_view_opts {n view_args} { if {[info exists val]} break } if {[info exists val]} continue - lappend oargs $arg + if {[regexp {^-} $arg]} { + lappend oargs $arg + } else { + lappend refargs $arg + } } + set newviewopts($n,refs) [shellarglist $refargs] set newviewopts($n,args) [shellarglist $oargs] } @@ -3785,16 +3829,16 @@ proc vieweditor {top n title} { global known_view_options toplevel $top - wm title $top $title + wm title $top [concat $title "-- criteria for selecting revisions"] make_transient $top . # View name frame $top.nfr - label $top.nl -text [mc "Name"] + label $top.nl -text [mc "View Name:"] entry $top.name -width 20 -textvariable newviewname($n) pack $top.nfr -in $top -fill x -pady 5 -padx 3 - pack $top.nl -in $top.nfr -side left -padx {0 30} - pack $top.name -in $top.nfr -side left + pack $top.nl -in $top.nfr -side left -padx {0 5} + pack $top.name -in $top.nfr -side left -padx {0 25} # View options set cframe $top.nfr @@ -3813,14 +3857,28 @@ proc vieweditor {top n title} { frame $cframe pack $cframe -in $top -fill x -pady 3 -padx 3 set cexpand [expr {$flags eq "*"}] + } elseif {$flags eq ".." || $flags eq "*."} { + set cframe $top.fr$cnt + incr cnt + frame $cframe + pack $cframe -in $top -fill x -pady 3 -padx [list 15 3] + set cexpand [expr {$flags eq "*."}] } else { set lxpad 5 } - if {$type eq "b"} { + if {$type eq "l"} { + label $cframe.l_$id -text $title + pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w + } elseif {$type eq "b"} { checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id) pack $cframe.c_$id -in $cframe -side left \ -padx [list $lxpad 0] -expand $cexpand -anchor w + } elseif {[regexp {^r(\d+)$} $type type sz]} { + regexp {^(.*_)} $id uselessvar button_id + radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz + pack $cframe.c_$id -in $cframe -side left \ + -padx [list $lxpad 0] -expand $cexpand -anchor w } elseif {[regexp {^t(\d+)$} $type type sz]} { message $cframe.l_$id -aspect 1500 -text $title entry $cframe.e_$id -width $sz -background $bgcolor \ @@ -3833,23 +3891,22 @@ proc vieweditor {top n title} { -textvariable newviewopts($n,$id) pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w pack $cframe.e_$id -in $cframe -side top -fill x + } elseif {$type eq "path"} { + message $top.l -aspect 1500 -text $title + pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3 + text $top.t -width 40 -height 5 -background $bgcolor -font uifont + if {[info exists viewfiles($n)]} { + foreach f $viewfiles($n) { + $top.t insert end $f + $top.t insert end "\n" + } + $top.t delete {end - 1c} end + $top.t mark set insert 0.0 + } + pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3 } } - # Path list - message $top.l -aspect 1500 \ - -text [mc "Enter files and directories to include, one per line:"] - pack $top.l -in $top -side top -pady [list 7 0] -anchor w -padx 3 - text $top.t -width 40 -height 5 -background $bgcolor -font uifont - if {[info exists viewfiles($n)]} { - foreach f $viewfiles($n) { - $top.t insert end $f - $top.t insert end "\n" - } - $top.t delete {end - 1c} end - $top.t mark set insert 0.0 - } - pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3 frame $top.buts button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1] From 194bbf6cc8c2f3c14a920c841841d66b7667a848 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 18 May 2009 22:46:01 +0100 Subject: [PATCH 05/45] gitk: Handle msysGit version during version comparisons msysGit generates version strings with text appended which cannot be used with vcompare; trying to use them generates a Tcl error. Limit git_version to the first three digits which are the real git version to avoid this error. Signed-off-by: Pat Thoyts Signed-off-by: Paul Mackerras --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index 0804e6e36e..18553904f8 100755 --- a/gitk +++ b/gitk @@ -11152,7 +11152,7 @@ set nullid2 "0000000000000000000000000000000000000001" set nullfile "/dev/null" set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] -set git_version [lindex [exec git version] end] +set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .] set runq {} set history {} From d11b8d342529a8fe2164ceb563ad9213902d3533 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 20 May 2009 11:04:35 -0700 Subject: [PATCH 06/45] write-tree --ignore-cache-tree This allows you to discard the cache-tree information before writing the tree out of the index (i.e. it always recomputes the tree object names for all the subtrees). This is only useful as a debug option, so I did not bother documenting it. Signed-off-by: Junio C Hamano --- builtin-write-tree.c | 12 +++++++++--- cache-tree.c | 10 +++++++--- cache-tree.h | 7 ++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/builtin-write-tree.c b/builtin-write-tree.c index 9d640508dd..3a24ce8157 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -13,7 +13,7 @@ static const char write_tree_usage[] = int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) { - int missing_ok = 0, ret; + int flags = 0, ret; const char *prefix = NULL; unsigned char sha1[20]; const char *me = "git-write-tree"; @@ -22,9 +22,15 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) while (1 < argc) { const char *arg = argv[1]; if (!strcmp(arg, "--missing-ok")) - missing_ok = 1; + flags |= WRITE_TREE_MISSING_OK; else if (!prefixcmp(arg, "--prefix=")) prefix = arg + 9; + else if (!prefixcmp(arg, "--ignore-cache-tree")) + /* + * This is only useful for debugging, so I + * do not bother documenting it. + */ + flags |= WRITE_TREE_IGNORE_CACHE_TREE; else usage(write_tree_usage); argc--; argv++; @@ -33,7 +39,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) if (argc > 2) die("too many options"); - ret = write_cache_as_tree(sha1, missing_ok, prefix); + ret = write_cache_as_tree(sha1, flags, prefix); switch (ret) { case 0: printf("%s\n", sha1_to_hex(sha1)); diff --git a/cache-tree.c b/cache-tree.c index 37bf35e636..6dd8411945 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -538,28 +538,32 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat return it; } -int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix) +int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix) { int entries, was_valid, newfd; + struct lock_file *lock_file; /* * We can't free this memory, it becomes part of a linked list * parsed atexit() */ - struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); + lock_file = xcalloc(1, sizeof(struct lock_file)); newfd = hold_locked_index(lock_file, 1); entries = read_cache(); if (entries < 0) return WRITE_TREE_UNREADABLE_INDEX; + if (flags & WRITE_TREE_IGNORE_CACHE_TREE) + cache_tree_free(&(active_cache_tree)); if (!active_cache_tree) active_cache_tree = cache_tree(); was_valid = cache_tree_fully_valid(active_cache_tree); - if (!was_valid) { + int missing_ok = flags & WRITE_TREE_MISSING_OK; + if (cache_tree_update(active_cache_tree, active_cache, active_nr, missing_ok, 0) < 0) diff --git a/cache-tree.h b/cache-tree.h index e958835236..eadcad8adc 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -30,11 +30,16 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size); int cache_tree_fully_valid(struct cache_tree *); int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int); +/* bitmasks to write_cache_as_tree flags */ +#define WRITE_TREE_MISSING_OK 1 +#define WRITE_TREE_IGNORE_CACHE_TREE 2 + +/* error return codes */ #define WRITE_TREE_UNREADABLE_INDEX (-1) #define WRITE_TREE_UNMERGED_INDEX (-2) #define WRITE_TREE_PREFIX_ERROR (-3) -int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix); +int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix); void prime_cache_tree(struct cache_tree **, struct tree *); #endif From f687aaa83371f0fd9aa41e62cd74405491ddab78 Mon Sep 17 00:00:00 2001 From: Dirk Suesserott Date: Thu, 21 May 2009 15:35:40 +0200 Subject: [PATCH 07/45] gitk: Add option 'Simple history' to the options menu When clicked, the option --simplify-by-decoration is added to gitk/git log. This yields to a simplified history where only decorated commits are shown, i.e. those with a yellow tag or a green branch flag. Signed-off-by: Dirk Suesserott Signed-off-by: Paul Mackerras --- gitk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitk b/gitk index 18553904f8..d48fbad857 100755 --- a/gitk +++ b/gitk @@ -187,7 +187,8 @@ proc parseviewargs {n arglist} { "--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" - "--author=*" - "--committer=*" - "--grep=*" - "-[iE]" - "--remove-empty" - "--first-parent" - "--cherry-pick" - - "-S*" - "--pickaxe-all" - "--pickaxe-regex" { + "-S*" - "--pickaxe-all" - "--pickaxe-regex" - + "--simplify-by-decoration" { # These mean that we get a subset of the commits set filtered 1 lappend glflags $arg @@ -3697,6 +3698,7 @@ set known_view_options { {dorder b *. {"--date-order" "-d"} {mc "Strictly sort by date"}} {lright b . "--left-right" {mc "Mark branch sides"}} {first b . "--first-parent" {mc "Limit to first parent"}} + {smplhst b . "--simplify-by-decoration" {mc "Simple history"}} {args t50 *. {} {mc "Additional arguments to git log:"}} {allpaths path + {} {mc "Enter files and directories to include, one per line:"}} {cmd t50= + {} {mc "Command to generate more commits to include:"}} From e0a0199581ea30abb58ba812047657b35f4ee639 Mon Sep 17 00:00:00 2001 From: Michele Ballabio Date: Sat, 23 May 2009 11:48:25 +0200 Subject: [PATCH 08/45] gitk: Add another string to translation Signed-off-by: Michele Ballabio Signed-off-by: Paul Mackerras --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index d48fbad857..72b0b0df7a 100755 --- a/gitk +++ b/gitk @@ -3831,7 +3831,7 @@ proc vieweditor {top n title} { global known_view_options toplevel $top - wm title $top [concat $title "-- criteria for selecting revisions"] + wm title $top [concat $title [mc "-- criteria for selecting revisions"]] make_transient $top . # View name From a41ddbb649c72214a4861827eedc7b2eebe0608f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Sat, 23 May 2009 19:31:37 +0200 Subject: [PATCH 09/45] gitk: Allow diff view without context lines Signed-off-by: Markus Heidelberg Signed-off-by: Paul Mackerras --- gitk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 72b0b0df7a..4604c831fe 100755 --- a/gitk +++ b/gitk @@ -2146,7 +2146,7 @@ proc makewindow {} { label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left spinbox .bleft.mid.diffcontext -width 5 -font textfont \ - -from 1 -increment 1 -to 10000000 \ + -from 0 -increment 1 -to 10000000 \ -validate all -validatecommand "diffcontextvalidate %P" \ -textvariable diffcontextstring .bleft.mid.diffcontext set $diffcontext @@ -7308,7 +7308,7 @@ proc diffcontextchange {n1 n2 op} { global diffcontextstring diffcontext if {[string is integer -strict $diffcontextstring]} { - if {$diffcontextstring > 0} { + if {$diffcontextstring >= 0} { set diffcontext $diffcontextstring reselectline } From b87fc96476c4218de044cf77b4c6d10d49aee78a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 20 May 2009 15:53:57 -0700 Subject: [PATCH 10/45] cache-tree.c::cache_tree_find(): simplify internal API Earlier cache_tree_find() needs to be called with a valid cache_tree, but repeated look-up may find an invalid or missing cache_tree in between. Help simplify the callers by returning NULL to mean "nothing appropriate found" when the input is NULL. Signed-off-by: Junio C Hamano --- cache-tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cache-tree.c b/cache-tree.c index 6dd8411945..5481e43340 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -514,6 +514,8 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size) static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path) { + if (!it) + return NULL; while (*path) { const char *slash; struct cache_tree_sub *sub; From aceae2ef9261718324bf1853401d5ee9686a54a8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 22 May 2009 23:06:58 -0700 Subject: [PATCH 11/45] t4007: modernize the style This is one of the oldest scripts; update it to match more modern style. Notably, we should: - Put the test title on the same line as the "test_expect_success", and end the line with a single-quote to begin the body of the test which is one multi-line string; and - Run as many commands inside test_expect_success, not outside, to catch unexpected breakages. Signed-off-by: Junio C Hamano --- t/t4007-rename-3.sh | 67 +++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh index 42072d724e..25e7a83659 100755 --- a/t/t4007-rename-3.sh +++ b/t/t4007-rename-3.sh @@ -9,32 +9,31 @@ test_description='Rename interaction with pathspec. . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash -test_expect_success \ - 'prepare reference tree' \ - 'mkdir path0 path1 && - cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && - git update-index --add path0/COPYING && - tree=$(git write-tree) && - echo $tree' +test_expect_success 'prepare reference tree' ' + mkdir path0 path1 && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && + git update-index --add path0/COPYING && + tree=$(git write-tree) && + echo $tree +' -test_expect_success \ - 'prepare work tree' \ - 'cp path0/COPYING path1/COPYING && - git update-index --add --remove path0/COPYING path1/COPYING' +test_expect_success 'prepare work tree' ' + cp path0/COPYING path1/COPYING && + git update-index --add --remove path0/COPYING path1/COPYING +' # In the tree, there is only path0/COPYING. In the cache, path0 and # path1 both have COPYING and the latter is a copy of path0/COPYING. # Comparing the full tree with cache should tell us so. -git diff-index -C --find-copies-harder $tree >current - cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING EOF -test_expect_success \ - 'validate the result (#1)' \ - 'compare_diff_raw current expected' +test_expect_success 'copy detection' ' + git diff-index -C --find-copies-harder $tree >current && + compare_diff_raw current expected +' # In the tree, there is only path0/COPYING. In the cache, path0 and # path1 both have COPYING and the latter is a copy of path0/COPYING. @@ -42,49 +41,45 @@ test_expect_success \ # path1/COPYING suddenly appearing from nowhere, not detected as # a copy from path0/COPYING. -git diff-index -C $tree path1 >current - cat >expected <<\EOF :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING EOF -test_expect_success \ - 'validate the result (#2)' \ - 'compare_diff_raw current expected' - -test_expect_success \ - 'tweak work tree' \ - 'rm -f path0/COPYING && - git update-index --remove path0/COPYING' +test_expect_success 'copy, limited to a subtree' ' + git diff-index -C --find-copies-harder $tree path1 >current && + compare_diff_raw current expected +' +test_expect_success 'tweak work tree' ' + rm -f path0/COPYING && + git update-index --remove path0/COPYING +' # In the tree, there is only path0/COPYING. In the cache, path0 does # not have COPYING anymore and path1 has COPYING which is a copy of # path0/COPYING. Showing the full tree with cache should tell us about # the rename. -git diff-index -C $tree >current - cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING EOF -test_expect_success \ - 'validate the result (#3)' \ - 'compare_diff_raw current expected' +test_expect_success 'rename detection' ' + git diff-index -C --find-copies-harder $tree >current && + compare_diff_raw current expected +' # In the tree, there is only path0/COPYING. In the cache, path0 does # not have COPYING anymore and path1 has COPYING which is a copy of # path0/COPYING. When we say we care only about path1, we should just # see path1/COPYING appearing from nowhere. -git diff-index -C $tree path1 >current - cat >expected <<\EOF :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING EOF -test_expect_success \ - 'validate the result (#4)' \ - 'compare_diff_raw current expected' +test_expect_success 'rename, limited to a subtree' ' + git diff-index -C --find-copies-harder $tree path1 >current && + compare_diff_raw current expected +' test_done From b65982b60876c8f5f4d3b2898d5174f4812552b1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 20 May 2009 15:57:22 -0700 Subject: [PATCH 12/45] Optimize "diff-index --cached" using cache-tree When running "diff-index --cached" after making a change to only a small portion of the index, there is no point unpacking unchanged subtrees into the index recursively, only to find that all entries match anyway. Tweak unpack_trees() logic that is used to read in the tree object to catch the case where the tree entry we are looking at matches the index as a whole by looking at the cache-tree. As an exercise, after modifying a few paths in the kernel tree, here are a few numbers on my Athlon 64X2 3800+: (without patch, hot cache) $ /usr/bin/time git diff --cached --raw :100644 100644 b57e1f5... e69de29... M Makefile :100644 000000 8c86b72... 0000000... D arch/x86/Makefile :000000 100644 0000000... e69de29... A arche 0.07user 0.02system 0:00.09elapsed 102%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+9407minor)pagefaults 0swaps (with patch, hot cache) $ /usr/bin/time ../git.git/git-diff --cached --raw :100644 100644 b57e1f5... e69de29... M Makefile :100644 000000 8c86b72... 0000000... D arch/x86/Makefile :000000 100644 0000000... e69de29... A arche 0.02user 0.00system 0:00.02elapsed 103%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2446minor)pagefaults 0swaps Cold cache numbers are very impressive, but it does not matter very much in practice: (without patch, cold cache) $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches' $ /usr/bin/time git diff --cached --raw :100644 100644 b57e1f5... e69de29... M Makefile :100644 000000 8c86b72... 0000000... D arch/x86/Makefile :000000 100644 0000000... e69de29... A arche 0.06user 0.17system 0:10.26elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k 247032inputs+0outputs (1172major+8237minor)pagefaults 0swaps (with patch, cold cache) $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches' $ /usr/bin/time ../git.git/git-diff --cached --raw :100644 100644 b57e1f5... e69de29... M Makefile :100644 000000 8c86b72... 0000000... D arch/x86/Makefile :000000 100644 0000000... e69de29... A arche 0.02user 0.01system 0:01.01elapsed 3%CPU (0avgtext+0avgdata 0maxresident)k 18440inputs+0outputs (79major+2369minor)pagefaults 0swaps This of course helps "git status" as well. (without patch, hot cache) $ /usr/bin/time ../git.git/git-status >/dev/null 0.17user 0.18system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+5336outputs (0major+10970minor)pagefaults 0swaps (with patch, hot cache) $ /usr/bin/time ../git.git/git-status >/dev/null 0.10user 0.16system 0:00.27elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+5336outputs (0major+3921minor)pagefaults 0swaps Signed-off-by: Junio C Hamano --- cache-tree.c | 32 ++++++++++++++++++++++++++++++++ cache-tree.h | 3 +++ diff-lib.c | 2 ++ unpack-trees.c | 17 +++++++++++++++++ unpack-trees.h | 1 + 5 files changed, 55 insertions(+) diff --git a/cache-tree.c b/cache-tree.c index 5481e43340..16a65dfac1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -631,3 +631,35 @@ void prime_cache_tree(struct cache_tree **it, struct tree *tree) *it = cache_tree(); prime_cache_tree_rec(*it, tree); } + +/* + * find the cache_tree that corresponds to the current level without + * exploding the full path into textual form. The root of the + * cache tree is given as "root", and our current level is "info". + * (1) When at root level, info->prev is NULL, so it is "root" itself. + * (2) Otherwise, find the cache_tree that corresponds to one level + * above us, and find ourselves in there. + */ +static struct cache_tree *find_cache_tree_from_traversal(struct cache_tree *root, + struct traverse_info *info) +{ + struct cache_tree *our_parent; + + if (!info->prev) + return root; + our_parent = find_cache_tree_from_traversal(root, info->prev); + return cache_tree_find(our_parent, info->name.path); +} + +int cache_tree_matches_traversal(struct cache_tree *root, + struct name_entry *ent, + struct traverse_info *info) +{ + struct cache_tree *it; + + it = find_cache_tree_from_traversal(root, info); + it = cache_tree_find(it, ent->path); + if (it && it->entry_count > 0 && !hashcmp(ent->sha1, it->sha1)) + return it->entry_count; + return 0; +} diff --git a/cache-tree.h b/cache-tree.h index eadcad8adc..3df641f593 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -2,6 +2,7 @@ #define CACHE_TREE_H #include "tree.h" +#include "tree-walk.h" struct cache_tree; struct cache_tree_sub { @@ -42,4 +43,6 @@ int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int) int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix); void prime_cache_tree(struct cache_tree **, struct tree *); +extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info); + #endif diff --git a/diff-lib.c b/diff-lib.c index a310fb2ad0..1cb97af22d 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -446,6 +446,7 @@ int run_diff_index(struct rev_info *revs, int cached) memset(&opts, 0, sizeof(opts)); opts.head_idx = 1; opts.index_only = cached; + opts.diff_index_cached = cached; opts.merge = 1; opts.fn = oneway_diff; opts.unpack_data = revs; @@ -502,6 +503,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt) memset(&opts, 0, sizeof(opts)); opts.head_idx = 1; opts.index_only = 1; + opts.diff_index_cached = 1; opts.merge = 1; opts.fn = oneway_diff; opts.unpack_data = &revs; diff --git a/unpack-trees.c b/unpack-trees.c index aaacaf1015..8eb3ddb392 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -326,6 +326,23 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str if (src[0]) conflicts |= 1; } + + /* special case: "diff-index --cached" looking at a tree */ + if (o->diff_index_cached && + n == 1 && dirmask == 1 && S_ISDIR(names->mode)) { + int matches; + matches = cache_tree_matches_traversal(o->src_index->cache_tree, + names, info); + /* + * Everything under the name matches. Adjust o->pos to + * skip the entire hierarchy. + */ + if (matches) { + o->pos += matches; + return mask; + } + } + if (traverse_trees_recursive(n, dirmask, conflicts, names, info) < 0) return -1; diff --git a/unpack-trees.h b/unpack-trees.h index 0d26f3d73e..1e0e2325f1 100644 --- a/unpack-trees.h +++ b/unpack-trees.h @@ -27,6 +27,7 @@ struct unpack_trees_options { aggressive:1, skip_unmerged:1, initial_checkout:1, + diff_index_cached:1, gently:1; const char *prefix; int pos; From a0919ced8a5efe938cf97c74a0f851cbbe00aaf6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 22 May 2009 23:14:25 -0700 Subject: [PATCH 13/45] Avoid "diff-index --cached" optimization under --find-copies-harder When find-copies-harder is in effect, the diff frontends are expected to feed all paths, not just changed paths, to the diffcore, so that copy sources can be picked up. In such a case, not descending into subtrees using the cache-tree information is simply wrong. Signed-off-by: Junio C Hamano --- diff-lib.c | 5 +++-- t/t4007-rename-3.sh | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/diff-lib.c b/diff-lib.c index 1cb97af22d..ae75eacbcc 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -446,7 +446,8 @@ int run_diff_index(struct rev_info *revs, int cached) memset(&opts, 0, sizeof(opts)); opts.head_idx = 1; opts.index_only = cached; - opts.diff_index_cached = cached; + opts.diff_index_cached = (cached && + !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER)); opts.merge = 1; opts.fn = oneway_diff; opts.unpack_data = revs; @@ -503,7 +504,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt) memset(&opts, 0, sizeof(opts)); opts.head_idx = 1; opts.index_only = 1; - opts.diff_index_cached = 1; + opts.diff_index_cached = !DIFF_OPT_TST(opt, FIND_COPIES_HARDER); opts.merge = 1; opts.fn = oneway_diff; opts.unpack_data = &revs; diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh index 25e7a83659..11502b7509 100755 --- a/t/t4007-rename-3.sh +++ b/t/t4007-rename-3.sh @@ -35,6 +35,11 @@ test_expect_success 'copy detection' ' compare_diff_raw current expected ' +test_expect_success 'copy detection, cached' ' + git diff-index -C --find-copies-harder --cached $tree >current && + compare_diff_raw current expected +' + # In the tree, there is only path0/COPYING. In the cache, path0 and # path1 both have COPYING and the latter is a copy of path0/COPYING. # However when we say we care only about path1, we should just see From b7dd2d20fad1036ce7da0b635a8bb14cd4230f1a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 27 May 2009 15:23:12 -0400 Subject: [PATCH 14/45] for-each-ref: Do not lookup objects when they will not be used This makes commands such as `git for-each-ref --format='%(refname)'`, which are used heavily by the bash_completion code, run about 6 times faster on an uncached repository (3 s intead of 18 s on my linux-2.6 repository with several remotes). Signed-off-by: Anders Kaseorg Signed-off-by: Junio C Hamano --- builtin-for-each-ref.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index d091e04af9..1911cda1c2 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -561,14 +561,6 @@ static void populate_value(struct refinfo *ref) ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt); - buf = get_obj(ref->objectname, &obj, &size, &eaten); - if (!buf) - die("missing object %s for %s", - sha1_to_hex(ref->objectname), ref->refname); - if (!obj) - die("parse_object_buffer failed on %s for %s", - sha1_to_hex(ref->objectname), ref->refname); - /* Fill in specials first */ for (i = 0; i < used_atom_cnt; i++) { const char *name = used_atom[i]; @@ -621,6 +613,22 @@ static void populate_value(struct refinfo *ref) } } + for (i = 0; i < used_atom_cnt; i++) { + struct atom_value *v = &ref->value[i]; + if (v->s == NULL) + goto need_obj; + } + return; + + need_obj: + buf = get_obj(ref->objectname, &obj, &size, &eaten); + if (!buf) + die("missing object %s for %s", + sha1_to_hex(ref->objectname), ref->refname); + if (!obj) + die("parse_object_buffer failed on %s for %s", + sha1_to_hex(ref->objectname), ref->refname); + grab_values(ref->value, 0, obj, buf, size); if (!eaten) free(buf); @@ -926,7 +934,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) memset(&cbdata, 0, sizeof(cbdata)); cbdata.grab_pattern = argv; - for_each_ref(grab_single_ref, &cbdata); + for_each_rawref(grab_single_ref, &cbdata); refs = cbdata.grab_array; num_refs = cbdata.grab_cnt; From 42b491786260eb17d97ea9fb1c4b70075bca9523 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 3 Jun 2009 00:59:12 +0200 Subject: [PATCH 15/45] git-submodule: add support for --merge. 'git submodule update --merge' merges the commit referenced by the superproject into your local branch, instead of checking it out on a detached HEAD. As evidenced by the addition of "git submodule update --rebase", it is useful to provide alternatives to the default 'checkout' behaviour of "git submodule update". One such alternative is, when updating a submodule to a new commit, to merge that commit into the current local branch in that submodule. This is useful in workflows where you want to update your submodule from its upstream, but you cannot use --rebase, because you have downstream people working on top of your submodule branch, and you don't want to disrupt their work. Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- Documentation/git-submodule.txt | 15 +++++++-- Documentation/gitmodules.txt | 6 ++-- git-submodule.sh | 11 +++++- t/t7406-submodule-update.sh | 60 ++++++++++++++++++++++++++++++++- 4 files changed, 86 insertions(+), 6 deletions(-) diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index f993469dc6..2289d11f0e 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -113,8 +113,9 @@ init:: update:: Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the containing repository. - This will make the submodules HEAD be detached unless '--rebase' is - specified or the key `submodule.$name.update` is set to `rebase`. + This will make the submodules HEAD be detached unless '--rebase' or + '--merge' is specified or the key `submodule.$name.update` is set to + `rebase` or `merge`. + If the submodule is not yet initialized, and you just want to use the setting as stored in .gitmodules, you can automatically initialize the @@ -187,6 +188,16 @@ OPTIONS If the key `submodule.$name.update` is set to `rebase`, this option is implicit. +--merge:: + This option is only valid for the update command. + Merge the commit recorded in the superproject into the current branch + of the submodule. If this option is given, the submodule's HEAD will + not be detached. If a merge failure prevents this process, you will + have to resolve the resulting conflicts within the submodule with the + usual conflict resolution tools. + If the key `submodule.$name.update` is set to `merge`, this option is + implicit. + ...:: Paths to submodule(s). When specified this will restrict the command to only operate on the submodules found at the specified paths. diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt index 1b67f0a9f1..5daf750d19 100644 --- a/Documentation/gitmodules.txt +++ b/Documentation/gitmodules.txt @@ -35,9 +35,11 @@ submodule..update:: If 'checkout' (the default), the new commit specified in the superproject will be checked out in the submodule on a detached HEAD. If 'rebase', the current branch of the submodule will be rebased onto - the commit specified in the superproject. + the commit specified in the superproject. If 'merge', the commit + specified in the superproject will be merged into the current branch + in the submodule. This config option is overridden if 'git submodule update' is given - the '--rebase' option. + the '--merge' or '--rebase' options. EXAMPLES diff --git a/git-submodule.sh b/git-submodule.sh index f384c6b2b4..3aff37970a 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -5,7 +5,7 @@ # Copyright (c) 2007 Lars Hjemli USAGE="[--quiet] [--cached] \ -[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit ] []] \ +[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit ] []] \ [--] [...]|[foreach ]|[sync [--] [...]]" OPTIONS_SPEC= . git-sh-setup @@ -331,6 +331,10 @@ cmd_update() shift update="rebase" ;; + -m|--merge) + shift + update="merge" + ;; --) shift break @@ -396,6 +400,11 @@ cmd_update() action="rebase" msg="rebased onto" ;; + merge) + command="git merge" + action="merge" + msg="merged in" + ;; *) command="git checkout $force -q" action="checkout" diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index 0773fe405b..2d33d9efec 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -6,7 +6,7 @@ test_description='Test updating submodules This test verifies that "git submodule update" detaches the HEAD of the -submodule and "git submodule update --rebase" does not detach the HEAD. +submodule and "git submodule update --rebase/--merge" does not detach the HEAD. ' . ./test-lib.sh @@ -76,6 +76,20 @@ test_expect_success 'submodule update --rebase staying on master' ' ) ' +test_expect_success 'submodule update --merge staying on master' ' + (cd super/submodule && + git reset --hard HEAD~1 + ) && + (cd super && + (cd submodule && + compare_head + ) && + git submodule update --merge submodule && + cd submodule && + compare_head + ) +' + test_expect_success 'submodule update - rebase in .git/config' ' (cd super && git config submodule.submodule.update rebase @@ -110,6 +124,40 @@ test_expect_success 'submodule update - checkout in .git/config but --rebase giv ) ' +test_expect_success 'submodule update - merge in .git/config' ' + (cd super && + git config submodule.submodule.update merge + ) && + (cd super/submodule && + git reset --hard HEAD~1 + ) && + (cd super && + (cd submodule && + compare_head + ) && + git submodule update submodule && + cd submodule && + compare_head + ) +' + +test_expect_success 'submodule update - checkout in .git/config but --merge given' ' + (cd super && + git config submodule.submodule.update checkout + ) && + (cd super/submodule && + git reset --hard HEAD~1 + ) && + (cd super && + (cd submodule && + compare_head + ) && + git submodule update --merge submodule && + cd submodule && + compare_head + ) +' + test_expect_success 'submodule update - checkout in .git/config' ' (cd super && git config submodule.submodule.update checkout @@ -137,4 +185,14 @@ test_expect_success 'submodule init picks up rebase' ' ) ' +test_expect_success 'submodule init picks up merge' ' + (cd super && + git config submodule.merging.url git://non-existing/git && + git config submodule.merging.path does-not-matter && + git config submodule.merging.update merge && + git submodule init merging && + test "merge" = $(git config submodule.merging.update) + ) +' + test_done From e3a0ca878457ecc70d0065802fcb0c6875c6b671 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 4 Jun 2009 16:43:56 -0700 Subject: [PATCH 16/45] parse-options: make OPT_INTEGER's argh explicit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OPTION_INTEGER hardcodes its argh member to be "n", but the decision is hidden deep in usage_with_options_internal(). Make "n" the default argh for the OPT_INTEGER macro while leaving it undecided for the OPTION_INTEGER enum. This makes it less surprising to users that argh is "n" when using the OPT_INTEGER macro. Signed-off-by: Stephen Boyd Reviewed-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin-tag.c | 4 ++-- parse-options.c | 11 ++--------- parse-options.h | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/builtin-tag.c b/builtin-tag.c index dc3db62811..080e04a8fc 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -376,8 +376,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix) struct commit_list *with_commit = NULL; struct option options[] = { OPT_BOOLEAN('l', NULL, &list, "list tag names"), - { OPTION_INTEGER, 'n', NULL, &lines, NULL, - "print n lines of each tag message", + { OPTION_INTEGER, 'n', NULL, &lines, "n", + "print lines of each tag message", PARSE_OPT_OPTARG, NULL, 1 }, OPT_BOOLEAN('d', NULL, &delete, "delete tags"), OPT_BOOLEAN('v', NULL, &verify, "verify tags"), diff --git a/parse-options.c b/parse-options.c index b85cab2466..48ba62b0d8 100644 --- a/parse-options.c +++ b/parse-options.c @@ -503,19 +503,12 @@ int usage_with_options_internal(const char * const *usagestr, switch (opts->type) { case OPTION_ARGUMENT: break; - case OPTION_INTEGER: - if (opts->flags & PARSE_OPT_OPTARG) - if (opts->long_name) - pos += fprintf(stderr, "[=]"); - else - pos += fprintf(stderr, "[]"); - else - pos += fprintf(stderr, " "); - break; case OPTION_CALLBACK: if (opts->flags & PARSE_OPT_NOARG) break; /* FALLTHROUGH */ + case OPTION_INTEGER: + /* FALLTHROUGH */ case OPTION_FILENAME: /* FALLTHROUGH */ case OPTION_STRING: diff --git a/parse-options.h b/parse-options.h index b374ade95c..b141ae647a 100644 --- a/parse-options.h +++ b/parse-options.h @@ -108,7 +108,7 @@ struct option { #define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) } #define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) } #define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) } -#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) } +#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) } #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } #define OPT_DATE(s, l, v, h) \ { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \ From 34aec9f573af8e6fbe06285d660d9e1a84950e4c Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 4 Jun 2009 16:43:57 -0700 Subject: [PATCH 17/45] parse-options: simplify usage argh handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify the argh printing by simply calling usage_argh() if the option can take an argument. Update macros defined in parse-options.h to set the PARSE_OPT_NOARG flag. The only other user of custom non-argument taking options is git-apply (in this case OPTION_BOOLEAN for deprecated options). Update it to set the PARSE_OPT_NOARG flag. Thanks to Ren辿 Scharfe for the suggestion and starter patch. Signed-off-by: Stephen Boyd Reviewd-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin-apply.c | 6 ++++-- parse-options.c | 33 ++++----------------------------- parse-options.h | 20 +++++++++++++------- 3 files changed, 21 insertions(+), 38 deletions(-) diff --git a/builtin-apply.c b/builtin-apply.c index 94ba2bdd5b..89a5185cea 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -3277,9 +3277,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix) OPT_BOOLEAN(0, "stat", &diffstat, "instead of applying the patch, output diffstat for the input"), { OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary, - NULL, "old option, now no-op", PARSE_OPT_HIDDEN }, + NULL, "old option, now no-op", + PARSE_OPT_HIDDEN | PARSE_OPT_NOARG }, { OPTION_BOOLEAN, 0, "binary", &binary, - NULL, "old option, now no-op", PARSE_OPT_HIDDEN }, + NULL, "old option, now no-op", + PARSE_OPT_HIDDEN | PARSE_OPT_NOARG }, OPT_BOOLEAN(0, "numstat", &numstat, "shows number of added and deleted lines in decimal notation"), OPT_BOOLEAN(0, "summary", &summary, diff --git a/parse-options.c b/parse-options.c index 48ba62b0d8..e469fc06fa 100644 --- a/parse-options.c +++ b/parse-options.c @@ -440,7 +440,7 @@ int parse_options(int argc, const char **argv, const char *prefix, static int usage_argh(const struct option *opts) { const char *s; - int literal = opts->flags & PARSE_OPT_LITERAL_ARGHELP; + int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) || !opts->argh; if (opts->flags & PARSE_OPT_OPTARG) if (opts->long_name) s = literal ? "[=%s]" : "[=<%s>]"; @@ -448,7 +448,7 @@ static int usage_argh(const struct option *opts) s = literal ? "[%s]" : "[<%s>]"; else s = literal ? " %s" : " <%s>"; - return fprintf(stderr, s, opts->argh); + return fprintf(stderr, s, opts->argh ? opts->argh : "..."); } #define USAGE_OPTS_WIDTH 24 @@ -500,33 +500,8 @@ int usage_with_options_internal(const char * const *usagestr, if (opts->type == OPTION_NUMBER) pos += fprintf(stderr, "-NUM"); - switch (opts->type) { - case OPTION_ARGUMENT: - break; - case OPTION_CALLBACK: - if (opts->flags & PARSE_OPT_NOARG) - break; - /* FALLTHROUGH */ - case OPTION_INTEGER: - /* FALLTHROUGH */ - case OPTION_FILENAME: - /* FALLTHROUGH */ - case OPTION_STRING: - if (opts->argh) - pos += usage_argh(opts); - else { - if (opts->flags & PARSE_OPT_OPTARG) - if (opts->long_name) - pos += fprintf(stderr, "[=...]"); - else - pos += fprintf(stderr, "[...]"); - else - pos += fprintf(stderr, " ..."); - } - break; - default: /* OPTION_{BIT,BOOLEAN,NUMBER,SET_INT,SET_PTR} */ - break; - } + if (!(opts->flags & PARSE_OPT_NOARG)) + pos += usage_argh(opts); if (pos <= USAGE_OPTS_WIDTH) pad = USAGE_OPTS_WIDTH - pos; diff --git a/parse-options.h b/parse-options.h index b141ae647a..f65aca3a94 100644 --- a/parse-options.h +++ b/parse-options.h @@ -67,7 +67,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset); * `flags`:: * mask of parse_opt_option_flags. * PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs) - * PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs + * PARSE_OPT_NOARG: says that this option takes no argument * PARSE_OPT_NONEG: says that this option cannot be negated * PARSE_OPT_HIDDEN: this option is skipped in the default usage, and * shown only in the full usage. @@ -101,13 +101,19 @@ struct option { }; #define OPT_END() { OPTION_END } -#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) } +#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, \ + (h), PARSE_OPT_NOARG} #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) } -#define OPT_BIT(s, l, v, h, b) { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) } -#define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, (h), 0, NULL, (b) } -#define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) } -#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) } -#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) } +#define OPT_BIT(s, l, v, h, b) { OPTION_BIT, (s), (l), (v), NULL, (h), \ + PARSE_OPT_NOARG, NULL, (b) } +#define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, \ + (h), PARSE_OPT_NOARG, NULL, (b) } +#define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, \ + (h), PARSE_OPT_NOARG } +#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, \ + (h), PARSE_OPT_NOARG, NULL, (i) } +#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, \ + (h), PARSE_OPT_NOARG, NULL, (p) } #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) } #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } #define OPT_DATE(s, l, v, h) \ From 934f82a7d424ea9a8fa0ae83020689d11efc2bff Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Mon, 8 Jun 2009 20:46:38 -0700 Subject: [PATCH 18/45] fix handling of iconv configuration options Fix the way in which the configure script handles --without-iconv (and --with-iconv=no), which it used to essentially ignore. Also fix the way the configure script determines the value of NEEDS_LIBICONV, which would be incorrectly set to 'YesPlease' on systems that lack iconv entirely. Signed-off-by: Marco Nelissen Signed-off-by: Junio C Hamano --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 4e728bca35..25fbe3bb6b 100644 --- a/configure.ac +++ b/configure.ac @@ -385,6 +385,8 @@ AC_SUBST(NO_EXPAT) # some Solaris installations). # Define NO_ICONV if neither libc nor libiconv support iconv. +if test -z "$NO_ICONV"; then + GIT_STASH_FLAGS($ICONVDIR) AC_DEFUN([ICONVTEST_SRC], [ @@ -431,6 +433,12 @@ GIT_UNSTASH_FLAGS($ICONVDIR) AC_SUBST(NEEDS_LIBICONV) AC_SUBST(NO_ICONV) +if test -n "$NO_ICONV"; then + NEEDS_LIBICONV= +fi + +fi + # # Define NO_DEFLATE_BOUND if deflateBound is missing from zlib. From 203462347fce0eab563fe77640648a7e8ae64d3b Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Tue, 9 Jun 2009 18:01:34 +0200 Subject: [PATCH 19/45] Allow push and fetch urls to be different This introduces a config setting remote.$remotename.pushurl which is used for pushes only. If absent remote.$remotename.url is used for pushes and fetches as before. This is useful, for example, in order to do passwordless fetches (remote update) over the git transport but pushes over ssh. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- Documentation/config.txt | 3 +++ Documentation/urls-remotes.txt | 3 +++ builtin-push.c | 17 +++++++++++++---- remote.c | 14 ++++++++++++++ remote.h | 4 ++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 3a86d1f8f0..2fecbe32a6 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1319,6 +1319,9 @@ remote..url:: The URL of a remote repository. See linkgit:git-fetch[1] or linkgit:git-push[1]. +remote..pushurl:: + The push URL of a remote repository. See linkgit:git-push[1]. + remote..proxy:: For remotes that require curl (http, https and ftp), the URL to the proxy to use for that remote. Set to the empty string to diff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt index 41ec7774f4..2a0e7b8944 100644 --- a/Documentation/urls-remotes.txt +++ b/Documentation/urls-remotes.txt @@ -27,10 +27,13 @@ config file would appear like this: ------------ [remote ""] url = + pushurl = push = fetch = ------------ +The `` is used for pushes only. It is optional and defaults +to ``. Named file in `$GIT_DIR/remotes` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/builtin-push.c b/builtin-push.c index c869974013..7be12399b6 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -117,6 +117,8 @@ static int do_push(const char *repo, int flags) { int i, errs; struct remote *remote = remote_get(repo); + const char **url; + int url_nr; if (!remote) { if (repo) @@ -152,9 +154,16 @@ static int do_push(const char *repo, int flags) setup_default_push_refspecs(); } errs = 0; - for (i = 0; i < remote->url_nr; i++) { + if (remote->pushurl_nr) { + url = remote->pushurl; + url_nr = remote->pushurl_nr; + } else { + url = remote->url; + url_nr = remote->url_nr; + } + for (i = 0; i < url_nr; i++) { struct transport *transport = - transport_get(remote, remote->url[i]); + transport_get(remote, url[i]); int err; if (receivepack) transport_set_option(transport, @@ -163,14 +172,14 @@ static int do_push(const char *repo, int flags) transport_set_option(transport, TRANS_OPT_THIN, "yes"); if (flags & TRANSPORT_PUSH_VERBOSE) - fprintf(stderr, "Pushing to %s\n", remote->url[i]); + fprintf(stderr, "Pushing to %s\n", url[i]); err = transport_push(transport, refspec_nr, refspec, flags); err |= transport_disconnect(transport); if (!err) continue; - error("failed to push some refs to '%s'", remote->url[i]); + error("failed to push some refs to '%s'", url[i]); errs++; } return !!errs; diff --git a/remote.c b/remote.c index 2c3e9053a4..4544d65c72 100644 --- a/remote.c +++ b/remote.c @@ -106,6 +106,12 @@ static void add_url_alias(struct remote *remote, const char *url) add_url(remote, alias_url(url)); } +static void add_pushurl(struct remote *remote, const char *pushurl) +{ + ALLOC_GROW(remote->pushurl, remote->pushurl_nr + 1, remote->pushurl_alloc); + remote->pushurl[remote->pushurl_nr++] = pushurl; +} + static struct remote *make_remote(const char *name, int len) { struct remote *ret; @@ -379,6 +385,11 @@ static int handle_config(const char *key, const char *value, void *cb) if (git_config_string(&v, key, value)) return -1; add_url(remote, v); + } else if (!strcmp(subkey, ".pushurl")) { + const char *v; + if (git_config_string(&v, key, value)) + return -1; + add_pushurl(remote, v); } else if (!strcmp(subkey, ".push")) { const char *v; if (git_config_string(&v, key, value)) @@ -424,6 +435,9 @@ static void alias_all_urls(void) for (j = 0; j < remotes[i]->url_nr; j++) { remotes[i]->url[j] = alias_url(remotes[i]->url[j]); } + for (j = 0; j < remotes[i]->pushurl_nr; j++) { + remotes[i]->pushurl[j] = alias_url(remotes[i]->pushurl[j]); + } } } diff --git a/remote.h b/remote.h index 99706a89bc..326bffeb0c 100644 --- a/remote.h +++ b/remote.h @@ -15,6 +15,10 @@ struct remote { int url_nr; int url_alloc; + const char **pushurl; + int pushurl_nr; + int pushurl_alloc; + const char **push_refspec; struct refspec *push; int push_refspec_nr; From e1ca424112d5e8923a4a83af0f79eadbff088b69 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Tue, 9 Jun 2009 18:01:35 +0200 Subject: [PATCH 20/45] t5516: Check pushurl config setting Check whether the new remote.${remotename}.pushurl setting is obeyed and whether it overrides remote.${remotename}.url. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 89649e7a9b..2d2633f3f8 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -419,6 +419,19 @@ test_expect_success 'push with config remote.*.push = HEAD' ' git config --remove-section remote.there git config --remove-section branch.master +test_expect_success 'push with config remote.*.pushurl' ' + + mk_test heads/master && + git checkout master && + git config remote.there.url test2repo && + git config remote.there.pushurl testrepo && + git push there && + check_push_result $the_commit heads/master +' + +# clean up the cruft left with the previous one +git config --remove-section remote.there + test_expect_success 'push with dry-run' ' mk_test heads/master && From 056724c6240ce79ff5ef4e91191bf7366dadba88 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Tue, 9 Jun 2009 18:01:36 +0200 Subject: [PATCH 21/45] technical/api-remote: Describe new struct remote member pushurl ...and pushurl_nr Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- Documentation/technical/api-remote.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/technical/api-remote.txt b/Documentation/technical/api-remote.txt index 073b22bd83..c54b17db69 100644 --- a/Documentation/technical/api-remote.txt +++ b/Documentation/technical/api-remote.txt @@ -18,6 +18,10 @@ struct remote An array of all of the url_nr URLs configured for the remote +`pushurl`:: + + An array of all of the pushurl_nr push URLs configured for the remote + `push`:: An array of refspecs configured for pushing, with From 97af7ff0553ed81bb905dbc0c8b0f9a0c10bfb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=20B=C3=A9jar?= Date: Fri, 12 Jun 2009 00:39:18 +0200 Subject: [PATCH 22/45] parse-remote: function to get the tracking branch to be merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only user of get_remote_refs_for_fetch was "git pull --rebase" and it only wanted the tracking branch to be merge. So, add a simple function (get_remote_merge_branch) with this new meaning. No behavior changes. The new function behaves like the old code in "git pull --rebase". In particular, it only works with the default refspec mapping and with remote branches, not tags. Signed-off-by: Santi Béjar Signed-off-by: Junio C Hamano --- git-parse-remote.sh | 29 +++++++++++++++++++++++++++++ git-pull.sh | 7 ++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/git-parse-remote.sh b/git-parse-remote.sh index a296719861..a991564b95 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -229,6 +229,34 @@ get_remote_refs_for_fetch () { esac } +get_remote_merge_branch () { + case "$#" in + 0|1) + die "internal error: get-remote-merge-branch." ;; + *) + repo=$1 + shift + ref=$1 + # FIXME: It should return the tracking branch + # Currently only works with the default mapping + case "$ref" in + +*) + ref=$(expr "z$ref" : 'z+\(.*\)') + ;; + esac + expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:" + remote=$(expr "z$ref" : 'z\([^:]*\):') + case "$remote" in + '' | HEAD ) remote=HEAD ;; + heads/*) remote=${remote#heads/} ;; + refs/heads/*) remote=${remote#refs/heads/} ;; + refs/* | tags/* | remotes/* ) remote= + esac + + [ -n "$remote" ] && echo "refs/remotes/$repo/$remote" + esac +} + resolve_alternates () { # original URL (xxx.git) top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'` @@ -262,3 +290,4 @@ get_uploadpack () { ;; esac } + diff --git a/git-pull.sh b/git-pull.sh index 35261539ab..3cf26634ad 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -125,12 +125,9 @@ test true = "$rebase" && { die "refusing to pull with rebase: your working tree is not up-to-date" . git-parse-remote && - origin="$1" - test -z "$origin" && origin=$(get_default_remote) - reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null | - sed "s|refs/heads/\(.*\):|\1|")" && + reflist="$(get_remote_merge_branch "$@" 2>/dev/null)" && oldremoteref="$(git rev-parse -q --verify \ - "refs/remotes/$origin/$reflist")" + "$reflist")" } orig_head=$(git rev-parse -q --verify HEAD) git fetch $verbosity --update-head-ok "$@" || exit 1 From e9460a66e0d11b718757cd88eb0c927f2b79e1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=20B=C3=A9jar?= Date: Fri, 12 Jun 2009 00:39:19 +0200 Subject: [PATCH 23/45] parse-remote: support default reflist in get_remote_merge_branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expand get_remote_merge_branch to compute the tracking branch to merge when called without arguments (or only the remote name). This allows "git pull --rebase" without arguments (default upstream branch) to work with a rebased upstream. With explicit arguments it already worked. Also add a test to check for this case. Signed-off-by: Santi Béjar Signed-off-by: Junio C Hamano --- git-parse-remote.sh | 8 +++++++- t/t5520-pull.sh | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/git-parse-remote.sh b/git-parse-remote.sh index a991564b95..75e1254640 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -232,7 +232,13 @@ get_remote_refs_for_fetch () { get_remote_merge_branch () { case "$#" in 0|1) - die "internal error: get-remote-merge-branch." ;; + origin="$1" + default=$(get_default_remote) + test -z "$origin" && origin=$default + curr_branch=$(git symbolic-ref -q HEAD) + [ "$origin" = "$default" ] && + echo $(git for-each-ref --format='%(upstream)' $curr_branch) + ;; *) repo=$1 shift diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 725771fac1..c5a2e66a09 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -92,20 +92,34 @@ test_expect_success '--rebase with rebased upstream' ' git remote add -f me . && git checkout copy && + git tag copy-orig && git reset --hard HEAD^ && echo conflicting modification > file && git commit -m conflict file && git checkout to-rebase && echo file > file2 && git commit -m to-rebase file2 && + git tag to-rebase-orig && git pull --rebase me copy && test "conflicting modification" = "$(cat file)" && test file = $(cat file2) ' +test_expect_success '--rebase with rebased default upstream' ' + + git update-ref refs/remotes/me/copy copy-orig && + git checkout --track -b to-rebase2 me/copy && + git reset --hard to-rebase-orig && + git pull --rebase && + test "conflicting modification" = "$(cat file)" && + test file = $(cat file2) + +' + test_expect_success 'pull --rebase dies early with dirty working directory' ' + git checkout to-rebase && git update-ref refs/remotes/me/copy copy^ && COPY=$(git rev-parse --verify me/copy) && git rebase --onto $COPY copy && From 62d955fd435273dcd9fffed0c0d83bbe90006a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=20B=C3=A9jar?= Date: Fri, 12 Jun 2009 00:39:21 +0200 Subject: [PATCH 24/45] parse-remote: remove unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santi Béjar Signed-off-by: Junio C Hamano --- Documentation/git-parse-remote.txt | 20 --- git-parse-remote.sh | 204 ----------------------------- 2 files changed, 224 deletions(-) diff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt index cd43069874..39d9daa7e0 100644 --- a/Documentation/git-parse-remote.txt +++ b/Documentation/git-parse-remote.txt @@ -17,26 +17,6 @@ routines to parse files under $GIT_DIR/remotes/ and $GIT_DIR/branches/ and configuration variables that are related to fetching, pulling and pushing. -The primary entry points are: - -get_remote_refs_for_fetch:: - Given the list of user-supplied ` ...`, - return the list of refs to fetch after canonicalizing - them into `$GIT_DIR` relative paths - (e.g. `refs/heads/foo`). When `...` is empty - the returned list of refs consists of the defaults - for the given ``, if specified in - `$GIT_DIR/remotes/`, `$GIT_DIR/branches/`, or `remote.*.fetch` - configuration. - -get_remote_refs_for_push:: - Given the list of user-supplied ` ...`, - return the list of refs to push in a form suitable to be - fed to the 'git-send-pack' command. When `...` - is empty the returned list of refs consists of the - defaults for the given ``, if specified in - `$GIT_DIR/remotes/`. - Author ------ Written by Junio C Hamano. diff --git a/git-parse-remote.sh b/git-parse-remote.sh index 75e1254640..5f47b18141 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -60,175 +60,6 @@ get_default_remote () { echo ${origin:-origin} } -get_remote_default_refs_for_push () { - data_source=$(get_data_source "$1") - case "$data_source" in - '' | branches | self) - ;; # no default push mapping, just send matching refs. - config) - git config --get-all "remote.$1.push" ;; - remotes) - sed -ne '/^Push: */{ - s///p - }' "$GIT_DIR/remotes/$1" ;; - *) - die "internal error: get-remote-default-ref-for-push $1" ;; - esac -} - -# Called from canon_refs_list_for_fetch -d "$remote", which -# is called from get_remote_default_refs_for_fetch to grok -# refspecs that are retrieved from the configuration, but not -# from get_remote_refs_for_fetch when it deals with refspecs -# supplied on the command line. $ls_remote_result has the list -# of refs available at remote. -# -# The first token returned is either "explicit" or "glob"; this -# is to help prevent randomly "globbed" ref from being chosen as -# a merge candidate -expand_refs_wildcard () { - echo "$ls_remote_result" | - git fetch--tool expand-refs-wildcard "-" "$@" -} - -# Subroutine to canonicalize remote:local notation. -canon_refs_list_for_fetch () { - # If called from get_remote_default_refs_for_fetch - # leave the branches in branch.${curr_branch}.merge alone, - # or the first one otherwise; add prefix . to the rest - # to prevent the secondary branches to be merged by default. - merge_branches= - curr_branch= - if test "$1" = "-d" - then - shift ; remote="$1" ; shift - set $(expand_refs_wildcard "$remote" "$@") - is_explicit="$1" - shift - if test "$remote" = "$(get_default_remote)" - then - curr_branch=$(git symbolic-ref -q HEAD | \ - sed -e 's|^refs/heads/||') - merge_branches=$(git config \ - --get-all "branch.${curr_branch}.merge") - fi - if test -z "$merge_branches" && test $is_explicit != explicit - then - merge_branches=..this.will.never.match.any.ref.. - fi - fi - for ref - do - force= - case "$ref" in - +*) - ref=$(expr "z$ref" : 'z+\(.*\)') - force=+ - ;; - esac - expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:" - remote=$(expr "z$ref" : 'z\([^:]*\):') - local=$(expr "z$ref" : 'z[^:]*:\(.*\)') - dot_prefix=. - if test -z "$merge_branches" - then - merge_branches=$remote - dot_prefix= - else - for merge_branch in $merge_branches - do - [ "$remote" = "$merge_branch" ] && - dot_prefix= && break - done - fi - case "$remote" in - '' | HEAD ) remote=HEAD ;; - refs/*) ;; - heads/* | tags/* | remotes/* ) remote="refs/$remote" ;; - *) remote="refs/heads/$remote" ;; - esac - case "$local" in - '') local= ;; - refs/*) ;; - heads/* | tags/* | remotes/* ) local="refs/$local" ;; - *) local="refs/heads/$local" ;; - esac - - if local_ref_name=$(expr "z$local" : 'zrefs/\(.*\)') - then - git check-ref-format "$local_ref_name" || - die "* refusing to create funny ref '$local_ref_name' locally" - fi - echo "${dot_prefix}${force}${remote}:${local}" - done -} - -# Returns list of src: (no store), or src:dst (store) -get_remote_default_refs_for_fetch () { - data_source=$(get_data_source "$1") - case "$data_source" in - '') - echo "HEAD:" ;; - self) - canon_refs_list_for_fetch -d "$1" \ - $(git for-each-ref --format='%(refname):') - ;; - config) - canon_refs_list_for_fetch -d "$1" \ - $(git config --get-all "remote.$1.fetch") ;; - branches) - remote_branch=$(sed -ne '/#/s/.*#//p' "$GIT_DIR/branches/$1") - case "$remote_branch" in '') remote_branch=master ;; esac - echo "refs/heads/${remote_branch}:refs/heads/$1" - ;; - remotes) - canon_refs_list_for_fetch -d "$1" $(sed -ne '/^Pull: */{ - s///p - }' "$GIT_DIR/remotes/$1") - ;; - *) - die "internal error: get-remote-default-ref-for-fetch $1" ;; - esac -} - -get_remote_refs_for_push () { - case "$#" in - 0) die "internal error: get-remote-refs-for-push." ;; - 1) get_remote_default_refs_for_push "$@" ;; - *) shift; echo "$@" ;; - esac -} - -get_remote_refs_for_fetch () { - case "$#" in - 0) - die "internal error: get-remote-refs-for-fetch." ;; - 1) - get_remote_default_refs_for_fetch "$@" ;; - *) - shift - tag_just_seen= - for ref - do - if test "$tag_just_seen" - then - echo "refs/tags/${ref}:refs/tags/${ref}" - tag_just_seen= - continue - else - case "$ref" in - tag) - tag_just_seen=yes - continue - ;; - esac - fi - canon_refs_list_for_fetch "$ref" - done - ;; - esac -} - get_remote_merge_branch () { case "$#" in 0|1) @@ -262,38 +93,3 @@ get_remote_merge_branch () { [ -n "$remote" ] && echo "refs/remotes/$repo/$remote" esac } - -resolve_alternates () { - # original URL (xxx.git) - top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'` - while read path - do - case "$path" in - \#* | '') - continue ;; - /*) - echo "$top_$path/" ;; - ../*) - # relative -- ugly but seems to work. - echo "$1/objects/$path/" ;; - *) - # exit code may not be caught by the reader. - echo "bad alternate: $path" - exit 1 ;; - esac - done -} - -get_uploadpack () { - data_source=$(get_data_source "$1") - case "$data_source" in - config) - uplp=$(git config --get "remote.$1.uploadpack") - echo ${uplp:-git-upload-pack} - ;; - *) - echo "git-upload-pack" - ;; - esac -} - From 857f8c30d79ce15b6110b0df9d3ad87075ca5153 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Sat, 13 Jun 2009 18:29:10 +0200 Subject: [PATCH 25/45] builtin-remote: Show push urls as well Teach builtin remote to show push urls also when asked to "show" a specific remote. This improves upon the standard display mode: multiple specified "url"s mean that the first one is for fetching, all are used for pushing. We make this clearer now by displaying the first one prefixed with "Fetch URL", and all "url"s (or, if present, all "pushurl"s) prefixed with "Push URL". Example with "one" having one url, "two" two urls, "three" one url and one pushurl (URL part only): * remote one Fetch URL: hostone.com:/somepath/repoone.git Push URL: hostone.com:/somepath/repoone.git * remote two Fetch URL: hosttwo.com:/somepath/repotwo.git Push URL: hosttwo.com:/somepath/repotwo.git Push URL: hosttwobackup.com:/somewheresafe/repotwo.git * remote three Fetch URL: http://hostthree.com/otherpath/repothree.git Push URL: hostthree.com:/pathforpushes/repothree.git Also, adjust t5505 accordingly and make it test for the new output. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- builtin-remote.c | 20 +++++++++++++++----- t/t5505-remote.sh | 10 +++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/builtin-remote.c b/builtin-remote.c index d7ab6b2d5f..8dcc6a4bf9 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -1002,15 +1002,25 @@ static int show(int argc, const char **argv) info.list = &info_list; for (; argc; argc--, argv++) { int i; + const char **url; + int url_nr; get_remote_ref_states(*argv, &states, query_flag); printf("* remote %s\n", *argv); - if (states.remote->url_nr) { - for (i=0; i < states.remote->url_nr; i++) - printf(" URL: %s\n", states.remote->url[i]); - } else - printf(" URL: %s\n", "(no URL)"); + printf(" Fetch URL: %s\n", states.remote->url_nr > 0 ? + states.remote->url[0] : "(no URL)"); + if (states.remote->pushurl_nr) { + url = states.remote->pushurl; + url_nr = states.remote->pushurl_nr; + } else { + url = states.remote->url; + url_nr = states.remote->url_nr; + } + for (i=0; i < url_nr; i++) + printf(" Push URL: %s\n", url[i]); + if (!i) + printf(" Push URL: %s\n", "(no URL)"); if (no_query) printf(" HEAD branch: (not queried)\n"); else if (!states.heads.nr) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index e70246b3fb..852ccb5d7d 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -135,7 +135,8 @@ EOF cat > test/expect << EOF * remote origin - URL: $(pwd)/one + Fetch URL: $(pwd)/one + Push URL: $(pwd)/one HEAD branch: master Remote branches: master new (next fetch will store in remotes/origin) @@ -151,7 +152,8 @@ cat > test/expect << EOF master pushes to master (local out of date) master pushes to upstream (create) * remote two - URL: ../two + Fetch URL: ../two + Push URL: ../three HEAD branch (remote HEAD is ambiguous, may be one of the following): another master @@ -173,6 +175,7 @@ test_expect_success 'show' ' git branch --track rebase origin/master && git branch -d -r origin/master && git config --add remote.two.url ../two && + git config --add remote.two.pushurl ../three && git config branch.rebase.rebase true && git config branch.octopus.merge "topic-a topic-b topic-c" && (cd ../one && @@ -191,7 +194,8 @@ test_expect_success 'show' ' cat > test/expect << EOF * remote origin - URL: $(pwd)/one + Fetch URL: $(pwd)/one + Push URL: $(pwd)/one HEAD branch: (not queried) Remote branches: (status not queried) master From 4a4b4cdaabde477514c4938b60961538e1d2d91f Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Sat, 13 Jun 2009 18:29:11 +0200 Subject: [PATCH 26/45] builtin-remote: Make "remote -v" display push urls Currently, "remote -v" simply lists all urls so that one has to remember that only the first one is used for fetches, and all are used for pushes. Change this so that the role of an url is displayed in parentheses, and also display push urls. Example with "one" having one url, "two" two urls, "three" one url and one pushurl: one hostone.com:/somepath/repoone.git (fetch) one hostone.com:/somepath/repoone.git (push) three http://hostthree.com/otherpath/repothree.git (fetch) three hostthree.com:/pathforpushes/repothree.git (push) two hosttwo.com:/somepath/repotwo.git (fetch) two hosttwo.com:/somepath/repotwo.git (push) two hosttwobackup.com:/somewheresafe/repotwo.git (push) Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- builtin-remote.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/builtin-remote.c b/builtin-remote.c index 8dcc6a4bf9..3f6f5c2318 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -1279,14 +1279,31 @@ static int update(int argc, const char **argv) static int get_one_entry(struct remote *remote, void *priv) { struct string_list *list = priv; + const char **url; + int i, url_nr; + void **utilp; if (remote->url_nr > 0) { - int i; - - for (i = 0; i < remote->url_nr; i++) - string_list_append(remote->name, list)->util = (void *)remote->url[i]; + utilp = &(string_list_append(remote->name, list)->util); + *utilp = malloc(strlen(remote->url[0])+strlen(" (fetch)")+1); + strcpy((char *) *utilp, remote->url[0]); + strcat((char *) *utilp, " (fetch)"); } else string_list_append(remote->name, list)->util = NULL; + if (remote->pushurl_nr) { + url = remote->pushurl; + url_nr = remote->pushurl_nr; + } else { + url = remote->url; + url_nr = remote->url_nr; + } + for (i = 0; i < url_nr; i++) + { + utilp = &(string_list_append(remote->name, list)->util); + *utilp = malloc(strlen(url[i])+strlen(" (push)")+1); + strcpy((char *) *utilp, url[i]); + strcat((char *) *utilp, " (push)"); + } return 0; } @@ -1294,7 +1311,10 @@ static int get_one_entry(struct remote *remote, void *priv) static int show_all(void) { struct string_list list = { NULL, 0, 0 }; - int result = for_each_remote(get_one_entry, &list); + int result; + + list.strdup_strings = 1; + result = for_each_remote(get_one_entry, &list); if (!result) { int i; @@ -1312,6 +1332,7 @@ static int show_all(void) } } } + string_list_clear(&list, 1); return result; } From ce61595ea7eb3df22f6a943a38a273141f1af978 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Jun 2009 21:46:10 +0200 Subject: [PATCH 27/45] avoid NULL dereference on failed malloc * builtin-remote.c (get_one_entry): Use xmalloc, not malloc. Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- builtin-remote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin-remote.c b/builtin-remote.c index 3f6f5c2318..fd0e63c5dc 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -1285,7 +1285,7 @@ static int get_one_entry(struct remote *remote, void *priv) if (remote->url_nr > 0) { utilp = &(string_list_append(remote->name, list)->util); - *utilp = malloc(strlen(remote->url[0])+strlen(" (fetch)")+1); + *utilp = xmalloc(strlen(remote->url[0])+strlen(" (fetch)")+1); strcpy((char *) *utilp, remote->url[0]); strcat((char *) *utilp, " (fetch)"); } else @@ -1300,7 +1300,7 @@ static int get_one_entry(struct remote *remote, void *priv) for (i = 0; i < url_nr; i++) { utilp = &(string_list_append(remote->name, list)->util); - *utilp = malloc(strlen(url[i])+strlen(" (push)")+1); + *utilp = xmalloc(strlen(url[i])+strlen(" (push)")+1); strcpy((char *) *utilp, url[i]); strcat((char *) *utilp, " (push)"); } From 90dce51584e908232ff279a6c2949ea9855dddf3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Jun 2009 21:47:54 +0200 Subject: [PATCH 28/45] use xstrdup, not strdup in ll-merge.c Otherwise, a fluky allocation failure would cause merge configuration settings to be silently ignored. Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- ll-merge.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ll-merge.c b/ll-merge.c index 9837c842a3..e339b8cfac 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -233,7 +233,7 @@ static int read_merge_config(const char *var, const char *value, void *cb) if (!strcmp(var, "merge.default")) { if (value) - default_ll_merge = strdup(value); + default_ll_merge = xstrdup(value); return 0; } @@ -267,7 +267,7 @@ static int read_merge_config(const char *var, const char *value, void *cb) if (!strcmp("name", ep)) { if (!value) return error("%s: lacks value", var); - fn->description = strdup(value); + fn->description = xstrdup(value); return 0; } @@ -290,14 +290,14 @@ static int read_merge_config(const char *var, const char *value, void *cb) * file named by %A, and signal that it has done with zero exit * status. */ - fn->cmdline = strdup(value); + fn->cmdline = xstrdup(value); return 0; } if (!strcmp("recursive", ep)) { if (!value) return error("%s: lacks value", var); - fn->recursive = strdup(value); + fn->recursive = xstrdup(value); return 0; } From bc2bbc4542a220da5d28c432b6bf78a845a421c0 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sun, 14 Jun 2009 16:08:56 -0700 Subject: [PATCH 29/45] pull, rebase: simplify to use die() Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- git-pull.sh | 6 ++---- git-rebase.sh | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/git-pull.sh b/git-pull.sh index 35261539ab..cab367ada0 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -176,13 +176,11 @@ case "$merge_head" in ?*' '?*) if test -z "$orig_head" then - echo >&2 "Cannot merge multiple branches into empty head" - exit 1 + die "Cannot merge multiple branches into empty head" fi if test true = "$rebase" then - echo >&2 "Cannot rebase onto multiple branches" - exit 1 + die "Cannot rebase onto multiple branches" fi ;; esac diff --git a/git-rebase.sh b/git-rebase.sh index b83fd3f970..334629fc97 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -168,10 +168,8 @@ run_pre_rebase_hook () { if test -z "$OK_TO_SKIP_PRE_REBASE" && test -x "$GIT_DIR/hooks/pre-rebase" then - "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || { - echo >&2 "The pre-rebase hook refused to rebase." - exit 1 - } + "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || + die "The pre-rebase hook refused to rebase." fi } @@ -359,8 +357,7 @@ fi # The tree must be really really clean. if ! git update-index --ignore-submodules --refresh; then - echo >&2 "cannot rebase: you have unstaged changes" - exit 1 + die "cannot rebase: you have unstaged changes" fi diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) case "$diff" in From 48fb7deb5bbd87933e7d314b73d7c1b52667f80f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 17 Jun 2009 17:22:27 -0700 Subject: [PATCH 30/45] Fix big left-shifts of unsigned char Shifting 'unsigned char' or 'unsigned short' left can result in sign extension errors, since the C integer promotion rules means that the unsigned char/short will get implicitly promoted to a signed 'int' due to the shift (or due to other operations). This normally doesn't matter, but if you shift things up sufficiently, it will now set the sign bit in 'int', and a subsequent cast to a bigger type (eg 'long' or 'unsigned long') will now sign-extend the value despite the original expression being unsigned. One example of this would be something like unsigned long size; unsigned char c; size += c << 24; where despite all the variables being unsigned, 'c << 24' ends up being a signed entity, and will get sign-extended when then doing the addition in an 'unsigned long' type. Since git uses 'unsigned char' pointers extensively, we actually have this bug in a couple of places. I may have missed some, but this is the result of looking at git grep '[^0-9 ][ ]*<<[ ][a-z]' -- '*.c' '*.h' git grep '<<[ ]*24' which catches at least the common byte cases (shifting variables by a variable amount, and shifting by 24 bits). I also grepped for just 'unsigned char' variables in general, and converted the ones that most obviously ended up getting implicitly cast immediately anyway (eg hash_name(), encode_85()). In addition to just avoiding 'unsigned char', this patch also tries to use a common idiom for the delta header size thing. We had three different variations on it: "& 0x7fUL" in one place (getting the sign extension right), and "& ~0x80" and "& 0x7f" in two other places (not getting it right). Apart from making them all just avoid using "unsigned char" at all, I also unified them to then use a simple "& 0x7f". I considered making a sparse extension which warns about doing implicit casts from unsigned types to signed types, but it gets rather complex very quickly, so this is just a hack. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- attr.c | 3 +-- base85.c | 2 +- builtin-pack-objects.c | 3 +-- builtin-unpack-objects.c | 4 ++-- delta.h | 5 ++--- index-pack.c | 6 +++--- patch-delta.c | 2 +- sha1_file.c | 3 +-- 8 files changed, 12 insertions(+), 16 deletions(-) diff --git a/attr.c b/attr.c index 98eb636f13..f8f6faa94f 100644 --- a/attr.c +++ b/attr.c @@ -35,8 +35,7 @@ static struct git_attr *(git_attr_hash[HASHSIZE]); static unsigned hash_name(const char *name, int namelen) { - unsigned val = 0; - unsigned char c; + unsigned val = 0, c; while (namelen--) { c = *name++; diff --git a/base85.c b/base85.c index b88270f908..b417a15bbc 100644 --- a/base85.c +++ b/base85.c @@ -91,7 +91,7 @@ void encode_85(char *buf, const unsigned char *data, int bytes) unsigned acc = 0; int cnt; for (cnt = 24; cnt >= 0; cnt -= 8) { - int ch = *data++; + unsigned ch = *data++; acc |= ch << cnt; if (--bytes == 0) break; diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 9742b45c4d..941cc2d73c 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -653,8 +653,7 @@ static void rehash_objects(void) static unsigned name_hash(const char *name) { - unsigned char c; - unsigned hash = 0; + unsigned c, hash = 0; if (!name) return 0; diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 9a773239ca..8e831be476 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -422,8 +422,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size, static void unpack_one(unsigned nr) { unsigned shift; - unsigned char *pack, c; - unsigned long size; + unsigned char *pack; + unsigned long size, c; enum object_type type; obj_list[nr].offset = consumed_bytes; diff --git a/delta.h b/delta.h index 40ccf5a1e9..b9d333dd5a 100644 --- a/delta.h +++ b/delta.h @@ -90,12 +90,11 @@ static inline unsigned long get_delta_hdr_size(const unsigned char **datap, const unsigned char *top) { const unsigned char *data = *datap; - unsigned char cmd; - unsigned long size = 0; + unsigned long cmd, size = 0; int i = 0; do { cmd = *data++; - size |= (cmd & ~0x80) << i; + size |= (cmd & 0x7f) << i; i += 7; } while (cmd & 0x80 && data < top); *datap = data; diff --git a/index-pack.c b/index-pack.c index 6e93ee6af6..0c92bafcbb 100644 --- a/index-pack.c +++ b/index-pack.c @@ -293,8 +293,8 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size) static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_base) { - unsigned char *p, c; - unsigned long size; + unsigned char *p; + unsigned long size, c; off_t base_offset; unsigned shift; void *data; @@ -312,7 +312,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_ p = fill(1); c = *p; use(1); - size += (c & 0x7fUL) << shift; + size += (c & 0x7f) << shift; shift += 7; } obj->size = size; diff --git a/patch-delta.c b/patch-delta.c index ed9db81fa8..ef748ce96d 100644 --- a/patch-delta.c +++ b/patch-delta.c @@ -44,7 +44,7 @@ void *patch_delta(const void *src_buf, unsigned long src_size, if (cmd & 0x01) cp_off = *data++; if (cmd & 0x02) cp_off |= (*data++ << 8); if (cmd & 0x04) cp_off |= (*data++ << 16); - if (cmd & 0x08) cp_off |= (*data++ << 24); + if (cmd & 0x08) cp_off |= ((unsigned) *data++ << 24); if (cmd & 0x10) cp_size = *data++; if (cmd & 0x20) cp_size |= (*data++ << 8); if (cmd & 0x40) cp_size |= (*data++ << 16); diff --git a/sha1_file.c b/sha1_file.c index e73cd4fc0b..8f5fe62d54 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1162,8 +1162,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep) { unsigned shift; - unsigned char c; - unsigned long size; + unsigned long size, c; unsigned long used = 0; c = buf[used++]; From 959e2e64a594e2fb8de2585078e31b07a8da6fc9 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 17 Jun 2009 16:26:06 +0200 Subject: [PATCH 31/45] avoid exponential regex match for java and objc function names In the old regex ^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\([^;]*)$ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ you can backtrack arbitrarily from [A-Za-z_0-9]* into [A-Za-z_], thus causing an exponential number of backtracks. Ironically it also causes the regex not to work as intended; for example "catch" can match the underlined part of the regex, the first repetition matching "c" and the second matching "atch". The replacement regex avoids this problem, because it makes sure that at least a space/tab is eaten on each repetition. In other words, a suffix of a repetition can never be a prefix of the next repetition. Signed-off-by: Paolo Bonzini Signed-off-by: Junio C Hamano --- userdiff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/userdiff.c b/userdiff.c index d556da9751..57529ae63d 100644 --- a/userdiff.c +++ b/userdiff.c @@ -13,7 +13,8 @@ PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", "[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"), PATTERNS("java", "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n" - "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$", + "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$", + /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=" @@ -25,7 +26,7 @@ PATTERNS("objc", /* Objective-C methods */ "^[ \t]*([-+][ \t]*\\([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*\\)[ \t]*[A-Za-z_].*)$\n" /* C functions */ - "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n" + "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$\n" /* Objective-C class/protocol definitions */ "^(@(implementation|interface|protocol)[ \t].*)$", /* -- */ From 1b19fa46344f512949270dc88089574950519ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 17 Jun 2009 12:11:10 +0200 Subject: [PATCH 32/45] upload-archive: fix infinite loop on Cygwin On Cygwin, poll() reports POLLIN even for file descriptors that have reached their end. This caused git upload-archive to be stuck in an infinite loop, as it only looked at the POLLIN flag. In addition to POLLIN, check if read() returned 0, which indicates end-of-file, and keep looping only as long as at least one of the file descriptors has input. This lets the following command finish on its own when run in a git repository on Cygwin, instead of it getting stuck after printing all file names: $ git archive -v --remote . HEAD >/dev/null Reported-by: Bob Kagy Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-upload-archive.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c index a9b02fa32f..f6c4c0f149 100644 --- a/builtin-upload-archive.c +++ b/builtin-upload-archive.c @@ -80,16 +80,17 @@ static void error_clnt(const char *fmt, ...) die("sent error to the client: %s", buf); } -static void process_input(int child_fd, int band) +static ssize_t process_input(int child_fd, int band) { char buf[16384]; ssize_t sz = read(child_fd, buf, sizeof(buf)); if (sz < 0) { if (errno != EAGAIN && errno != EINTR) error_clnt("read error: %s\n", strerror(errno)); - return; + return sz; } send_sideband(1, band, buf, sz, LARGE_PACKET_MAX); + return sz; } int cmd_upload_archive(int argc, const char **argv, const char *prefix) @@ -131,6 +132,7 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix) while (1) { struct pollfd pfd[2]; + ssize_t processed[2] = { 0, 0 }; int status; pfd[0].fd = fd1[0]; @@ -147,12 +149,12 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix) } if (pfd[0].revents & POLLIN) /* Data stream ready */ - process_input(pfd[0].fd, 1); + processed[0] = process_input(pfd[0].fd, 1); if (pfd[1].revents & POLLIN) /* Status stream ready */ - process_input(pfd[1].fd, 2); + processed[1] = process_input(pfd[1].fd, 2); /* Always finish to read data when available */ - if ((pfd[0].revents | pfd[1].revents) & POLLIN) + if (processed[0] || processed[1]) continue; if (waitpid(writer, &status, 0) < 0) From 6fb37f86bce7cf19b4dbff2aa8a93df5ac5c4cbe Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Jun 2009 14:49:39 +0200 Subject: [PATCH 33/45] import-tars: support symlinks Without this patch, symbolic links are turned into empty files. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- contrib/fast-import/import-tars.perl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl index 6309d146e7..78e40d2a13 100755 --- a/contrib/fast-import/import-tars.perl +++ b/contrib/fast-import/import-tars.perl @@ -82,10 +82,16 @@ foreach my $tar_file (@ARGV) $mtime = oct $mtime; next if $typeflag == 5; # directory - print FI "blob\n", "mark :$next_mark\n", "data $size\n"; - while ($size > 0 && read(I, $_, 512) == 512) { - print FI substr($_, 0, $size); - $size -= 512; + print FI "blob\n", "mark :$next_mark\n"; + if ($typeflag == 2) { # symbolic link + print FI "data ", length($linkname), "\n", $linkname; + $mode = 0120000; + } else { + print FI "data $size\n"; + while ($size > 0 && read(I, $_, 512) == 512) { + print FI substr($_, 0, $size); + $size -= 512; + } } print FI "\n"; @@ -118,7 +124,8 @@ EOF { my ($mark, $mode) = @{$files{$path}}; $path =~ s,^([^/]+)/,, if $have_top_dir; - printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path; + $mode = $mode & 0111 ? 0755 : 0644 unless $mode == 0120000; + printf FI "M %o :%i %s\n", $mode, $mark, $path; } print FI "\n"; From cb8a9bd518002dd4fb693df6230b4976bafc15e0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 18 Jun 2009 14:31:32 +0200 Subject: [PATCH 34/45] Test cccmd in t9001-send-email.sh and fix some bugs For another patch series I'm working on I needed some tests for the cc-cmd feature of git-send-email. This patch adds 3 tests for the feature and for the possibility to specify --suppress-cc multiple times, and fixes two bugs. The first bug is that the --suppress-cc option for `cccmd' was misspelled as `ccmd' in the code. The second bug, which is actually found only with my other series, is that the argument to the cccmd is never quoted, so the cccmd would fail with patch file names containing a space. A third bug I fix (in the docs) is that the bodycc argument was actually spelled ccbody in the documentation and bash completion. Signed-off-by: Paolo Bonzini Cc: Markus Heidelberg Signed-off-by: Junio C Hamano --- Documentation/git-send-email.txt | 4 +- contrib/completion/git-completion.bash | 2 +- git-send-email.perl | 4 +- t/t9001-send-email.sh | 80 ++++++++++++++++++++++++-- 4 files changed, 80 insertions(+), 10 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 9902da43c7..fbde2d3be5 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -193,12 +193,12 @@ Automating - 'self' will avoid including the sender - 'cc' will avoid including anyone mentioned in Cc lines in the patch header except for self (use 'self' for that). -- 'ccbody' will avoid including anyone mentioned in Cc lines in the +- 'bodycc' will avoid including anyone mentioned in Cc lines in the patch body (commit message) except for self (use 'self' for that). - 'sob' will avoid including anyone mentioned in Signed-off-by lines except for self (use 'self' for that). - 'cccmd' will avoid running the --cc-cmd. -- 'body' is equivalent to 'sob' + 'ccbody' +- 'body' is equivalent to 'sob' + 'bodycc' - 'all' will suppress all auto cc values. -- + diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 80ab4e45eb..b60cb68a8b 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1299,7 +1299,7 @@ _git_rebase () } __git_send_email_confirm_options="always never auto cc compose" -__git_send_email_suppresscc_options="author self cc ccbody sob cccmd body all" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" _git_send_email () { diff --git a/git-send-email.perl b/git-send-email.perl index 303e03a8ce..8ce6f1fe57 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -334,7 +334,7 @@ if (@suppress_cc) { } if ($suppress_cc{'all'}) { - foreach my $entry (qw (ccmd cc author self sob body bodycc)) { + foreach my $entry (qw (cccmd cc author self sob body bodycc)) { $suppress_cc{$entry} = 1; } delete $suppress_cc{'all'}; @@ -1104,7 +1104,7 @@ foreach my $t (@files) { close F; if (defined $cc_cmd && !$suppress_cc{'cccmd'}) { - open(F, "$cc_cmd $t |") + open(F, "$cc_cmd \Q$t\E |") or die "(cc-cmd) Could not execute '$cc_cmd'"; while() { my $c = $_; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 9ce04fd472..fb7d9f3e4a 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -148,6 +148,22 @@ test_expect_success 'Prompting works' ' grep "^To: to@example.com$" msgtxt1 ' +test_expect_success 'cccmd works' ' + clean_fake_sendmail && + cp $patches cccmd.patch && + echo cccmd--cccmd@example.com >>cccmd.patch && + echo sed -n s/^cccmd--//p \"\$1\" > cccmd-sed && + chmod +x cccmd-sed && + git send-email \ + --from="Example " \ + --to=nobody@example.com \ + --cc-cmd=./cccmd-sed \ + --smtp-server="$(pwd)/fake.sendmail" \ + cccmd.patch \ + && + grep ^Cc:.*cccmd@example.com msgtxt1 +' + z8=zzzzzzzz z64=$z8$z8$z8$z8$z8$z8$z8$z8 z512=$z64$z64$z64$z64$z64$z64$z64$z64 @@ -274,7 +290,7 @@ EOF test_suppression () { git send-email \ --dry-run \ - --suppress-cc=$1 \ + --suppress-cc=$1 ${2+"--suppress-cc=$2"} \ --from="Example " \ --to=to@example.com \ --smtp-server relay.example.com \ @@ -282,8 +298,8 @@ test_suppression () { sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ - >actual-suppress-$1 && - test_cmp expected-suppress-$1 actual-suppress-$1 + >actual-suppress-$1${2+"-$2"} && + test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } test_expect_success 'sendemail.cc set' ' @@ -316,6 +332,34 @@ test_expect_success 'sendemail.cc unset' ' test_suppression sob ' +cat >expected-suppress-cccmd <<\EOF +0001-Second.patch +(mbox) Adding cc: A from line 'From: A ' +(mbox) Adding cc: One from line 'Cc: One , two@example.com' +(mbox) Adding cc: two@example.com from line 'Cc: One , two@example.com' +(body) Adding cc: C O Mitter from line 'Signed-off-by: C O Mitter ' +Dry-OK. Log says: +Server: relay.example.com +MAIL FROM: +RCPT TO:,,,, +From: Example +To: to@example.com +Cc: A , One , two@example.com, C O Mitter +Subject: [PATCH 1/1] Second. +Date: DATE-STRING +Message-Id: MESSAGE-ID-STRING +X-Mailer: X-MAILER-STRING + +Result: OK +EOF + +test_expect_success 'sendemail.cccmd' ' + echo echo cc-cmd@example.com > cccmd && + chmod +x cccmd && + git config sendemail.cccmd ./cccmd && + test_suppression cccmd +' + cat >expected-suppress-all <<\EOF 0001-Second.patch Dry-OK. Log says: @@ -341,6 +385,31 @@ cat >expected-suppress-body <<\EOF (mbox) Adding cc: A from line 'From: A ' (mbox) Adding cc: One from line 'Cc: One , two@example.com' (mbox) Adding cc: two@example.com from line 'Cc: One , two@example.com' +(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd' +Dry-OK. Log says: +Server: relay.example.com +MAIL FROM: +RCPT TO:,,,, +From: Example +To: to@example.com +Cc: A , One , two@example.com, cc-cmd@example.com +Subject: [PATCH 1/1] Second. +Date: DATE-STRING +Message-Id: MESSAGE-ID-STRING +X-Mailer: X-MAILER-STRING + +Result: OK +EOF + +test_expect_success '--suppress-cc=body' ' + test_suppression body +' + +cat >expected-suppress-body-cccmd <<\EOF +0001-Second.patch +(mbox) Adding cc: A from line 'From: A ' +(mbox) Adding cc: One from line 'Cc: One , two@example.com' +(mbox) Adding cc: two@example.com from line 'Cc: One , two@example.com' Dry-OK. Log says: Server: relay.example.com MAIL FROM: @@ -356,8 +425,8 @@ X-Mailer: X-MAILER-STRING Result: OK EOF -test_expect_success '--suppress-cc=body' ' - test_suppression body +test_expect_success '--suppress-cc=body --suppress-cc=cccmd' ' + test_suppression body cccmd ' cat >expected-suppress-sob <<\EOF @@ -381,6 +450,7 @@ Result: OK EOF test_expect_success '--suppress-cc=sob' ' + git config --unset sendemail.cccmd test_suppression sob ' From ef52aafa0f8b1d34f2ecd9b58f2198711c87cab3 Mon Sep 17 00:00:00 2001 From: Mark Lodato Date: Sun, 14 Jun 2009 22:39:00 -0400 Subject: [PATCH 35/45] http.c: fix compiling with libcurl 7.9.2 Change the minimimum required libcurl version for the http.sslKey option to 7.9.3. Previously, preprocessor macros checked for >= 7.9.2, which is incorrect because CURLOPT_SSLKEY was introduced in 7.9.3. This now allows git to compile with libcurl 7.9.2. Signed-off-by: Mark Lodato Signed-off-by: Junio C Hamano --- http.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/http.c b/http.c index 2e3d6493ef..b5323a68b7 100644 --- a/http.c +++ b/http.c @@ -14,7 +14,7 @@ char curl_errorstr[CURL_ERROR_SIZE]; static int curl_ssl_verify = -1; static const char *ssl_cert; -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 static const char *ssl_key; #endif #if LIBCURL_VERSION_NUM >= 0x070908 @@ -119,7 +119,7 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.sslcert", var)) return git_config_string(&ssl_cert, var, value); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 if (!strcmp("http.sslkey", var)) return git_config_string(&ssl_key, var, value); #endif @@ -189,7 +189,7 @@ static CURL *get_curl_handle(void) if (ssl_cert != NULL) curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 if (ssl_key != NULL) curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key); #endif @@ -303,7 +303,7 @@ void http_init(struct remote *remote) curl_ssl_verify = 0; set_from_env(&ssl_cert, "GIT_SSL_CERT"); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 set_from_env(&ssl_key, "GIT_SSL_KEY"); #endif #if LIBCURL_VERSION_NUM >= 0x070908 From 907ffe1522560ba71991ae4d2b03e357a8f57110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 16 Jun 2009 15:21:04 +0100 Subject: [PATCH 36/45] Add -k option to cvsexportcommit to revert expanded CVS keywords in CVS working tree before applying commit patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending on how your CVS->GIT conversion went you will have some unexpanded CVS keywords in your GIT repo. If any of your git commits touch these lines then the patch application will fail. This patch addresses that by adding an option that will revert and expanded CVS keywords to files in the working CVS directory that are affected by the commit being applied. Signed-off-by: Alex Bennée Signed-off-by: Junio C Hamano --- Documentation/git-cvsexportcommit.txt | 4 ++++ git-cvsexportcommit.perl | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt index 2da8588f4f..abaaf273bb 100644 --- a/Documentation/git-cvsexportcommit.txt +++ b/Documentation/git-cvsexportcommit.txt @@ -63,6 +63,10 @@ OPTIONS -u:: Update affected files from CVS repository before attempting export. +-k:: + Reverse CVS keyword expansion (e.g. $Revision: 1.2.3.4$ + becomes $Revision$) in working CVS checkout before applying patch. + -w:: Specify the location of the CVS checkout to use for the export. This option does not require GIT_DIR to be set before execution if the diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index 9ec1df95c0..a36df33926 100755 --- a/git-cvsexportcommit.perl +++ b/git-cvsexportcommit.perl @@ -8,9 +8,9 @@ use File::Basename qw(basename dirname); use File::Spec; use Git; -our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W); +our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W, $opt_k); -getopts('uhPpvcfam:d:w:W'); +getopts('uhPpvcfkam:d:w:W'); $opt_h && usage(); @@ -287,7 +287,26 @@ foreach my $f (@files) { $dirty = 1; warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n"; } + + # Depending on how your GIT tree got imported from CVS you may + # have a conflict between expanded keywords in your CVS tree and + # unexpanded keywords in the patch about to be applied. + if ($opt_k) { + my $orig_file ="$f.orig"; + rename $f, $orig_file; + open(FILTER_IN, "<$orig_file") or die "Cannot open $orig_file\n"; + open(FILTER_OUT, ">$f") or die "Cannot open $f\n"; + while () + { + my $line = $_; + $line =~ s/\$([A-Z][a-z]+):[^\$]+\$/\$\1\$/g; + print FILTER_OUT $line; + } + close FILTER_IN; + close FILTER_OUT; + } } + if ($dirty) { if ($opt_f) { warn "The tree is not clean -- forced merge\n"; $dirty = 0; @@ -391,7 +410,7 @@ sleep(1); sub usage { print STDERR < Date: Thu, 18 Jun 2009 02:17:54 -0700 Subject: [PATCH 37/45] add: allow configurations to be overriden by command line Don't call git_config after parsing the command line options, otherwise the config settings will override any settings made by the command line. This can be seen by setting add.ignore_errors and then specifying --no-ignore-errors when using git-add. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- builtin-add.c | 4 ++-- t/t3700-add.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/builtin-add.c b/builtin-add.c index fc3f96eaef..13db4a6455 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -247,6 +247,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) int add_new_files; int require_pathspec; + git_config(add_config, NULL); + argc = parse_options(argc, argv, builtin_add_options, builtin_add_usage, 0); if (patch_interactive) @@ -254,8 +256,6 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (add_interactive) exit(interactive_add(argc, argv, prefix)); - git_config(add_config, NULL); - if (addremove && take_worktree_changes) die("-A and -u are mutually incompatible"); if (addremove && !argc) { diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 2ac93a346d..060a6ecabe 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -221,6 +221,19 @@ test_expect_success 'git add (add.ignore-errors = false)' ' test_must_fail git add --verbose . && ! ( git ls-files foo1 | grep foo1 ) ' +rm -f foo2 + +test_expect_success '--no-ignore-errors overrides config' ' + git config add.ignore-errors 1 && + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose --no-ignore-errors . && + ! ( git ls-files foo1 | grep foo1 ) && + git config add.ignore-errors 0 +' +rm -f foo2 test_expect_success 'git add '\''fo\[ou\]bar'\'' ignores foobar' ' git reset --hard && From ccf497de97f9d22e55e9e5ae90b8a65503d48099 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 20 Jun 2009 13:27:15 +0200 Subject: [PATCH 38/45] git-svn documentation: fix typo in 'rebase vs. pull/merge' section Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- Documentation/git-svn.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 5d6d30f764..b6577dd4c4 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -541,7 +541,7 @@ pulled or merged from. This is because the author favored If you use `git svn set-tree A..B` to commit several diffs and you do not have the latest remotes/git-svn merged into my-branch, you should use `git svn rebase` to update your work branch instead of `git pull` or -`git merge`. `pull`/`merge' can cause non-linear history to be flattened +`git merge`. `pull`/`merge` can cause non-linear history to be flattened when committing into SVN, which can lead to merge commits reversing previous commits in SVN. From 2af202be3d2f128c6974290cabe13179c6462196 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 18 Jun 2009 10:28:43 -0700 Subject: [PATCH 39/45] Fix various sparse warnings in the git source code There are a few remaining ones, but this fixes the trivial ones. It boils down to two main issues that sparse complains about: - warning: Using plain integer as NULL pointer Sparse doesn't like you using '0' instead of 'NULL'. For various good reasons, not the least of which is just the visual confusion. A NULL pointer is not an integer, and that whole "0 works as NULL" is a historical accident and not very pretty. A few of these remain: zlib is a total mess, and Z_NULL is just a 0. I didn't touch those. - warning: symbol 'xyz' was not declared. Should it be static? Sparse wants to see declarations for any functions you export. A lack of a declaration tends to mean that you should either add one, or you should mark the function 'static' to show that it's in file scope. A few of these remain: I only did the ones that should obviously just be made static. That 'wt_status_submodule_summary' one is debatable. It has a few related flags (like 'wt_status_use_color') which _are_ declared, and are used by builtin-commit.c. So maybe we'd like to export it at some point, but it's not declared now, and not used outside of that file, so 'static' it is in this patch. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- bisect.c | 4 ++-- builtin-add.c | 2 +- builtin-apply.c | 2 +- builtin-clone.c | 2 +- builtin-fsck.c | 4 ++-- builtin-help.c | 2 +- builtin-log.c | 4 ++-- builtin-merge.c | 4 ++-- builtin-remote.c | 16 ++++++++-------- builtin-unpack-objects.c | 6 +++--- connect.c | 2 +- daemon.c | 2 +- http-push.c | 2 +- imap-send.c | 2 +- index-pack.c | 2 +- mailmap.c | 6 +++--- merge-recursive.c | 2 +- parse-options.c | 2 +- quote.c | 4 ++-- remote.c | 6 +++--- test-parse-options.c | 4 ++-- unpack-trees.c | 2 +- wt-status.c | 2 +- 23 files changed, 42 insertions(+), 42 deletions(-) diff --git a/bisect.c b/bisect.c index 6fdff05722..dbeb28752a 100644 --- a/bisect.c +++ b/bisect.c @@ -454,7 +454,7 @@ static int read_bisect_refs(void) return for_each_ref_in("refs/bisect/", register_ref, NULL); } -void read_bisect_paths(struct argv_array *array) +static void read_bisect_paths(struct argv_array *array) { struct strbuf str = STRBUF_INIT; const char *filename = git_path("BISECT_NAMES"); @@ -780,7 +780,7 @@ static void handle_bad_merge_base(void) exit(1); } -void handle_skipped_merge_base(const unsigned char *mb) +static void handle_skipped_merge_base(const unsigned char *mb) { char *mb_hex = sha1_to_hex(mb); char *bad_hex = sha1_to_hex(current_bad_sha1); diff --git a/builtin-add.c b/builtin-add.c index 56e522127c..4e44148e05 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -189,7 +189,7 @@ int interactive_add(int argc, const char **argv, const char *prefix) return status; } -int edit_patch(int argc, const char **argv, const char *prefix) +static int edit_patch(int argc, const char **argv, const char *prefix) { char *file = xstrdup(git_path("ADD_EDIT.patch")); const char *apply_argv[] = { "apply", "--recount", "--cached", diff --git a/builtin-apply.c b/builtin-apply.c index 89a5185cea..4cf819c790 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2614,7 +2614,7 @@ static int get_current_sha1(const char *path, unsigned char *sha1) static void build_fake_ancestor(struct patch *list, const char *filename) { struct patch *patch; - struct index_state result = { 0 }; + struct index_state result = { NULL }; int fd; /* Once we start supporting the reverse patch, it may be diff --git a/builtin-clone.c b/builtin-clone.c index 5c46496a43..2ceacb7b3f 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -141,7 +141,7 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) if (is_bare) { struct strbuf result = STRBUF_INIT; strbuf_addf(&result, "%.*s.git", (int)(end - start), start); - dir = strbuf_detach(&result, 0); + dir = strbuf_detach(&result, NULL); } else dir = xstrndup(start, end - start); /* diff --git a/builtin-fsck.c b/builtin-fsck.c index 7da706cac3..e077e72dea 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -104,7 +104,7 @@ static int mark_object(struct object *obj, int type, void *data) static void mark_object_reachable(struct object *obj) { - mark_object(obj, OBJ_ANY, 0); + mark_object(obj, OBJ_ANY, NULL); } static int traverse_one_object(struct object *obj, struct object *parent) @@ -292,7 +292,7 @@ static int fsck_sha1(const unsigned char *sha1) fprintf(stderr, "Checking %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1)); - if (fsck_walk(obj, mark_used, 0)) + if (fsck_walk(obj, mark_used, NULL)) objerror(obj, "broken links"); if (fsck_object(obj, check_strict, fsck_error_func)) return -1; diff --git a/builtin-help.c b/builtin-help.c index 6e53b23833..e1eba778a5 100644 --- a/builtin-help.c +++ b/builtin-help.c @@ -394,7 +394,7 @@ static void get_html_page_path(struct strbuf *page_path, const char *page) * HTML. */ #ifndef open_html -void open_html(const char *path) +static void open_html(const char *path) { execl_git_cmd("web--browse", "-c", "help.browser", path, NULL); } diff --git a/builtin-log.c b/builtin-log.c index 0d34050556..44f9a27dae 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -94,7 +94,7 @@ static void show_early_header(struct rev_info *rev, const char *stage, int nr) printf("Final output: %d %s\n", nr, stage); } -struct itimerval early_output_timer; +static struct itimerval early_output_timer; static void log_show_early(struct rev_info *revs, struct commit_list *list) { @@ -977,7 +977,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) strbuf_addch(&buf, '\n'); } - rev.extra_headers = strbuf_detach(&buf, 0); + rev.extra_headers = strbuf_detach(&buf, NULL); if (start_number < 0) start_number = 1; diff --git a/builtin-merge.c b/builtin-merge.c index 793f2f4a18..af9adab300 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -370,7 +370,7 @@ static void merge_name(const char *remote, struct strbuf *msg) strbuf_addstr(&buf, "refs/heads/"); strbuf_addstr(&buf, remote); - resolve_ref(buf.buf, branch_head, 0, 0); + resolve_ref(buf.buf, branch_head, 0, NULL); if (!hashcmp(remote_head->sha1, branch_head)) { strbuf_addf(msg, "%s\t\tbranch '%s' of .\n", @@ -409,7 +409,7 @@ static void merge_name(const char *remote, struct strbuf *msg) strbuf_addstr(&truname, "refs/heads/"); strbuf_addstr(&truname, remote); strbuf_setlen(&truname, truname.len - len); - if (resolve_ref(truname.buf, buf_sha, 0, 0)) { + if (resolve_ref(truname.buf, buf_sha, 0, NULL)) { strbuf_addf(msg, "%s\t\tbranch '%s'%s of .\n", sha1_to_hex(remote_head->sha1), diff --git a/builtin-remote.c b/builtin-remote.c index 406fb85255..658d578588 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -740,7 +740,7 @@ static int rm(int argc, const char **argv) return result; } -void clear_push_info(void *util, const char *string) +static void clear_push_info(void *util, const char *string) { struct push_info *info = util; free(info->dest); @@ -815,7 +815,7 @@ struct show_info { int any_rebase; }; -int add_remote_to_show_info(struct string_list_item *item, void *cb_data) +static int add_remote_to_show_info(struct string_list_item *item, void *cb_data) { struct show_info *info = cb_data; int n = strlen(item->string); @@ -825,7 +825,7 @@ int add_remote_to_show_info(struct string_list_item *item, void *cb_data) return 0; } -int show_remote_info_item(struct string_list_item *item, void *cb_data) +static int show_remote_info_item(struct string_list_item *item, void *cb_data) { struct show_info *info = cb_data; struct ref_states *states = info->states; @@ -852,7 +852,7 @@ int show_remote_info_item(struct string_list_item *item, void *cb_data) return 0; } -int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data) +static int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data) { struct show_info *show_info = cb_data; struct ref_states *states = show_info->states; @@ -874,7 +874,7 @@ int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data) return 0; } -int show_local_info_item(struct string_list_item *item, void *cb_data) +static int show_local_info_item(struct string_list_item *item, void *cb_data) { struct show_info *show_info = cb_data; struct branch_info *branch_info = item->util; @@ -906,7 +906,7 @@ int show_local_info_item(struct string_list_item *item, void *cb_data) return 0; } -int add_push_to_show_info(struct string_list_item *push_item, void *cb_data) +static int add_push_to_show_info(struct string_list_item *push_item, void *cb_data) { struct show_info *show_info = cb_data; struct push_info *push_info = push_item->util; @@ -935,7 +935,7 @@ static int cmp_string_with_push(const void *va, const void *vb) return cmp ? cmp : strcmp(a_push->dest, b_push->dest); } -int show_push_info_item(struct string_list_item *item, void *cb_data) +static int show_push_info_item(struct string_list_item *item, void *cb_data) { struct show_info *show_info = cb_data; struct push_info *push_info = item->util; @@ -1197,7 +1197,7 @@ static int get_one_remote_for_update(struct remote *remote, void *priv) return 0; } -struct remote_group { +static struct remote_group { const char *name; struct string_list *list; } remote_group; diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 8e831be476..7e3ea73006 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -158,7 +158,7 @@ struct obj_info { #define FLAG_WRITTEN (1u<<21) static struct obj_info *obj_list; -unsigned nr_objects; +static unsigned nr_objects; /* * Called only from check_object() after it verified this object @@ -200,7 +200,7 @@ static int check_object(struct object *obj, int type, void *data) if (fsck_object(obj, 1, fsck_error_function)) die("Error in object"); - if (!fsck_walk(obj, check_object, 0)) + if (!fsck_walk(obj, check_object, NULL)) die("Error on reachable objects of %s", sha1_to_hex(obj->sha1)); write_cached_object(obj); return 1; @@ -210,7 +210,7 @@ static void write_rest(void) { unsigned i; for (i = 0; i < nr_objects; i++) - check_object(obj_list[i].obj, OBJ_ANY, 0); + check_object(obj_list[i].obj, OBJ_ANY, NULL); } static void added_object(unsigned nr, enum object_type type, diff --git a/connect.c b/connect.c index 0ce941ef44..76e542776a 100644 --- a/connect.c +++ b/connect.c @@ -464,7 +464,7 @@ static void git_proxy_connect(int fd[2], char *host) #define MAX_CMD_LEN 1024 -char *get_port(char *host) +static char *get_port(char *host) { char *end; char *p = strchr(host, ':'); diff --git a/daemon.c b/daemon.c index b2babcc076..366db37b39 100644 --- a/daemon.c +++ b/daemon.c @@ -453,7 +453,7 @@ static void parse_host_arg(char *extra_args, int buflen) memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; - gai = getaddrinfo(hostname, 0, &hints, &ai); + gai = getaddrinfo(hostname, NULL, &hints, &ai); if (!gai) { struct sockaddr_in *sin_addr = (void *)ai->ai_addr; diff --git a/http-push.c b/http-push.c index e4ea395e02..8cc8ee0dfd 100644 --- a/http-push.c +++ b/http-push.c @@ -1750,7 +1750,7 @@ static int delete_remote_branch(char *pattern, int force) return 0; } -void run_request_queue(void) +static void run_request_queue(void) { #ifdef USE_CURL_MULTI is_running_queue = 1; diff --git a/imap-send.c b/imap-send.c index e4c83b9d5b..3847fd151d 100644 --- a/imap-send.c +++ b/imap-send.c @@ -238,7 +238,7 @@ static const char *Flags[] = { #ifndef NO_OPENSSL static void ssl_socket_perror(const char *func) { - fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), 0)); + fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), NULL)); } #endif diff --git a/index-pack.c b/index-pack.c index 0c92bafcbb..c72cbd406a 100644 --- a/index-pack.c +++ b/index-pack.c @@ -469,7 +469,7 @@ static void sha1_object(const void *data, unsigned long size, die("invalid %s", typename(type)); if (fsck_object(obj, 1, fsck_error_function)) die("Error in object"); - if (fsck_walk(obj, mark_link, 0)) + if (fsck_walk(obj, mark_link, NULL)) die("Not all child objects of %s are reachable", sha1_to_hex(obj->sha1)); if (obj->type == OBJ_TREE) { diff --git a/mailmap.c b/mailmap.c index bb1f2fb711..f167c005bf 100644 --- a/mailmap.c +++ b/mailmap.c @@ -103,7 +103,7 @@ static char *parse_name_and_email(char *buffer, char **name, char **email, int allow_empty_email) { char *left, *right, *nstart, *nend; - *name = *email = 0; + *name = *email = NULL; if ((left = strchr(buffer, '<')) == NULL) return NULL; @@ -136,7 +136,7 @@ static int read_single_mailmap(struct string_list *map, const char *filename, ch if (f == NULL) return 1; while (fgets(buffer, sizeof(buffer), f) != NULL) { - char *name1 = 0, *email1 = 0, *name2 = 0, *email2 = 0; + char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL; if (buffer[0] == '#') { static const char abbrev[] = "# repo-abbrev:"; int abblen = sizeof(abbrev) - 1; @@ -200,7 +200,7 @@ int map_user(struct string_list *map, if (!p) { /* email passed in might not be wrapped in <>, but end with a \0 */ p = memchr(email, '\0', maxlen_email); - if (p == 0) + if (!p) return 0; } if (p - email + 1 < sizeof(buf)) diff --git a/merge-recursive.c b/merge-recursive.c index f5df9b961b..c703445a9c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -38,7 +38,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two) * A virtual commit has (const char *)commit->util set to the name. */ -struct commit *make_virtual_commit(struct tree *tree, const char *comment) +static struct commit *make_virtual_commit(struct tree *tree, const char *comment) { struct commit *commit = xcalloc(1, sizeof(struct commit)); commit->tree = tree; diff --git a/parse-options.c b/parse-options.c index 34282adde5..f7ce523a61 100644 --- a/parse-options.c +++ b/parse-options.c @@ -478,7 +478,7 @@ static int usage_argh(const struct option *opts) #define USAGE_OPTS_WIDTH 24 #define USAGE_GAP 2 -int usage_with_options_internal(const char * const *usagestr, +static int usage_with_options_internal(const char * const *usagestr, const struct option *opts, int full) { if (!usagestr) diff --git a/quote.c b/quote.c index 7a49fcf696..848d174cc5 100644 --- a/quote.c +++ b/quote.c @@ -272,8 +272,8 @@ void write_name_quoted(const char *name, FILE *fp, int terminator) fputc(terminator, fp); } -extern void write_name_quotedpfx(const char *pfx, size_t pfxlen, - const char *name, FILE *fp, int terminator) +void write_name_quotedpfx(const char *pfx, size_t pfxlen, + const char *name, FILE *fp, int terminator) { int needquote = 0; diff --git a/remote.c b/remote.c index 9a0397ec57..733ba57494 100644 --- a/remote.c +++ b/remote.c @@ -307,7 +307,7 @@ static void read_branches_file(struct remote *remote) strbuf_addstr(&branch, "HEAD:"); } add_url_alias(remote, p); - add_fetch_refspec(remote, strbuf_detach(&branch, 0)); + add_fetch_refspec(remote, strbuf_detach(&branch, NULL)); /* * Cogito compatible push: push current HEAD to remote #branch * (master if missing) @@ -318,7 +318,7 @@ static void read_branches_file(struct remote *remote) strbuf_addf(&branch, ":refs/heads/%s", frag); else strbuf_addstr(&branch, ":refs/heads/master"); - add_push_refspec(remote, strbuf_detach(&branch, 0)); + add_push_refspec(remote, strbuf_detach(&branch, NULL)); remote->fetch_tags = 1; /* always auto-follow */ } @@ -1119,7 +1119,7 @@ int match_refs(struct ref *src, struct ref **dst, int send_all = flags & MATCH_REFS_ALL; int send_mirror = flags & MATCH_REFS_MIRROR; int errs; - static const char *default_refspec[] = { ":", 0 }; + static const char *default_refspec[] = { ":", NULL }; struct ref **dst_tail = tail_ref(dst); if (!nr_refspec) { diff --git a/test-parse-options.c b/test-parse-options.c index a90bc3003d..efa734b42e 100644 --- a/test-parse-options.c +++ b/test-parse-options.c @@ -9,7 +9,7 @@ static int verbose = 0, dry_run = 0, quiet = 0; static char *string = NULL; static char *file = NULL; -int length_callback(const struct option *opt, const char *arg, int unset) +static int length_callback(const struct option *opt, const char *arg, int unset) { printf("Callback: \"%s\", %d\n", (arg ? arg : "not set"), unset); @@ -20,7 +20,7 @@ int length_callback(const struct option *opt, const char *arg, int unset) return 0; } -int number_callback(const struct option *opt, const char *arg, int unset) +static int number_callback(const struct option *opt, const char *arg, int unset) { *(int *)opt->value = strtol(arg, NULL, 10); return 0; diff --git a/unpack-trees.c b/unpack-trees.c index 8eb3ddb392..05d0bb1f85 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -140,7 +140,7 @@ static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_option return call_unpack_fn(src, o); } -int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info) +static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info) { int i; struct tree_desc t[MAX_UNPACK_TREES]; diff --git a/wt-status.c b/wt-status.c index 1b6df45450..0ca4b13c29 100644 --- a/wt-status.c +++ b/wt-status.c @@ -13,7 +13,7 @@ int wt_status_relative_paths = 1; int wt_status_use_color = -1; -int wt_status_submodule_summary; +static int wt_status_submodule_summary; static char wt_status_colors[][COLOR_MAXLEN] = { GIT_COLOR_NORMAL, /* WT_STATUS_HEADER */ GIT_COLOR_GREEN, /* WT_STATUS_UPDATED */ From d4900ee48c70114ea3227f922d383de6b273fcde Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sat, 20 Jun 2009 21:40:45 -0700 Subject: [PATCH 40/45] git-show-ref.txt: remove word and make consistent Under is better than in because of the nested nature of the .git directory. "also using" sounds a little odd, plus we say combined with later on so just use that. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- Documentation/git-show-ref.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt index 2f173fff35..98e294aa86 100644 --- a/Documentation/git-show-ref.txt +++ b/Documentation/git-show-ref.txt @@ -24,7 +24,7 @@ The --exclude-existing form is a filter that does the inverse, it shows the refs from stdin that don't exist in the local repository. Use of this utility is encouraged in favor of directly accessing files under -in the `.git` directory. +the `.git` directory. OPTIONS ------- @@ -50,7 +50,7 @@ OPTIONS -s:: --hash:: - Only show the SHA1 hash, not the reference name. When also using + Only show the SHA1 hash, not the reference name. When combined with --dereference the dereferenced tag will still be shown after the SHA1. --verify:: From c6720cfa49fde6d78b010c088a476d226d161983 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 21 Jun 2009 02:01:28 -0700 Subject: [PATCH 41/45] t3505: fix abuse of test_expect_code The test wanted to make sure that cherry-pick exits with status 1, but with the way it was placed after "git checkout master &&" meant that it could have misjudged success if checkout barfed with the same failure status. Signed-off-by: Junio C Hamano --- t/t3505-cherry-pick-empty.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh index 9aaeabd972..e51e505a9f 100755 --- a/t/t3505-cherry-pick-empty.sh +++ b/t/t3505-cherry-pick-empty.sh @@ -17,11 +17,11 @@ test_expect_success setup ' ' -test_expect_code 1 'cherry-pick an empty commit' ' - - git checkout master && - git cherry-pick empty-branch - +test_expect_success 'cherry-pick an empty commit' ' + git checkout master && { + git cherry-pick empty-branch + test "$?" = 1 + } ' test_expect_success 'index lockfile was removed' ' From e2f6331a14213f01a6e68e71ed63c77323a3e759 Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Fri, 19 Jun 2009 19:42:53 +0900 Subject: [PATCH 42/45] .gitattributes: CR at the end of the line is an error When a CR is accidentally added at the end of a C source file in the git project tree, "git diff --check" doesn't detect it as an error. $ echo abQ | tr Q '\015' >>fast-import.c $ git diff --check I think this is because the "whitespace" attribute is set to *.[ch] files without specifying what kind of errors are caught. It makes git "notice all types of errors" (as described in the documentation), but I think it is incorrectly setting cr-at-eol, too, and hides this error. Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 6b9c715d21..0636deea93 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ * whitespace=!indent,trail,space -*.[ch] whitespace +*.[ch] whitespace=indent,trail,space From a437900fd7643408e1d7a130b4a6b81bfd816d4e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 21 Jun 2009 02:35:18 -0700 Subject: [PATCH 43/45] attribute: whitespace set to true detects all errors known to git That is what the documentation says, but the code pretends as if all the known whitespace error tokens were given. Among the whitespace error tokens, there is one kind that loosens the rule when set: cr-at-eol. Which means that whitespace error token that is set to true ignores a newly introduced CR at the end, which is inconsistent with the documentation. Signed-off-by: Junio C Hamano --- ws.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ws.c b/ws.c index b1efcd9d75..819c797cf6 100644 --- a/ws.c +++ b/ws.c @@ -10,11 +10,12 @@ static struct whitespace_rule { const char *rule_name; unsigned rule_bits; + unsigned loosens_error; } whitespace_rule_names[] = { - { "trailing-space", WS_TRAILING_SPACE }, - { "space-before-tab", WS_SPACE_BEFORE_TAB }, - { "indent-with-non-tab", WS_INDENT_WITH_NON_TAB }, - { "cr-at-eol", WS_CR_AT_EOL }, + { "trailing-space", WS_TRAILING_SPACE, 0 }, + { "space-before-tab", WS_SPACE_BEFORE_TAB, 0 }, + { "indent-with-non-tab", WS_INDENT_WITH_NON_TAB, 0 }, + { "cr-at-eol", WS_CR_AT_EOL, 1 }, }; unsigned parse_whitespace_rule(const char *string) @@ -79,7 +80,8 @@ unsigned whitespace_rule(const char *pathname) unsigned all_rule = 0; int i; for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++) - all_rule |= whitespace_rule_names[i].rule_bits; + if (!whitespace_rule_names[i].loosens_error) + all_rule |= whitespace_rule_names[i].rule_bits; return all_rule; } else if (ATTR_FALSE(value)) { /* false (-whitespace) */ From cff4231a1dfbe68b4a163b31406d862567d3243a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 21 Jun 2009 21:02:49 -0700 Subject: [PATCH 44/45] GIT 1.6.3.3 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.3.3.txt | 38 ++++++++++++++++++++++++++++++ GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 Documentation/RelNotes-1.6.3.3.txt diff --git a/Documentation/RelNotes-1.6.3.3.txt b/Documentation/RelNotes-1.6.3.3.txt new file mode 100644 index 0000000000..1c28398bb6 --- /dev/null +++ b/Documentation/RelNotes-1.6.3.3.txt @@ -0,0 +1,38 @@ +GIT v1.6.3.3 Release Notes +========================== + +Fixes since v1.6.3.2 +-------------------- + + * "git archive" running on Cygwin can get stuck in an infinite loop. + + * "git daemon" did not correctly parse the initial line that carries + virtual host request information. + + * "git diff --textconv" leaked memory badly when the textconv filter + errored out. + + * The built-in regular expressions to pick function names to put on + hunk header lines for java and objc were very inefficiently written. + + * in certain error situations git-fetch (and git-clone) on Windows didn't + detect connection abort and ended up waiting indefinitely. + + * import-tars script (in contrib) did not import symbolic links correctly. + + * http.c used CURLOPT_SSLKEY even on libcURL version 7.9.2, even though + it was only available starting 7.9.3. + + * low-level filelevel merge driver used return value from strdup() + without checking if we ran out of memory. + + * "git rebase -i" left stray closing parenthesis in its reflog message. + + * "git remote show" did not show all the URLs associated with the named + remote, even though "git remote -v" did. Made them consistent by + making the former show all URLs. + + * "whitespace" attribute that is set was meant to detect all errors known + to git, but it told git to ignore trailing carriage-returns. + +Includes other documentation fixes. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0673f0db9f..902bfbf4ef 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.6.3.2 +DEF_VER=v1.6.3.3 LF=' ' diff --git a/RelNotes b/RelNotes index a433be58b7..392186f0dc 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.6.3.2.txt \ No newline at end of file +Documentation/RelNotes-1.6.3.3.txt \ No newline at end of file From 1ab012cf811abba5745fa0da70db963decd65f21 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 22 Jun 2009 09:30:38 +0200 Subject: [PATCH 45/45] t3700-add: add a POSIXPERM prerequisite to a new test The new test does a 'chmod 0', which does not have the intended effect on Windows. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 32595fa30c..fe93ce52e7 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -223,7 +223,7 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' ' ' rm -f foo2 -test_expect_success '--no-ignore-errors overrides config' ' +test_expect_success POSIXPERM '--no-ignore-errors overrides config' ' git config add.ignore-errors 1 && git reset --hard && date >foo1 &&