From 46a0431b996cd19f21e0247c97b1eab2c19698fc Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 15 Nov 2010 11:00:33 +0100 Subject: git-gui: fix ANSI-color parsing git diff always outputs color reset commands, even when the color for the current part is disabled (ie. normal). But the current ANSI-color parsing code assumes that color start and reset commands appear in matching pairs. Relax this assumption. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index dcf0711..0579fa6 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -337,12 +337,20 @@ proc parse_color_line {line} { set result "" set markup [list] set regexp {\033\[((?:\d+;)*\d+)?m} + set need_reset 0 while {[regexp -indices -start $start $regexp $line match code]} { foreach {begin end} $match break append result [string range $line $start [expr {$begin - 1}]] - lappend markup [string length $result] \ - [eval [linsert $code 0 string range $line]] + set pos [string length $result] + set col [eval [linsert $code 0 string range $line]] set start [incr end] + if {$col eq "0" || $col eq ""} { + if {!$need_reset} continue + set need_reset 0 + } else { + set need_reset 1 + } + lappend markup $pos $col } append result [string range $line $start end] if {[llength $markup] < 4} {set markup {}} -- cgit v0.10.2-6-g49f6 From 4590307a338b1a4912c7a203c71af8b8995ea885 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Tue, 16 Nov 2010 10:21:52 +0100 Subject: git-gui: respect conflict marker size Respect the conflict-marker-size attribute on paths when detecting merge conflicts. [PT: fixed problem with variable substitution in the regexps] Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/git-gui.sh b/git-gui.sh index d3acf0d..38362fa 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -3351,13 +3351,13 @@ $ui_diff tag conf d_s- \ -foreground red \ -background ivory1 -$ui_diff tag conf d<<<<<<< \ +$ui_diff tag conf d< \ -foreground orange \ -font font_diffbold -$ui_diff tag conf d======= \ +$ui_diff tag conf d= \ -foreground orange \ -font font_diffbold -$ui_diff tag conf d>>>>>>> \ +$ui_diff tag conf d> \ -foreground orange \ -font font_diffbold diff --git a/lib/diff.tcl b/lib/diff.tcl index 0579fa6..8fea947 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} { } } +proc get_conflict_marker_size {path} { + set size 7 + catch { + set fd_rc [eval [list git_read check-attr "conflict-marker-size" -- $path]] + set ret [gets $fd_rc line] + close $fd_rc + if {$ret > 0} { + regexp {.*: conflict-marker-size: (\d+)$} $line line size + } + } + return $size +} + proc start_show_diff {cont_info {add_opts {}}} { global file_states file_lists global is_3way_diff is_submodule_diff diff_active repo_config @@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} { set is_submodule_diff 0 set diff_active 1 set current_diff_header {} + set conflict_size [get_conflict_marker_size $path] set cmd [list] if {$w eq $ui_index} { @@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} { -blocking 0 \ -encoding [get_path_encoding $path] \ -translation lf - fileevent $fd readable [list read_diff $fd $cont_info] + fileevent $fd readable [list read_diff $fd $conflict_size $cont_info] } proc parse_color_line {line} { @@ -357,7 +371,7 @@ proc parse_color_line {line} { return [list $result $markup] } -proc read_diff {fd cont_info} { +proc read_diff {fd conflict_size cont_info} { global ui_diff diff_active is_submodule_diff global is_3way_diff is_conflict_diff current_diff_header global current_diff_queue @@ -410,7 +424,9 @@ proc read_diff {fd cont_info} { {- } {set tags d_-s} {--} {set tags d_--} {++} { - if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} { + set regexp [string map [list %conflict_size $conflict_size]\ + {^\+\+([<>=]){%conflict_size}(?: |$)}] + if {[regexp $regexp $line _g op]} { set is_conflict_diff 1 set line [string replace $line 0 1 { }] set tags d$op @@ -449,7 +465,9 @@ proc read_diff {fd cont_info} { {@} {set tags d_@} {-} {set tags d_-} {+} { - if {[regexp {^\+([<>]{7} |={7})} $line _g op]} { + set regexp [string map [list %conflict_size $conflict_size]\ + {^\+([<>=]){%conflict_size}(?: |$)}] + if {[regexp $regexp $line _g op]} { set is_conflict_diff 1 set tags d$op } else { -- cgit v0.10.2-6-g49f6 From 1ab862862fb985131ae081ddde4d8f8b7e23c17b Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Fri, 19 Nov 2010 21:43:48 +0100 Subject: git-gui: fix browsers [Up To Parent] in sub-sub-directories. browser_path used to end with a slash, so the regexp matches the empty string and therefore removes nothing. Fix this. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/browser.tcl b/lib/browser.tcl index c241572..a8c6223 100644 --- a/lib/browser.tcl +++ b/lib/browser.tcl @@ -121,7 +121,7 @@ method _parent {} { if {$browser_stack eq {}} { regsub {:.*$} $browser_path {:} browser_path } else { - regsub {/[^/]+$} $browser_path {} browser_path + regsub {/[^/]+/$} $browser_path {/} browser_path } set browser_status [mc "Loading %s..." $browser_path] _ls $this [lindex $parent 0] [lindex $parent 1] -- cgit v0.10.2-6-g49f6 From c7ec31a36e6309be1392ea58948303286665fdd9 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 29 Nov 2010 09:21:57 +0100 Subject: git-gui: Fix use of renamed tag. The d======= was renamed to d= in 4590307. Fix this. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 8fea947..7b1fddf 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -122,22 +122,22 @@ proc show_unmerged_diff {cont_info} { if {$merge_stages(2) eq {}} { set is_conflict_diff 1 lappend current_diff_queue \ - [list [mc "LOCAL: deleted\nREMOTE:\n"] d======= \ + [list [mc "LOCAL: deleted\nREMOTE:\n"] d= \ [list ":1:$current_diff_path" ":3:$current_diff_path"]] } elseif {$merge_stages(3) eq {}} { set is_conflict_diff 1 lappend current_diff_queue \ - [list [mc "REMOTE: deleted\nLOCAL:\n"] d======= \ + [list [mc "REMOTE: deleted\nLOCAL:\n"] d= \ [list ":1:$current_diff_path" ":2:$current_diff_path"]] } elseif {[lindex $merge_stages(1) 0] eq {120000} || [lindex $merge_stages(2) 0] eq {120000} || [lindex $merge_stages(3) 0] eq {120000}} { set is_conflict_diff 1 lappend current_diff_queue \ - [list [mc "LOCAL:\n"] d======= \ + [list [mc "LOCAL:\n"] d= \ [list ":1:$current_diff_path" ":2:$current_diff_path"]] lappend current_diff_queue \ - [list [mc "REMOTE:\n"] d======= \ + [list [mc "REMOTE:\n"] d= \ [list ":1:$current_diff_path" ":3:$current_diff_path"]] } else { start_show_diff $cont_info -- cgit v0.10.2-6-g49f6 From 88b21c2a407833a66f9aeb650f5b96c672691ecf Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 6 Dec 2010 22:01:01 +0000 Subject: git-gui: Fix use of hunk tag for non-hunk content. The hunk tag d_@ lost its blue forground color in "apply color information from git diff output" (2010-10-22, 8f85599). But this tag was also used for non-hunk content like untracked file mime types or git submodules. Introduce a new tag for this type of content which has the blue forground again. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/git-gui.sh b/git-gui.sh index 38362fa..c85a53c 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -3331,6 +3331,8 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr } $ui_diff tag configure clr1 -font font_diffbold +$ui_diff tag conf d_info -foreground blue -font font_diffbold + $ui_diff tag conf d_cr -elide true $ui_diff tag conf d_@ -font font_diffbold $ui_diff tag conf d_+ -foreground {#00a000} diff --git a/lib/diff.tcl b/lib/diff.tcl index 7b1fddf..9d0dc07 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -208,32 +208,32 @@ proc show_other_diff {path w m cont_info} { $ui_diff insert end [append \ "* " \ [mc "Git Repository (subproject)"] \ - "\n"] d_@ + "\n"] d_info } elseif {![catch {set type [exec file $path]}]} { set n [string length $path] if {[string equal -length $n $path $type]} { set type [string range $type $n end] regsub {^:?\s*} $type {} type } - $ui_diff insert end "* $type\n" d_@ + $ui_diff insert end "* $type\n" d_info } if {[string first "\0" $content] != -1} { $ui_diff insert end \ [mc "* Binary file (not showing content)."] \ - d_@ + d_info } else { if {$sz > $max_sz} { $ui_diff insert end [mc \ "* Untracked file is %d bytes. * Showing only first %d bytes. -" $sz $max_sz] d_@ +" $sz $max_sz] d_info } $ui_diff insert end $content if {$sz > $max_sz} { $ui_diff insert end [mc " * Untracked file clipped here by %s. * To see the entire file, use an external editor. -" [appname]] d_@ +" [appname]] d_info } } $ui_diff conf -state disabled @@ -442,10 +442,10 @@ proc read_diff {fd conflict_size cont_info} { } elseif {$is_submodule_diff} { if {$line == ""} continue if {[regexp {^Submodule } $line]} { - set tags d_@ + set tags d_info } elseif {[regexp {^\* } $line]} { set line [string replace $line 0 1 {Submodule }] - set tags d_@ + set tags d_info } else { set op [string range $line 0 2] switch -- $op { -- cgit v0.10.2-6-g49f6 From 673eb4a01f340e5b0be0776fd05d1e84766182a3 Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 10 Dec 2010 15:41:09 +0000 Subject: git-gui: use --exclude-standard to check for untracked files This fixes git-gui failing to display untracked files that are listed if core.excludefiles is set to ~/.gitexcludes [PT: added expansion of core.excludesfile value by tcl] Signed-off-by: Stefan Naewe Signed-off-by: Pat Thoyts diff --git a/git-gui.sh b/git-gui.sh index c85a53c..8c3cf6b 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1448,13 +1448,17 @@ proc rescan_stage2 {fd after} { close $fd } - set ls_others [list --exclude-per-directory=.gitignore] - if {[have_info_exclude]} { - lappend ls_others "--exclude-from=[gitdir info exclude]" - } - set user_exclude [get_config core.excludesfile] - if {$user_exclude ne {} && [file readable $user_exclude]} { - lappend ls_others "--exclude-from=$user_exclude" + if {[package vsatisfies $::_git_version 1.6.3]} { + set ls_others [list --exclude-standard] + } else { + set ls_others [list --exclude-per-directory=.gitignore] + if {[have_info_exclude]} { + lappend ls_others "--exclude-from=[gitdir info exclude]" + } + set user_exclude [get_config core.excludesfile] + if {$user_exclude ne {} && [file readable $user_exclude]} { + lappend ls_others "--exclude-from=[file normalize $user_exclude]" + } } set buf_rdi {} -- cgit v0.10.2-6-g49f6 From 0cb6ad3c3d8e9c738686ef8dc6f173f725e509bc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 11 Jan 2011 15:00:38 -0500 Subject: checkout: fix bug with ambiguous refs The usual dwim_ref lookup prefers tags to branches. Because checkout primarily works on branches, though, we switch that behavior to prefer branches. However, there was a bug in the implementation in which we used lookup_commit_reference (which used the regular lookup rules) to get the actual commit to checkout. Checking out an ambiguous ref therefore ended up putting us in an extremely broken state in which we wrote the branch ref into HEAD, but actually checked out the tree for the tag. This patch fixes the bug by always attempting to pull the commit to be checked out from the branch-ified version of the name we were given. Patch by Junio, tests and commit message from Jeff King. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/builtin/checkout.c b/builtin/checkout.c index a54583b..953abdd 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -678,7 +678,7 @@ static const char *unique_tracking_name(const char *name) int cmd_checkout(int argc, const char **argv, const char *prefix) { struct checkout_opts opts; - unsigned char rev[20]; + unsigned char rev[20], branch_rev[20]; const char *arg; struct branch_info new; struct tree *source_tree = NULL; @@ -832,18 +832,21 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) argc--; new.name = arg; - if ((new.commit = lookup_commit_reference_gently(rev, 1))) { - setup_branch_path(&new); + setup_branch_path(&new); - if ((check_ref_format(new.path) == CHECK_REF_FORMAT_OK) && - resolve_ref(new.path, rev, 1, NULL)) - ; - else - new.path = NULL; + if (check_ref_format(new.path) == CHECK_REF_FORMAT_OK && + resolve_ref(new.path, branch_rev, 1, NULL)) + hashcpy(rev, branch_rev); + else + new.path = NULL; /* not an existing branch */ + + if (!(new.commit = lookup_commit_reference_gently(rev, 1))) { + /* not a commit */ + source_tree = parse_tree_indirect(rev); + } else { parse_commit(new.commit); source_tree = new.commit->tree; - } else - source_tree = parse_tree_indirect(rev); + } if (!source_tree) /* case (1): want a tree */ die("reference is not a tree: %s", arg); diff --git a/t/t2019-checkout-amiguous-ref.sh b/t/t2019-checkout-amiguous-ref.sh new file mode 100755 index 0000000..943541d --- /dev/null +++ b/t/t2019-checkout-amiguous-ref.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +test_description='checkout handling of ambiguous (branch/tag) refs' +. ./test-lib.sh + +test_expect_success 'setup ambiguous refs' ' + test_commit branch file && + git branch ambiguity && + git branch vagueness && + test_commit tag file && + git tag ambiguity && + git tag vagueness HEAD:file && + test_commit other file +' + +test_expect_success 'checkout ambiguous ref succeeds' ' + git checkout ambiguity >stdout 2>stderr +' + +test_expect_success 'checkout produces ambiguity warning' ' + grep "warning.*ambiguous" stderr +' + +test_expect_success 'checkout chooses branch over tag' ' + echo refs/heads/ambiguity >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual && + echo branch >expect && + test_cmp expect file +' + +test_expect_success 'checkout reports switch to branch' ' + grep "Switched to branch" stderr && + ! grep "^HEAD is now at" stderr +' + +test_expect_success 'checkout vague ref succeeds' ' + git checkout vagueness >stdout 2>stderr && + test_set_prereq VAGUENESS_SUCCESS +' + +test_expect_success VAGUENESS_SUCCESS 'checkout produces ambiguity warning' ' + grep "warning.*ambiguous" stderr +' + +test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' ' + echo refs/heads/vagueness >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual && + echo branch >expect && + test_cmp expect file +' + +test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' ' + grep "Switched to branch" stderr && + ! grep "^HEAD is now at" stderr +' + +test_done -- cgit v0.10.2-6-g49f6 From 7add5aff869746ced2b506801176561d4b80e427 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 6 Jan 2011 17:42:33 -0700 Subject: gitk: Take only numeric version components when computing $git_version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes errors running with release candidate versions of Git: Error in startup script: expected version number but got "1.7.4-rc0" Also, $git_version is no longer artificially limited to three components. That limitation was added by commit 194bbf6cc8c2 ("gitk: Handle msysGit version during version comparisons") to deal with msysGit version strings like “1.6.4.msysgit.0”, and we don’t need it now. Hence as another side effect, this enables showing notes with git version 1.6.6.2 or 1.6.6.3, as originally intended by commit 7defefb13427 ("gitk: Show notes by default (like git log does"). Signed-off-by: Anders Kaseorg Reported-by: Mathias Lafeldt Reviewed-by: Jonathan Nieder Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index e82c6bf..9cbc09d 100755 --- a/gitk +++ b/gitk @@ -11581,7 +11581,7 @@ if {![info exists have_ttk]} { set use_ttk [expr {$have_ttk && $want_ttk}] set NS [expr {$use_ttk ? "ttk" : ""}] -set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .] +regexp {^git version ([\d.]*\d)} [exec git version] _ git_version set show_notes {} if {[package vcompare $git_version "1.6.6.2"] >= 0} { -- cgit v0.10.2-6-g49f6 From 7317a104c4bbaa9bd061f4276297c924ba91a946 Mon Sep 17 00:00:00 2001 From: Skip Date: Mon, 17 Jan 2011 22:23:12 +0100 Subject: gitk: spelling fixes in Russian translation Signed-off-by: Skip Signed-off-by: Alex Riesen Signed-off-by: Paul Mackerras diff --git a/po/ru.po b/po/ru.po index c3d0285..5987303 100644 --- a/po/ru.po +++ b/po/ru.po @@ -24,7 +24,7 @@ msgstr "Ошибка в идентификаторе версии:" #: gitk:323 msgid "Error executing --argscmd command:" -msgstr "Ошибка выполнения команды заданой --argscmd:" +msgstr "Ошибка выполнения команды заданной --argscmd:" #: gitk:336 msgid "No files selected: --merge specified but no files are unmerged." @@ -37,7 +37,7 @@ msgid "" "No files selected: --merge specified but no unmerged files are within file " "limit." msgstr "" -"Файлы не выбраны: указан --merge, но в рамках указаного " +"Файлы не выбраны: указан --merge, но в рамках указанного " "ограничения на имена файлов нет ни одного " "где эта операция должна быть завершена." @@ -246,11 +246,11 @@ msgstr "Файлы" #: gitk:2326 gitk:2339 msgid "Diff this -> selected" -msgstr "Сравнить это состояние с выделеным" +msgstr "Сравнить это состояние с выделенным" #: gitk:2327 gitk:2340 msgid "Diff selected -> this" -msgstr "Сравнить выделеное с этим состоянием" +msgstr "Сравнить выделенное с этим состоянием" #: gitk:2328 gitk:2341 msgid "Make patch" @@ -440,11 +440,11 @@ msgstr "<%s-F>\t\tПоиск" #: gitk:2666 #, tcl-format msgid "<%s-G>\t\tMove to next find hit" -msgstr "<%s-G>\t\tПерейти к следующему найденому состоянию" +msgstr "<%s-G>\t\tПерейти к следующему найденному состоянию" #: gitk:2667 msgid "\tMove to next find hit" -msgstr "\tПерейти к следующему найденому состоянию" +msgstr "\tПерейти к следующему найденному состоянию" #: gitk:2668 msgid "/\t\tFocus the search box" @@ -452,7 +452,7 @@ msgstr "/\t\tПерейти к полю поиска" #: gitk:2669 msgid "?\t\tMove to previous find hit" -msgstr "?\t\tПерейти к предыдущему найденому состоянию" +msgstr "?\t\tПерейти к предыдущему найденному состоянию" #: gitk:2670 msgid "f\t\tScroll diff view to next file" @@ -466,7 +466,7 @@ msgstr "<%s-S>\t\tПродолжить поиск в списке изменен #: gitk:2672 #, tcl-format msgid "<%s-R>\t\tSearch for previous hit in diff view" -msgstr "<%s-R>\t\tПерейти к предыдущему найденому тексту в списке изменений" +msgstr "<%s-R>\t\tПерейти к предыдущему найденному тексту в списке изменений" #: gitk:2673 #, tcl-format @@ -855,7 +855,7 @@ msgstr "Лёгкий: оставить рабочий каталог и инде #: gitk:8472 msgid "Mixed: Leave working tree untouched, reset index" msgstr "" -"Смешаный: оставить рабочий каталог неизменным, установить индекс" +"Смешанный: оставить рабочий каталог неизменным, установить индекс" #: gitk:8475 msgid "" @@ -962,7 +962,7 @@ msgstr "Показывать близкие метки" #: gitk:10126 msgid "Limit diffs to listed paths" -msgstr "Ограничить показ изменений выбраными файлами" +msgstr "Ограничить показ изменений выбранными файлами" #: gitk:10129 msgid "Support per-file encodings" @@ -1022,11 +1022,11 @@ msgstr "заголовок блока изменений" #: gitk:10169 msgid "Marked line bg" -msgstr "Фон выбраной строки" +msgstr "Фон выбранной строки" #: gitk:10171 msgid "marked line background" -msgstr "фон выбраной строки" +msgstr "фон выбранной строки" #: gitk:10175 msgid "Select bg" -- cgit v0.10.2-6-g49f6 From 9673abc7cc94be4d89ae9edeeef2910c74660633 Mon Sep 17 00:00:00 2001 From: Serge Ziryukin Date: Mon, 17 Jan 2011 22:08:24 +0100 Subject: git-gui: fix russian translation typos Signed-off-by: Serge Ziryukin Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts diff --git a/po/ru.po b/po/ru.po index 364c074..c15bdfa 100644 --- a/po/ru.po +++ b/po/ru.po @@ -2292,11 +2292,11 @@ msgstr "Словарь вернут к %s." #: lib/spellcheck.tcl:73 msgid "Spell checker silently failed on startup" -msgstr "Программа проверки правописания не смогла запустится" +msgstr "Программа проверки правописания не смогла запуститься" #: lib/spellcheck.tcl:80 msgid "Unrecognized spell checker" -msgstr "Нераспознаная программа проверки правописания" +msgstr "Нераспознанная программа проверки правописания" #: lib/spellcheck.tcl:186 msgid "No Suggestions" -- cgit v0.10.2-6-g49f6 From b6efd40d6c7f07d20b0a7341c473f5fb18e249b4 Mon Sep 17 00:00:00 2001 From: Skip Date: Mon, 17 Jan 2011 22:08:28 +0100 Subject: git-gui: spelling fixes in russian translation Signed-off-by: Skip Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts diff --git a/po/ru.po b/po/ru.po index c15bdfa..304bb3a 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1342,7 +1342,7 @@ msgid "" "File %s has merge conflicts. You must resolve them and stage the file " "before committing.\n" msgstr "" -"Нельзя сохранить файлы с незавершённой операцей слияния.\n" +"Нельзя сохранить файлы с незавершённой операцией слияния.\n" "\n" "Для файла %s возник конфликт слияния. Разрешите конфликт и добавьте к " "подготовленным файлам перед сохранением.\n" @@ -1440,7 +1440,7 @@ msgstr "" #: lib/commit.tcl:338 msgid "No changes to commit." -msgstr "Отуствуют измения для сохранения." +msgstr "Отсутствуют изменения для сохранения." #: lib/commit.tcl:352 msgid "commit-tree failed:" @@ -1540,7 +1540,7 @@ msgid "" msgstr "" "Изменений не обнаружено.\n" "\n" -"в %s отутствуют изменения.\n" +"в %s отсутствуют изменения.\n" "\n" "Дата изменения файла была обновлена другой программой, но содержимое файла " "осталось прежним.\n" @@ -1599,7 +1599,7 @@ msgid "" "* Untracked file is %d bytes.\n" "* Showing only first %d bytes.\n" msgstr "" -"* Размер неподготовленого файла %d байт.\n" +"* Размер неподготовленного файла %d байт.\n" "* Показано первых %d байт.\n" #: lib/diff.tcl:228 @@ -1610,7 +1610,7 @@ msgid "" "* To see the entire file, use an external editor.\n" msgstr "" "\n" -"* Неподготовленый файл обрезан: %s.\n" +"* Неподготовленный файл обрезан: %s.\n" "* Чтобы увидеть весь файл, используйте программу-редактор.\n" #: lib/diff.tcl:436 @@ -1667,7 +1667,7 @@ msgid "" "Updating the Git index failed. A rescan will be automatically started to " "resynchronize git-gui." msgstr "" -"Не удалось обновить индекс Git. Состояние репозитория будетперечитано " +"Не удалось обновить индекс Git. Состояние репозитория будет перечитано " "автоматически." #: lib/index.tcl:27 @@ -1714,7 +1714,7 @@ msgstr "Ничего не делать" #: lib/index.tcl:427 msgid "Reverting selected files" -msgstr "Удаление изменений в выбраных файлах" +msgstr "Удаление изменений в выбранных файлах" #: lib/index.tcl:431 #, tcl-format @@ -1778,7 +1778,7 @@ msgstr "" "\n" "Файл %s изменен.\n" "\n" -"Подготовьте и сохраните измения перед началом слияния. В случае " +"Подготовьте и сохраните изменения перед началом слияния. В случае " "необходимости это позволит прервать операцию слияния.\n" #: lib/merge.tcl:107 @@ -1893,7 +1893,7 @@ msgstr "" #, tcl-format msgid "File %s seems to have unresolved conflicts, still stage?" msgstr "" -"Файл %s кажется содержит необработаные конфликты. Продолжить подготовку к " +"Файл %s кажется содержит необработанные конфликты. Продолжить подготовку к " "сохранению?" #: lib/mergetool.tcl:60 @@ -2152,7 +2152,7 @@ msgstr "Получение %s" #: lib/remote_add.tcl:157 #, tcl-format msgid "Do not know how to initialize repository at location '%s'." -msgstr "Невозможно инициалировать репозиторий в '%s'." +msgstr "Невозможно инициализировать репозиторий в '%s'." #: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:63 #: lib/transport.tcl:81 @@ -2179,7 +2179,7 @@ msgstr "внешний:" #: lib/remote_branch_delete.tcl:66 lib/transport.tcl:149 msgid "Arbitrary Location:" -msgstr "Указаное положение:" +msgstr "Указанное положение:" #: lib/remote_branch_delete.tcl:84 msgid "Branches" @@ -2412,7 +2412,7 @@ msgstr "Описание вспомогательной операции" #: lib/tools_dlg.tcl:48 msgid "Use '/' separators to create a submenu tree:" -msgstr "Испольуйте '/' для создания подменю" +msgstr "Используйте '/' для создания подменю" #: lib/tools_dlg.tcl:61 msgid "Command:" -- cgit v0.10.2-6-g49f6 From 75e88a592f018904dab4498344b8f0579a0a2cd5 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Mon, 17 Jan 2011 22:08:55 +0100 Subject: git-gui: update russian translation Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts diff --git a/po/ru.po b/po/ru.po index 304bb3a..7071a8c 100644 --- a/po/ru.po +++ b/po/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: git-gui\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-12-08 08:31-0800\n" +"POT-Creation-Date: 2010-01-26 15:47-0800\n" "PO-Revision-Date: 2007-10-22 22:30-0200\n" "Last-Translator: Alex Riesen \n" "Language-Team: Russian Translation \n" @@ -15,33 +15,33 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: git-gui.sh:41 git-gui.sh:737 git-gui.sh:751 git-gui.sh:764 git-gui.sh:847 -#: git-gui.sh:866 +#: git-gui.sh:41 git-gui.sh:793 git-gui.sh:807 git-gui.sh:820 git-gui.sh:903 +#: git-gui.sh:922 msgid "git-gui: fatal error" msgstr "git-gui: критическая ошибка" -#: git-gui.sh:689 +#: git-gui.sh:743 #, tcl-format msgid "Invalid font specified in %s:" msgstr "В %s установлен неверный шрифт:" -#: git-gui.sh:723 +#: git-gui.sh:779 msgid "Main Font" msgstr "Шрифт интерфейса" -#: git-gui.sh:724 +#: git-gui.sh:780 msgid "Diff/Console Font" msgstr "Шрифт консоли и изменений (diff)" -#: git-gui.sh:738 +#: git-gui.sh:794 msgid "Cannot find git in PATH." msgstr "git не найден в PATH." -#: git-gui.sh:765 +#: git-gui.sh:821 msgid "Cannot parse Git version string:" msgstr "Невозможно распознать строку версии Git: " -#: git-gui.sh:783 +#: git-gui.sh:839 #, tcl-format msgid "" "Git version cannot be determined.\n" @@ -60,450 +60,474 @@ msgstr "" "\n" "Принять '%s' как версию 1.5.0?\n" -#: git-gui.sh:1062 +#: git-gui.sh:1128 msgid "Git directory not found:" msgstr "Каталог Git не найден:" -#: git-gui.sh:1069 +#: git-gui.sh:1146 msgid "Cannot move to top of working directory:" msgstr "Невозможно перейти к корню рабочего каталога репозитория: " -#: git-gui.sh:1076 -msgid "Cannot use funny .git directory:" -msgstr "Каталог .git испорчен: " +#: git-gui.sh:1154 +msgid "Cannot use bare repository:" +msgstr "Невозможно использование репозитория без рабочего каталога:" -#: git-gui.sh:1081 +#: git-gui.sh:1162 msgid "No working directory" msgstr "Отсутствует рабочий каталог" -#: git-gui.sh:1247 lib/checkout_op.tcl:305 +#: git-gui.sh:1334 lib/checkout_op.tcl:306 msgid "Refreshing file status..." msgstr "Обновление информации о состоянии файлов..." -#: git-gui.sh:1303 +#: git-gui.sh:1390 msgid "Scanning for modified files ..." msgstr "Поиск измененных файлов..." -#: git-gui.sh:1367 +#: git-gui.sh:1454 msgid "Calling prepare-commit-msg hook..." msgstr "Вызов программы поддержки репозитория prepare-commit-msg..." -#: git-gui.sh:1384 +#: git-gui.sh:1471 msgid "Commit declined by prepare-commit-msg hook." msgstr "" "Сохранение прервано программой поддержки репозитория prepare-commit-msg" -#: git-gui.sh:1542 lib/browser.tcl:246 +#: git-gui.sh:1629 lib/browser.tcl:246 msgid "Ready." msgstr "Готово." -#: git-gui.sh:1726 +#: git-gui.sh:1787 #, tcl-format msgid "Displaying only %s of %s files." msgstr "Показано %s из %s файлов." -#: git-gui.sh:1819 +#: git-gui.sh:1913 msgid "Unmodified" msgstr "Не изменено" -#: git-gui.sh:1821 +#: git-gui.sh:1915 msgid "Modified, not staged" msgstr "Изменено, не подготовлено" -#: git-gui.sh:1822 git-gui.sh:1830 +#: git-gui.sh:1916 git-gui.sh:1924 msgid "Staged for commit" msgstr "Подготовлено для сохранения" -#: git-gui.sh:1823 git-gui.sh:1831 +#: git-gui.sh:1917 git-gui.sh:1925 msgid "Portions staged for commit" msgstr "Части, подготовленные для сохранения" -#: git-gui.sh:1824 git-gui.sh:1832 +#: git-gui.sh:1918 git-gui.sh:1926 msgid "Staged for commit, missing" msgstr "Подготовлено для сохранения, отсутствует" -#: git-gui.sh:1826 +#: git-gui.sh:1920 msgid "File type changed, not staged" msgstr "Тип файла изменён, не подготовлено" -#: git-gui.sh:1827 +#: git-gui.sh:1921 msgid "File type changed, staged" msgstr "Тип файла изменён, подготовлено" -#: git-gui.sh:1829 +#: git-gui.sh:1923 msgid "Untracked, not staged" msgstr "Не отслеживается, не подготовлено" -#: git-gui.sh:1834 +#: git-gui.sh:1928 msgid "Missing" msgstr "Отсутствует" -#: git-gui.sh:1835 +#: git-gui.sh:1929 msgid "Staged for removal" msgstr "Подготовлено для удаления" -#: git-gui.sh:1836 +#: git-gui.sh:1930 msgid "Staged for removal, still present" msgstr "Подготовлено для удаления, еще не удалено" -#: git-gui.sh:1838 git-gui.sh:1839 git-gui.sh:1840 git-gui.sh:1841 -#: git-gui.sh:1842 git-gui.sh:1843 +#: git-gui.sh:1932 git-gui.sh:1933 git-gui.sh:1934 git-gui.sh:1935 +#: git-gui.sh:1936 git-gui.sh:1937 msgid "Requires merge resolution" msgstr "Требуется разрешение конфликта при слиянии" -#: git-gui.sh:1878 +#: git-gui.sh:1972 msgid "Starting gitk... please wait..." msgstr "Запускается gitk... Подождите, пожалуйста..." -#: git-gui.sh:1887 +#: git-gui.sh:1984 msgid "Couldn't find gitk in PATH" msgstr "gitk не найден в PATH." -#: git-gui.sh:2280 lib/choose_repository.tcl:36 +#: git-gui.sh:2043 +msgid "Couldn't find git gui in PATH" +msgstr "git gui не найден в PATH." + +#: git-gui.sh:2455 lib/choose_repository.tcl:36 msgid "Repository" msgstr "Репозиторий" -#: git-gui.sh:2281 +#: git-gui.sh:2456 msgid "Edit" msgstr "Редактировать" -#: git-gui.sh:2283 lib/choose_rev.tcl:561 +#: git-gui.sh:2458 lib/choose_rev.tcl:561 msgid "Branch" msgstr "Ветвь" -#: git-gui.sh:2286 lib/choose_rev.tcl:548 +#: git-gui.sh:2461 lib/choose_rev.tcl:548 msgid "Commit@@noun" msgstr "Состояние" -#: git-gui.sh:2289 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168 +#: git-gui.sh:2464 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168 msgid "Merge" msgstr "Слияние" -#: git-gui.sh:2290 lib/choose_rev.tcl:557 +#: git-gui.sh:2465 lib/choose_rev.tcl:557 msgid "Remote" msgstr "Внешние репозитории" -#: git-gui.sh:2293 +#: git-gui.sh:2468 msgid "Tools" msgstr "Вспомогательные операции" -#: git-gui.sh:2302 +#: git-gui.sh:2477 msgid "Explore Working Copy" msgstr "Просмотр рабочего каталога" -#: git-gui.sh:2307 +#: git-gui.sh:2483 msgid "Browse Current Branch's Files" msgstr "Просмотреть файлы текущей ветви" -#: git-gui.sh:2311 +#: git-gui.sh:2487 msgid "Browse Branch Files..." msgstr "Показать файлы ветви..." -#: git-gui.sh:2316 +#: git-gui.sh:2492 msgid "Visualize Current Branch's History" msgstr "Показать историю текущей ветви" -#: git-gui.sh:2320 +#: git-gui.sh:2496 msgid "Visualize All Branch History" msgstr "Показать историю всех ветвей" -#: git-gui.sh:2327 +#: git-gui.sh:2503 #, tcl-format msgid "Browse %s's Files" msgstr "Показать файлы ветви %s" -#: git-gui.sh:2329 +#: git-gui.sh:2505 #, tcl-format msgid "Visualize %s's History" msgstr "Показать историю ветви %s" -#: git-gui.sh:2334 lib/database.tcl:27 lib/database.tcl:67 +#: git-gui.sh:2510 lib/database.tcl:27 lib/database.tcl:67 msgid "Database Statistics" msgstr "Статистика базы данных" -#: git-gui.sh:2337 lib/database.tcl:34 +#: git-gui.sh:2513 lib/database.tcl:34 msgid "Compress Database" msgstr "Сжать базу данных" -#: git-gui.sh:2340 +#: git-gui.sh:2516 msgid "Verify Database" msgstr "Проверить базу данных" -#: git-gui.sh:2347 git-gui.sh:2351 git-gui.sh:2355 lib/shortcut.tcl:7 -#: lib/shortcut.tcl:39 lib/shortcut.tcl:71 +#: git-gui.sh:2523 git-gui.sh:2527 git-gui.sh:2531 lib/shortcut.tcl:8 +#: lib/shortcut.tcl:40 lib/shortcut.tcl:72 msgid "Create Desktop Icon" msgstr "Создать ярлык на рабочем столе" -#: git-gui.sh:2363 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191 +#: git-gui.sh:2539 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191 msgid "Quit" msgstr "Выход" -#: git-gui.sh:2371 +#: git-gui.sh:2547 msgid "Undo" msgstr "Отменить" -#: git-gui.sh:2374 +#: git-gui.sh:2550 msgid "Redo" msgstr "Повторить" -#: git-gui.sh:2378 git-gui.sh:2937 +#: git-gui.sh:2554 git-gui.sh:3109 msgid "Cut" msgstr "Вырезать" -#: git-gui.sh:2381 git-gui.sh:2940 git-gui.sh:3014 git-gui.sh:3096 +#: git-gui.sh:2557 git-gui.sh:3112 git-gui.sh:3186 git-gui.sh:3259 #: lib/console.tcl:69 msgid "Copy" msgstr "Копировать" -#: git-gui.sh:2384 git-gui.sh:2943 +#: git-gui.sh:2560 git-gui.sh:3115 msgid "Paste" msgstr "Вставить" -#: git-gui.sh:2387 git-gui.sh:2946 lib/branch_delete.tcl:26 +#: git-gui.sh:2563 git-gui.sh:3118 lib/branch_delete.tcl:26 #: lib/remote_branch_delete.tcl:38 msgid "Delete" msgstr "Удалить" -#: git-gui.sh:2391 git-gui.sh:2950 git-gui.sh:3100 lib/console.tcl:71 +#: git-gui.sh:2567 git-gui.sh:3122 git-gui.sh:3263 lib/console.tcl:71 msgid "Select All" msgstr "Выделить все" -#: git-gui.sh:2400 +#: git-gui.sh:2576 msgid "Create..." msgstr "Создать..." -#: git-gui.sh:2406 +#: git-gui.sh:2582 msgid "Checkout..." msgstr "Перейти..." -#: git-gui.sh:2412 +#: git-gui.sh:2588 msgid "Rename..." msgstr "Переименовать..." -#: git-gui.sh:2417 +#: git-gui.sh:2593 msgid "Delete..." msgstr "Удалить..." -#: git-gui.sh:2422 +#: git-gui.sh:2598 msgid "Reset..." msgstr "Сбросить..." -#: git-gui.sh:2432 +#: git-gui.sh:2608 msgid "Done" msgstr "Завершено" -#: git-gui.sh:2434 +#: git-gui.sh:2610 msgid "Commit@@verb" msgstr "Сохранить" -#: git-gui.sh:2443 git-gui.sh:2878 +#: git-gui.sh:2619 git-gui.sh:3050 msgid "New Commit" msgstr "Новое состояние" -#: git-gui.sh:2451 git-gui.sh:2885 +#: git-gui.sh:2627 git-gui.sh:3057 msgid "Amend Last Commit" msgstr "Исправить последнее состояние" -#: git-gui.sh:2461 git-gui.sh:2839 lib/remote_branch_delete.tcl:99 +#: git-gui.sh:2637 git-gui.sh:3011 lib/remote_branch_delete.tcl:99 msgid "Rescan" msgstr "Перечитать" -#: git-gui.sh:2467 +#: git-gui.sh:2643 msgid "Stage To Commit" msgstr "Подготовить для сохранения" -#: git-gui.sh:2473 +#: git-gui.sh:2649 msgid "Stage Changed Files To Commit" msgstr "Подготовить измененные файлы для сохранения" -#: git-gui.sh:2479 +#: git-gui.sh:2655 msgid "Unstage From Commit" msgstr "Убрать из подготовленного" -#: git-gui.sh:2484 lib/index.tcl:410 +#: git-gui.sh:2661 lib/index.tcl:412 msgid "Revert Changes" msgstr "Отменить изменения" -#: git-gui.sh:2491 git-gui.sh:3083 +#: git-gui.sh:2669 git-gui.sh:3310 git-gui.sh:3341 msgid "Show Less Context" msgstr "Меньше контекста" -#: git-gui.sh:2495 git-gui.sh:3087 +#: git-gui.sh:2673 git-gui.sh:3314 git-gui.sh:3345 msgid "Show More Context" msgstr "Больше контекста" -#: git-gui.sh:2502 git-gui.sh:2852 git-gui.sh:2961 +#: git-gui.sh:2680 git-gui.sh:3024 git-gui.sh:3133 msgid "Sign Off" msgstr "Вставить Signed-off-by" -#: git-gui.sh:2518 +#: git-gui.sh:2696 msgid "Local Merge..." msgstr "Локальное слияние..." -#: git-gui.sh:2523 +#: git-gui.sh:2701 msgid "Abort Merge..." msgstr "Прервать слияние..." -#: git-gui.sh:2535 git-gui.sh:2575 +#: git-gui.sh:2713 git-gui.sh:2741 msgid "Add..." msgstr "Добавить..." -#: git-gui.sh:2539 +#: git-gui.sh:2717 msgid "Push..." msgstr "Отправить..." -#: git-gui.sh:2543 +#: git-gui.sh:2721 msgid "Delete Branch..." msgstr "Удалить ветвь..." -#: git-gui.sh:2553 git-gui.sh:2589 lib/about.tcl:14 -#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53 -#, tcl-format -msgid "About %s" -msgstr "О %s" - -#: git-gui.sh:2557 -msgid "Preferences..." -msgstr "Настройки..." - -#: git-gui.sh:2565 git-gui.sh:3129 +#: git-gui.sh:2731 git-gui.sh:3292 msgid "Options..." msgstr "Настройки..." -#: git-gui.sh:2576 +#: git-gui.sh:2742 msgid "Remove..." msgstr "Удалить..." -#: git-gui.sh:2585 lib/choose_repository.tcl:50 +#: git-gui.sh:2751 lib/choose_repository.tcl:50 msgid "Help" msgstr "Помощь" -#: git-gui.sh:2611 +#: git-gui.sh:2755 git-gui.sh:2759 lib/about.tcl:14 +#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53 +#, tcl-format +msgid "About %s" +msgstr "О %s" + +#: git-gui.sh:2783 msgid "Online Documentation" msgstr "Документация в интернете" -#: git-gui.sh:2614 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56 +#: git-gui.sh:2786 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56 msgid "Show SSH Key" msgstr "Показать ключ SSH" -#: git-gui.sh:2721 +#: git-gui.sh:2893 #, tcl-format msgid "fatal: cannot stat path %s: No such file or directory" msgstr "критическая ошибка: %s: нет такого файла или каталога" -#: git-gui.sh:2754 +#: git-gui.sh:2926 msgid "Current Branch:" msgstr "Текущая ветвь:" -#: git-gui.sh:2775 +#: git-gui.sh:2947 msgid "Staged Changes (Will Commit)" msgstr "Подготовлено (будет сохранено)" -#: git-gui.sh:2795 +#: git-gui.sh:2967 msgid "Unstaged Changes" msgstr "Изменено (не будет сохранено)" -#: git-gui.sh:2845 +#: git-gui.sh:3017 msgid "Stage Changed" msgstr "Подготовить все" -#: git-gui.sh:2864 lib/transport.tcl:104 lib/transport.tcl:193 +#: git-gui.sh:3036 lib/transport.tcl:104 lib/transport.tcl:193 msgid "Push" msgstr "Отправить" -#: git-gui.sh:2899 +#: git-gui.sh:3071 msgid "Initial Commit Message:" msgstr "Комментарий к первому состоянию:" -#: git-gui.sh:2900 +#: git-gui.sh:3072 msgid "Amended Commit Message:" msgstr "Комментарий к исправленному состоянию:" -#: git-gui.sh:2901 +#: git-gui.sh:3073 msgid "Amended Initial Commit Message:" msgstr "Комментарий к исправленному первоначальному состоянию:" -#: git-gui.sh:2902 +#: git-gui.sh:3074 msgid "Amended Merge Commit Message:" msgstr "Комментарий к исправленному слиянию:" -#: git-gui.sh:2903 +#: git-gui.sh:3075 msgid "Merge Commit Message:" msgstr "Комментарий к слиянию:" -#: git-gui.sh:2904 +#: git-gui.sh:3076 msgid "Commit Message:" msgstr "Комментарий к состоянию:" -#: git-gui.sh:2953 git-gui.sh:3104 lib/console.tcl:73 +#: git-gui.sh:3125 git-gui.sh:3267 lib/console.tcl:73 msgid "Copy All" msgstr "Копировать все" -#: git-gui.sh:2977 lib/blame.tcl:104 +#: git-gui.sh:3149 lib/blame.tcl:104 msgid "File:" msgstr "Файл:" -#: git-gui.sh:3092 +#: git-gui.sh:3255 msgid "Refresh" msgstr "Обновить" -#: git-gui.sh:3113 +#: git-gui.sh:3276 msgid "Decrease Font Size" msgstr "Уменьшить размер шрифта" -#: git-gui.sh:3117 +#: git-gui.sh:3280 msgid "Increase Font Size" msgstr "Увеличить размер шрифта" -#: git-gui.sh:3125 lib/blame.tcl:281 +#: git-gui.sh:3288 lib/blame.tcl:281 msgid "Encoding" msgstr "Кодировка" -#: git-gui.sh:3136 +#: git-gui.sh:3299 msgid "Apply/Reverse Hunk" msgstr "Применить/Убрать изменение" -#: git-gui.sh:3141 +#: git-gui.sh:3304 msgid "Apply/Reverse Line" msgstr "Применить/Убрать строку" -#: git-gui.sh:3151 +#: git-gui.sh:3323 msgid "Run Merge Tool" msgstr "Запустить программу слияния" -#: git-gui.sh:3156 +#: git-gui.sh:3328 msgid "Use Remote Version" msgstr "Взять внешнюю версию" -#: git-gui.sh:3160 +#: git-gui.sh:3332 msgid "Use Local Version" msgstr "Взять локальную версию" -#: git-gui.sh:3164 +#: git-gui.sh:3336 msgid "Revert To Base" msgstr "Отменить изменения" -#: git-gui.sh:3183 +#: git-gui.sh:3354 +msgid "Visualize These Changes In The Submodule" +msgstr "" + +#: git-gui.sh:3358 +msgid "Visualize Current Branch History In The Submodule" +msgstr "Показать историю текущей ветви подмодуля" + +#: git-gui.sh:3362 +msgid "Visualize All Branch History In The Submodule" +msgstr "Показать историю всех ветвей подмодуля" + +#: git-gui.sh:3367 +msgid "Start git gui In The Submodule" +msgstr "" + +#: git-gui.sh:3389 msgid "Unstage Hunk From Commit" msgstr "Не сохранять часть" -#: git-gui.sh:3184 +#: git-gui.sh:3391 +msgid "Unstage Lines From Commit" +msgstr "Убрать строки из подготовленного" + +#: git-gui.sh:3393 msgid "Unstage Line From Commit" msgstr "Убрать строку из подготовленного" -#: git-gui.sh:3186 +#: git-gui.sh:3396 msgid "Stage Hunk For Commit" msgstr "Подготовить часть для сохранения" -#: git-gui.sh:3187 +#: git-gui.sh:3398 +msgid "Stage Lines For Commit" +msgstr "Подготовить строки для сохранения" + +#: git-gui.sh:3400 msgid "Stage Line For Commit" msgstr "Подготовить строку для сохранения" -#: git-gui.sh:3210 +#: git-gui.sh:3424 msgid "Initializing..." msgstr "Инициализация..." -#: git-gui.sh:3315 +#: git-gui.sh:3541 #, tcl-format msgid "" "Possible environment issues exist.\n" @@ -520,7 +544,7 @@ msgstr "" "запущенными из %s\n" "\n" -#: git-gui.sh:3345 +#: git-gui.sh:3570 msgid "" "\n" "This is due to a known issue with the\n" @@ -530,7 +554,7 @@ msgstr "" "Это известная проблема с Tcl,\n" "распространяемым Cygwin." -#: git-gui.sh:3350 +#: git-gui.sh:3575 #, tcl-format msgid "" "\n" @@ -640,7 +664,7 @@ msgstr "Невозможно найти состояние предка:" msgid "Unable to display parent" msgstr "Не могу показать предка" -#: lib/blame.tcl:1091 lib/diff.tcl:297 +#: lib/blame.tcl:1091 lib/diff.tcl:320 msgid "Error loading diff:" msgstr "Ошибка загрузки изменений:" @@ -666,7 +690,7 @@ msgstr "Перейти" #: lib/branch_checkout.tcl:27 lib/branch_create.tcl:35 #: lib/branch_delete.tcl:32 lib/branch_rename.tcl:30 lib/browser.tcl:282 -#: lib/checkout_op.tcl:544 lib/choose_font.tcl:43 lib/merge.tcl:172 +#: lib/checkout_op.tcl:579 lib/choose_font.tcl:43 lib/merge.tcl:172 #: lib/option.tcl:125 lib/remote_add.tcl:32 lib/remote_branch_delete.tcl:42 #: lib/tools_dlg.tcl:40 lib/tools_dlg.tcl:204 lib/tools_dlg.tcl:352 #: lib/transport.tcl:108 @@ -697,7 +721,7 @@ msgstr "Создание ветви" msgid "Create New Branch" msgstr "Создать новую ветвь" -#: lib/branch_create.tcl:31 lib/choose_repository.tcl:377 +#: lib/branch_create.tcl:31 lib/choose_repository.tcl:381 msgid "Create" msgstr "Создать" @@ -729,7 +753,7 @@ msgstr "Нет" msgid "Fast Forward Only" msgstr "Только Fast Forward" -#: lib/branch_create.tcl:85 lib/checkout_op.tcl:536 +#: lib/branch_create.tcl:85 lib/checkout_op.tcl:571 msgid "Reset" msgstr "Сброс" @@ -771,8 +795,8 @@ msgstr "Локальные ветви" msgid "Delete Only If Merged Into" msgstr "Удалить только в случае, если было слияние с" -#: lib/branch_delete.tcl:54 -msgid "Always (Do not perform merge test.)" +#: lib/branch_delete.tcl:54 lib/remote_branch_delete.tcl:119 +msgid "Always (Do not perform merge checks)" msgstr "Всегда (не выполнять проверку на слияние)" #: lib/branch_delete.tcl:103 @@ -780,6 +804,16 @@ msgstr "Всегда (не выполнять проверку на слияни msgid "The following branches are not completely merged into %s:" msgstr "Ветви, которые не полностью сливаются с %s:" +#: lib/branch_delete.tcl:115 lib/remote_branch_delete.tcl:217 +msgid "" +"Recovering deleted branches is difficult.\n" +"\n" +"Delete the selected branches?" +msgstr "" +"Восстановить удаленные ветви сложно.\n" +"\n" +"Продолжить?" + #: lib/branch_delete.tcl:141 #, tcl-format msgid "" @@ -809,7 +843,7 @@ msgstr "Новое название:" msgid "Please select a branch to rename." msgstr "Укажите ветвь для переименования." -#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:201 +#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:202 #, tcl-format msgid "Branch '%s' already exists." msgstr "Ветвь '%s' уже существует." @@ -840,38 +874,38 @@ msgstr "[На уровень выше]" msgid "Browse Branch Files" msgstr "Показать файлы ветви" -#: lib/browser.tcl:278 lib/choose_repository.tcl:394 -#: lib/choose_repository.tcl:480 lib/choose_repository.tcl:491 -#: lib/choose_repository.tcl:995 +#: lib/browser.tcl:278 lib/choose_repository.tcl:398 +#: lib/choose_repository.tcl:486 lib/choose_repository.tcl:497 +#: lib/choose_repository.tcl:1028 msgid "Browse" msgstr "Показать" -#: lib/checkout_op.tcl:84 +#: lib/checkout_op.tcl:85 #, tcl-format msgid "Fetching %s from %s" msgstr "Получение %s из %s " -#: lib/checkout_op.tcl:132 +#: lib/checkout_op.tcl:133 #, tcl-format msgid "fatal: Cannot resolve %s" msgstr "критическая ошибка: невозможно разрешить %s" -#: lib/checkout_op.tcl:145 lib/console.tcl:81 lib/database.tcl:31 +#: lib/checkout_op.tcl:146 lib/console.tcl:81 lib/database.tcl:31 #: lib/sshkey.tcl:53 msgid "Close" msgstr "Закрыть" -#: lib/checkout_op.tcl:174 +#: lib/checkout_op.tcl:175 #, tcl-format msgid "Branch '%s' does not exist." msgstr "Ветвь '%s' не существует " -#: lib/checkout_op.tcl:193 +#: lib/checkout_op.tcl:194 #, tcl-format msgid "Failed to configure simplified git-pull for '%s'." msgstr "Ошибка создания упрощённой конфигурации git pull для '%s'." -#: lib/checkout_op.tcl:228 +#: lib/checkout_op.tcl:229 #, tcl-format msgid "" "Branch '%s' already exists.\n" @@ -884,21 +918,21 @@ msgstr "" "Она не может быть прокручена(fast-forward) к %s.\n" "Требуется слияние." -#: lib/checkout_op.tcl:242 +#: lib/checkout_op.tcl:243 #, tcl-format msgid "Merge strategy '%s' not supported." msgstr "Неизвестная стратегия слияния: '%s'." -#: lib/checkout_op.tcl:261 +#: lib/checkout_op.tcl:262 #, tcl-format msgid "Failed to update '%s'." msgstr "Не удалось обновить '%s'." -#: lib/checkout_op.tcl:273 +#: lib/checkout_op.tcl:274 msgid "Staging area (index) is already locked." msgstr "Рабочая область заблокирована другим процессом." -#: lib/checkout_op.tcl:288 +#: lib/checkout_op.tcl:289 msgid "" "Last scanned state does not match repository state.\n" "\n" @@ -914,30 +948,30 @@ msgstr "" "\n" "Это будет сделано сейчас автоматически.\n" -#: lib/checkout_op.tcl:344 +#: lib/checkout_op.tcl:345 #, tcl-format msgid "Updating working directory to '%s'..." msgstr "Обновление рабочего каталога из '%s'..." -#: lib/checkout_op.tcl:345 +#: lib/checkout_op.tcl:346 msgid "files checked out" msgstr "файлы извлечены" -#: lib/checkout_op.tcl:375 +#: lib/checkout_op.tcl:376 #, tcl-format msgid "Aborted checkout of '%s' (file level merging is required)." msgstr "Прерван переход на '%s' (требуется слияние содержания файлов)" -#: lib/checkout_op.tcl:376 +#: lib/checkout_op.tcl:377 msgid "File level merge required." msgstr "Требуется слияние содержания файлов." -#: lib/checkout_op.tcl:380 +#: lib/checkout_op.tcl:381 #, tcl-format msgid "Staying on branch '%s'." msgstr "Ветвь '%s' остается текущей." -#: lib/checkout_op.tcl:451 +#: lib/checkout_op.tcl:452 msgid "" "You are no longer on a local branch.\n" "\n" @@ -949,30 +983,30 @@ msgstr "" "Если вы хотите снова вернуться к какой-нибудь ветви, создайте ее сейчас, " "начиная с 'Текущего отсоединенного состояния'." -#: lib/checkout_op.tcl:468 lib/checkout_op.tcl:472 +#: lib/checkout_op.tcl:503 lib/checkout_op.tcl:507 #, tcl-format msgid "Checked out '%s'." msgstr "Ветвь '%s' сделана текущей." -#: lib/checkout_op.tcl:500 +#: lib/checkout_op.tcl:535 #, tcl-format msgid "Resetting '%s' to '%s' will lose the following commits:" msgstr "Сброс '%s' в '%s' приведет к потере следующих сохраненных состояний: " -#: lib/checkout_op.tcl:522 +#: lib/checkout_op.tcl:557 msgid "Recovering lost commits may not be easy." msgstr "Восстановить потерянные сохраненные состояния будет сложно." -#: lib/checkout_op.tcl:527 +#: lib/checkout_op.tcl:562 #, tcl-format msgid "Reset '%s'?" msgstr "Сбросить '%s'?" -#: lib/checkout_op.tcl:532 lib/merge.tcl:164 lib/tools_dlg.tcl:343 +#: lib/checkout_op.tcl:567 lib/merge.tcl:164 lib/tools_dlg.tcl:343 msgid "Visualize" msgstr "Наглядно" -#: lib/checkout_op.tcl:600 +#: lib/checkout_op.tcl:635 #, tcl-format msgid "" "Failed to set current branch.\n" @@ -1017,7 +1051,7 @@ msgstr "" msgid "Git Gui" msgstr "Git Gui" -#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:382 +#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:386 msgid "Create New Repository" msgstr "Создать новый репозиторий" @@ -1025,7 +1059,7 @@ msgstr "Создать новый репозиторий" msgid "New..." msgstr "Новый..." -#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:465 +#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:471 msgid "Clone Existing Repository" msgstr "Склонировать существующий репозиторий" @@ -1033,7 +1067,7 @@ msgstr "Склонировать существующий репозиторий msgid "Clone..." msgstr "Склонировать..." -#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:983 +#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:1016 msgid "Open Existing Repository" msgstr "Выбрать существующий репозиторий" @@ -1049,194 +1083,194 @@ msgstr "Недавние репозитории" msgid "Open Recent Repository:" msgstr "Открыть последний репозиторий" -#: lib/choose_repository.tcl:302 lib/choose_repository.tcl:309 -#: lib/choose_repository.tcl:316 +#: lib/choose_repository.tcl:306 lib/choose_repository.tcl:313 +#: lib/choose_repository.tcl:320 #, tcl-format msgid "Failed to create repository %s:" msgstr "Не удалось создать репозиторий %s:" -#: lib/choose_repository.tcl:387 +#: lib/choose_repository.tcl:391 msgid "Directory:" msgstr "Каталог:" -#: lib/choose_repository.tcl:417 lib/choose_repository.tcl:544 -#: lib/choose_repository.tcl:1017 +#: lib/choose_repository.tcl:423 lib/choose_repository.tcl:550 +#: lib/choose_repository.tcl:1052 msgid "Git Repository" msgstr "Репозиторий" -#: lib/choose_repository.tcl:442 +#: lib/choose_repository.tcl:448 #, tcl-format msgid "Directory %s already exists." msgstr "Каталог '%s' уже существует." -#: lib/choose_repository.tcl:446 +#: lib/choose_repository.tcl:452 #, tcl-format msgid "File %s already exists." msgstr "Файл '%s' уже существует." -#: lib/choose_repository.tcl:460 +#: lib/choose_repository.tcl:466 msgid "Clone" msgstr "Склонировать" -#: lib/choose_repository.tcl:473 +#: lib/choose_repository.tcl:479 msgid "Source Location:" msgstr "Исходное положение:" -#: lib/choose_repository.tcl:484 +#: lib/choose_repository.tcl:490 msgid "Target Directory:" msgstr "Каталог назначения:" -#: lib/choose_repository.tcl:496 +#: lib/choose_repository.tcl:502 msgid "Clone Type:" msgstr "Тип клона:" -#: lib/choose_repository.tcl:502 +#: lib/choose_repository.tcl:508 msgid "Standard (Fast, Semi-Redundant, Hardlinks)" msgstr "Стандартный (Быстрый, полуизбыточный, \"жесткие\" ссылки)" -#: lib/choose_repository.tcl:508 +#: lib/choose_repository.tcl:514 msgid "Full Copy (Slower, Redundant Backup)" msgstr "Полная копия (Медленный, создает резервную копию)" -#: lib/choose_repository.tcl:514 +#: lib/choose_repository.tcl:520 msgid "Shared (Fastest, Not Recommended, No Backup)" msgstr "Общий (Самый быстрый, не рекомендуется, без резервной копии)" -#: lib/choose_repository.tcl:550 lib/choose_repository.tcl:597 -#: lib/choose_repository.tcl:743 lib/choose_repository.tcl:813 -#: lib/choose_repository.tcl:1023 lib/choose_repository.tcl:1031 +#: lib/choose_repository.tcl:556 lib/choose_repository.tcl:603 +#: lib/choose_repository.tcl:749 lib/choose_repository.tcl:819 +#: lib/choose_repository.tcl:1058 lib/choose_repository.tcl:1066 #, tcl-format msgid "Not a Git repository: %s" msgstr "Каталог не является репозиторием: %s" -#: lib/choose_repository.tcl:586 +#: lib/choose_repository.tcl:592 msgid "Standard only available for local repository." msgstr "Стандартный клон возможен только для локального репозитория." -#: lib/choose_repository.tcl:590 +#: lib/choose_repository.tcl:596 msgid "Shared only available for local repository." msgstr "Общий клон возможен только для локального репозитория." -#: lib/choose_repository.tcl:611 +#: lib/choose_repository.tcl:617 #, tcl-format msgid "Location %s already exists." msgstr "Путь '%s' уже существует." -#: lib/choose_repository.tcl:622 +#: lib/choose_repository.tcl:628 msgid "Failed to configure origin" msgstr "Не могу сконфигурировать исходный репозиторий." -#: lib/choose_repository.tcl:634 +#: lib/choose_repository.tcl:640 msgid "Counting objects" msgstr "Считаю объекты" -#: lib/choose_repository.tcl:635 +#: lib/choose_repository.tcl:641 msgid "buckets" msgstr "" -#: lib/choose_repository.tcl:659 +#: lib/choose_repository.tcl:665 #, tcl-format msgid "Unable to copy objects/info/alternates: %s" msgstr "Не могу скопировать objects/info/alternates: %s" -#: lib/choose_repository.tcl:695 +#: lib/choose_repository.tcl:701 #, tcl-format msgid "Nothing to clone from %s." msgstr "Нечего клонировать с %s." -#: lib/choose_repository.tcl:697 lib/choose_repository.tcl:911 -#: lib/choose_repository.tcl:923 +#: lib/choose_repository.tcl:703 lib/choose_repository.tcl:917 +#: lib/choose_repository.tcl:929 msgid "The 'master' branch has not been initialized." msgstr "Не инициализирована ветвь 'master'." -#: lib/choose_repository.tcl:710 +#: lib/choose_repository.tcl:716 msgid "Hardlinks are unavailable. Falling back to copying." msgstr "\"Жесткие ссылки\" недоступны. Будет использовано копирование." -#: lib/choose_repository.tcl:722 +#: lib/choose_repository.tcl:728 #, tcl-format msgid "Cloning from %s" msgstr "Клонирование %s" -#: lib/choose_repository.tcl:753 +#: lib/choose_repository.tcl:759 msgid "Copying objects" msgstr "Копирование objects" -#: lib/choose_repository.tcl:754 +#: lib/choose_repository.tcl:760 msgid "KiB" msgstr "КБ" -#: lib/choose_repository.tcl:778 +#: lib/choose_repository.tcl:784 #, tcl-format msgid "Unable to copy object: %s" msgstr "Не могу скопировать объект: %s" -#: lib/choose_repository.tcl:788 +#: lib/choose_repository.tcl:794 msgid "Linking objects" msgstr "Создание ссылок на objects" -#: lib/choose_repository.tcl:789 +#: lib/choose_repository.tcl:795 msgid "objects" msgstr "объекты" -#: lib/choose_repository.tcl:797 +#: lib/choose_repository.tcl:803 #, tcl-format msgid "Unable to hardlink object: %s" msgstr "Не могу \"жестко связать\" объект: %s" -#: lib/choose_repository.tcl:852 +#: lib/choose_repository.tcl:858 msgid "Cannot fetch branches and objects. See console output for details." msgstr "" "Не могу получить ветви и объекты. Дополнительная информация на консоли." -#: lib/choose_repository.tcl:863 +#: lib/choose_repository.tcl:869 msgid "Cannot fetch tags. See console output for details." msgstr "Не могу получить метки. Дополнительная информация на консоли." -#: lib/choose_repository.tcl:887 +#: lib/choose_repository.tcl:893 msgid "Cannot determine HEAD. See console output for details." msgstr "Не могу определить HEAD. Дополнительная информация на консоли." -#: lib/choose_repository.tcl:896 +#: lib/choose_repository.tcl:902 #, tcl-format msgid "Unable to cleanup %s" msgstr "Не могу очистить %s" -#: lib/choose_repository.tcl:902 +#: lib/choose_repository.tcl:908 msgid "Clone failed." msgstr "Клонирование не удалось." -#: lib/choose_repository.tcl:909 +#: lib/choose_repository.tcl:915 msgid "No default branch obtained." msgstr "Не было получено ветви по умолчанию." -#: lib/choose_repository.tcl:920 +#: lib/choose_repository.tcl:926 #, tcl-format msgid "Cannot resolve %s as a commit." msgstr "Не могу распознать %s как состояние." -#: lib/choose_repository.tcl:932 +#: lib/choose_repository.tcl:938 msgid "Creating working directory" msgstr "Создаю рабочий каталог" -#: lib/choose_repository.tcl:933 lib/index.tcl:65 lib/index.tcl:128 -#: lib/index.tcl:196 +#: lib/choose_repository.tcl:939 lib/index.tcl:67 lib/index.tcl:130 +#: lib/index.tcl:198 msgid "files" msgstr "файлов" -#: lib/choose_repository.tcl:962 +#: lib/choose_repository.tcl:968 msgid "Initial file checkout failed." msgstr "Не удалось получить начальное состояние файлов репозитория." -#: lib/choose_repository.tcl:978 +#: lib/choose_repository.tcl:1011 msgid "Open" msgstr "Открыть" -#: lib/choose_repository.tcl:988 +#: lib/choose_repository.tcl:1021 msgid "Repository:" msgstr "Репозиторий:" -#: lib/choose_repository.tcl:1037 +#: lib/choose_repository.tcl:1072 #, tcl-format msgid "Failed to open repository %s:" msgstr "Не удалось открыть репозиторий %s:" @@ -1318,7 +1352,12 @@ msgstr "Невозможно получить информацию об авто msgid "Invalid GIT_COMMITTER_IDENT:" msgstr "Неверный GIT_COMMITTER_IDENT:" -#: lib/commit.tcl:132 +#: lib/commit.tcl:129 +#, tcl-format +msgid "warning: Tcl does not support encoding '%s'." +msgstr "предупреждение: Tcl не поддерживает кодировку '%s'." + +#: lib/commit.tcl:149 msgid "" "Last scanned state does not match repository state.\n" "\n" @@ -1334,7 +1373,7 @@ msgstr "" "\n" "Это будет сделано сейчас автоматически.\n" -#: lib/commit.tcl:155 +#: lib/commit.tcl:172 #, tcl-format msgid "" "Unmerged files cannot be committed.\n" @@ -1347,7 +1386,7 @@ msgstr "" "Для файла %s возник конфликт слияния. Разрешите конфликт и добавьте к " "подготовленным файлам перед сохранением.\n" -#: lib/commit.tcl:163 +#: lib/commit.tcl:180 #, tcl-format msgid "" "Unknown file state %s detected.\n" @@ -1358,7 +1397,7 @@ msgstr "" "\n" "Файл %s не может быть сохранен данной программой.\n" -#: lib/commit.tcl:171 +#: lib/commit.tcl:188 msgid "" "No changes to commit.\n" "\n" @@ -1368,7 +1407,7 @@ msgstr "" "\n" "Подготовьте хотя бы один файл до создания сохраненного состояния.\n" -#: lib/commit.tcl:186 +#: lib/commit.tcl:203 msgid "" "Please supply a commit message.\n" "\n" @@ -1386,45 +1425,40 @@ msgstr "" "- вторая строка пустая\n" "- оставшиеся строки: опишите, что дают ваши изменения.\n" -#: lib/commit.tcl:210 -#, tcl-format -msgid "warning: Tcl does not support encoding '%s'." -msgstr "предупреждение: Tcl не поддерживает кодировку '%s'." - -#: lib/commit.tcl:226 +#: lib/commit.tcl:234 msgid "Calling pre-commit hook..." msgstr "Вызов программы поддержки репозитория pre-commit..." -#: lib/commit.tcl:241 +#: lib/commit.tcl:249 msgid "Commit declined by pre-commit hook." msgstr "Сохранение прервано программой поддержки репозитория pre-commit" -#: lib/commit.tcl:264 +#: lib/commit.tcl:272 msgid "Calling commit-msg hook..." msgstr "Вызов программы поддержки репозитория commit-msg..." -#: lib/commit.tcl:279 +#: lib/commit.tcl:287 msgid "Commit declined by commit-msg hook." msgstr "Сохранение прервано программой поддержки репозитория commit-msg" -#: lib/commit.tcl:292 +#: lib/commit.tcl:300 msgid "Committing changes..." msgstr "Сохранение изменений..." -#: lib/commit.tcl:308 +#: lib/commit.tcl:316 msgid "write-tree failed:" msgstr "Программа write-tree завершилась с ошибкой:" -#: lib/commit.tcl:309 lib/commit.tcl:353 lib/commit.tcl:373 +#: lib/commit.tcl:317 lib/commit.tcl:361 lib/commit.tcl:382 msgid "Commit failed." msgstr "Сохранить состояние не удалось." -#: lib/commit.tcl:326 +#: lib/commit.tcl:334 #, tcl-format msgid "Commit %s appears to be corrupt" msgstr "Состояние %s выглядит поврежденным" -#: lib/commit.tcl:331 +#: lib/commit.tcl:339 msgid "" "No changes to commit.\n" "\n" @@ -1438,19 +1472,19 @@ msgstr "" "\n" "Сейчас автоматически запустится перечитывание репозитория.\n" -#: lib/commit.tcl:338 +#: lib/commit.tcl:346 msgid "No changes to commit." msgstr "Отсутствуют изменения для сохранения." -#: lib/commit.tcl:352 +#: lib/commit.tcl:360 msgid "commit-tree failed:" msgstr "Программа commit-tree завершилась с ошибкой:" -#: lib/commit.tcl:372 +#: lib/commit.tcl:381 msgid "update-ref failed:" msgstr "Программа update-ref завершилась с ошибкой:" -#: lib/commit.tcl:460 +#: lib/commit.tcl:469 #, tcl-format msgid "Created commit %s: %s" msgstr "Создано состояние %s: %s " @@ -1503,20 +1537,19 @@ msgstr "Сжатие базы объектов" msgid "Verifying the object database with fsck-objects" msgstr "Проверка базы объектов при помощи fsck" -#: lib/database.tcl:108 +#: lib/database.tcl:107 #, tcl-format msgid "" "This repository currently has approximately %i loose objects.\n" "\n" "To maintain optimal performance it is strongly recommended that you compress " -"the database when more than %i loose objects exist.\n" +"the database.\n" "\n" "Compress the database now?" msgstr "" "Этот репозиторий сейчас содержит примерно %i свободных объектов\n" "\n" -"Для лучшей производительности рекомендуется сжать базу данных, когда есть " -"более %i несвязанных объектов.\n" +"Для лучшей производительности рекомендуется сжать базу данных.\n" "\n" "Сжать базу данных сейчас?" @@ -1525,7 +1558,7 @@ msgstr "" msgid "Invalid date from Git: %s" msgstr "Неправильная дата в репозитории: %s" -#: lib/diff.tcl:59 +#: lib/diff.tcl:64 #, tcl-format msgid "" "No differences detected.\n" @@ -1547,12 +1580,12 @@ msgstr "" "\n" "Сейчас будет запущено перечитывание репозитория, чтобы найти подобные файлы." -#: lib/diff.tcl:99 +#: lib/diff.tcl:104 #, tcl-format msgid "Loading diff of %s..." msgstr "Загрузка изменений в %s..." -#: lib/diff.tcl:120 +#: lib/diff.tcl:125 msgid "" "LOCAL: deleted\n" "REMOTE:\n" @@ -1560,7 +1593,7 @@ msgstr "" "ЛОКАЛЬНО: удалён\n" "ВНЕШНИЙ:\n" -#: lib/diff.tcl:125 +#: lib/diff.tcl:130 msgid "" "REMOTE: deleted\n" "LOCAL:\n" @@ -1568,32 +1601,32 @@ msgstr "" "ВНЕШНИЙ: удалён\n" "ЛОКАЛЬНО:\n" -#: lib/diff.tcl:132 +#: lib/diff.tcl:137 msgid "LOCAL:\n" msgstr "ЛОКАЛЬНО:\n" -#: lib/diff.tcl:135 +#: lib/diff.tcl:140 msgid "REMOTE:\n" msgstr "ВНЕШНИЙ:\n" -#: lib/diff.tcl:197 lib/diff.tcl:296 +#: lib/diff.tcl:202 lib/diff.tcl:319 #, tcl-format msgid "Unable to display %s" msgstr "Не могу показать %s" -#: lib/diff.tcl:198 +#: lib/diff.tcl:203 msgid "Error loading file:" msgstr "Ошибка загрузки файла:" -#: lib/diff.tcl:205 +#: lib/diff.tcl:210 msgid "Git Repository (subproject)" msgstr "Репозиторий Git (подпроект)" -#: lib/diff.tcl:217 +#: lib/diff.tcl:222 msgid "* Binary file (not showing content)." msgstr "* Двоичный файл (содержимое не показано)" -#: lib/diff.tcl:222 +#: lib/diff.tcl:227 #, tcl-format msgid "" "* Untracked file is %d bytes.\n" @@ -1602,7 +1635,7 @@ msgstr "" "* Размер неподготовленного файла %d байт.\n" "* Показано первых %d байт.\n" -#: lib/diff.tcl:228 +#: lib/diff.tcl:233 #, tcl-format msgid "" "\n" @@ -1613,19 +1646,19 @@ msgstr "" "* Неподготовленный файл обрезан: %s.\n" "* Чтобы увидеть весь файл, используйте программу-редактор.\n" -#: lib/diff.tcl:436 +#: lib/diff.tcl:482 msgid "Failed to unstage selected hunk." msgstr "Не удалось исключить выбранную часть." -#: lib/diff.tcl:443 +#: lib/diff.tcl:489 msgid "Failed to stage selected hunk." msgstr "Не удалось подготовить к сохранению выбранную часть." -#: lib/diff.tcl:509 +#: lib/diff.tcl:568 msgid "Failed to unstage selected line." msgstr "Не удалось исключить выбранную строку." -#: lib/diff.tcl:517 +#: lib/diff.tcl:576 msgid "Failed to stage selected line." msgstr "Не удалось подготовить к сохранению выбранную строку." @@ -1662,7 +1695,7 @@ msgstr "Не удалось разблокировать индекс" msgid "Index Error" msgstr "Ошибка в индексе" -#: lib/index.tcl:21 +#: lib/index.tcl:17 msgid "" "Updating the Git index failed. A rescan will be automatically started to " "resynchronize git-gui." @@ -1670,7 +1703,7 @@ msgstr "" "Не удалось обновить индекс Git. Состояние репозитория будет перечитано " "автоматически." -#: lib/index.tcl:27 +#: lib/index.tcl:28 msgid "Continue" msgstr "Продолжить" @@ -1678,45 +1711,45 @@ msgstr "Продолжить" msgid "Unlock Index" msgstr "Разблокировать индекс" -#: lib/index.tcl:287 +#: lib/index.tcl:289 #, tcl-format msgid "Unstaging %s from commit" msgstr "Удаление %s из подготовленного" -#: lib/index.tcl:326 +#: lib/index.tcl:328 msgid "Ready to commit." msgstr "Подготовлено для сохранения" -#: lib/index.tcl:339 +#: lib/index.tcl:341 #, tcl-format msgid "Adding %s" msgstr "Добавление %s..." -#: lib/index.tcl:396 +#: lib/index.tcl:398 #, tcl-format msgid "Revert changes in file %s?" msgstr "Отменить изменения в файле %s?" -#: lib/index.tcl:398 +#: lib/index.tcl:400 #, tcl-format msgid "Revert changes in these %i files?" msgstr "Отменить изменения в %i файле(-ах)?" -#: lib/index.tcl:406 +#: lib/index.tcl:408 msgid "Any unstaged changes will be permanently lost by the revert." msgstr "" "Любые изменения, не подготовленные к сохранению, будут потеряны при данной " "операции." -#: lib/index.tcl:409 +#: lib/index.tcl:411 msgid "Do Nothing" msgstr "Ничего не делать" -#: lib/index.tcl:427 +#: lib/index.tcl:429 msgid "Reverting selected files" msgstr "Удаление изменений в выбранных файлах" -#: lib/index.tcl:431 +#: lib/index.tcl:433 #, tcl-format msgid "Reverting %s" msgstr "Отмена изменений в %s" @@ -2193,10 +2226,6 @@ msgstr "Удалить только в случае, если" msgid "Merged Into:" msgstr "Слияние с:" -#: lib/remote_branch_delete.tcl:119 -msgid "Always (Do not perform merge checks)" -msgstr "Всегда (не выполнять проверку на слияние)" - #: lib/remote_branch_delete.tcl:152 msgid "A branch is required for 'Merged Into'." msgstr "Для опции 'Слияние с' требуется указать ветвь." @@ -2225,26 +2254,16 @@ msgstr "" msgid "Please select one or more branches to delete." msgstr "Укажите одну или несколько ветвей для удаления." -#: lib/remote_branch_delete.tcl:216 -msgid "" -"Recovering deleted branches is difficult.\n" -"\n" -"Delete the selected branches?" -msgstr "" -"Восстановить удаленные ветви сложно.\n" -"\n" -"Продолжить?" - #: lib/remote_branch_delete.tcl:226 #, tcl-format msgid "Deleting branches from %s" msgstr "Удаление ветвей из %s" -#: lib/remote_branch_delete.tcl:286 +#: lib/remote_branch_delete.tcl:292 msgid "No repository selected." msgstr "Не указан репозиторий." -#: lib/remote_branch_delete.tcl:291 +#: lib/remote_branch_delete.tcl:297 #, tcl-format msgid "Scanning %s..." msgstr "Перечитывание %s... " @@ -2265,11 +2284,11 @@ msgstr "Обратно" msgid "Case-Sensitive" msgstr "Игн. большие/маленькие" -#: lib/shortcut.tcl:20 lib/shortcut.tcl:61 +#: lib/shortcut.tcl:21 lib/shortcut.tcl:62 msgid "Cannot write shortcut:" msgstr "Невозможно записать ссылку:" -#: lib/shortcut.tcl:136 +#: lib/shortcut.tcl:137 msgid "Cannot write icon:" msgstr "Невозможно записать значок:" -- cgit v0.10.2-6-g49f6 From 073291c476b4edb4d10bbada1e64b471ba153b6b Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 19 Jan 2011 22:01:32 +0100 Subject: git-gui: update russian translation Improve the translation of warning given by mergetool when staging files with conflict markers. Suggested-by: Alexey Shumkin Tipping-vote-by: Dmitry Potapov Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts diff --git a/po/ru.po b/po/ru.po index 7071a8c..30f4b77 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1926,7 +1926,7 @@ msgstr "" #, tcl-format msgid "File %s seems to have unresolved conflicts, still stage?" msgstr "" -"Файл %s кажется содержит необработанные конфликты. Продолжить подготовку к " +"Файл %s, похоже, содержит необработанные конфликты. Продолжить подготовку к " "сохранению?" #: lib/mergetool.tcl:60 -- cgit v0.10.2-6-g49f6 From 7b3680f162bf27c119e6e0347ee87a9aa7a3ce1b Mon Sep 17 00:00:00 2001 From: Alexandre Erwin Ittner Date: Mon, 13 Dec 2010 20:28:19 -0200 Subject: git-gui: add Brazilian Portuguese (pt-BR) translation Translating a SCM is tricky due to amount of jargon, so, I tried to keep the wording consistent with both the German and Italian git translations and the pt-BR translation of other SCMs. Signed-off-by: Alexandre Erwin Ittner diff --git a/po/glossary/pt_br.po b/po/glossary/pt_br.po new file mode 100644 index 0000000..eb039b2 --- /dev/null +++ b/po/glossary/pt_br.po @@ -0,0 +1,169 @@ +# Translation of git-gui to Brazilian Portuguese +# Copyright (C) 2007 Shawn Pearce, et al. +# This file is distributed under the same license as the git-gui package. +# +# Alexandre Erwin Ittner , 2010. +msgid "" +msgstr "" +"Project-Id-Version: git-gui\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-01-26 15:47-0800\n" +"PO-Revision-Date: 2010-09-18 11:09-0300\n" +"Last-Translator: Alexandre Erwin Ittner \n" +"Language-Team: Brazilian Portuguese <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. "English Definition (Dear translator: This file will never be visible to the user! It should only serve as a tool for you, the translator. Nothing more.)" +msgid "" +"English Term (Dear translator: This file will never be visible to the user!)" +msgstr "" + +#. "" +msgid "amend" +msgstr "corrigir" + +#. "" +msgid "annotate" +msgstr "anotar" + +#. "A 'branch' is an active line of development." +msgid "branch [noun]" +msgstr "ramo" + +#. "" +msgid "branch [verb]" +msgstr "ramificar" + +#. "" +msgid "checkout [noun]" +msgstr "checkout" + +#. "The action of updating the working tree to a revision which was stored in the object database." +msgid "checkout [verb]" +msgstr "efetuar checkout" + +#. "" +msgid "clone [verb]" +msgstr "clonar" + +#. "A single point in the git history." +msgid "commit [noun]" +msgstr "revisão" + +#. "The action of storing a new snapshot of the project's state in the git history." +msgid "commit [verb]" +msgstr "salvar revisão" + +#. "" +msgid "diff [noun]" +msgstr "diff" + +#. "" +msgid "diff [verb]" +msgstr "comparar" + +#. "A fast-forward is a special type of merge where you have a revision and you are merging another branch's changes that happen to be a descendant of what you have." +msgid "fast forward merge" +msgstr "mesclagem rápida" + +#. "Fetching a branch means to get the branch's head from a remote repository, to find out which objects are missing from the local object database, and to get them, too." +msgid "fetch" +msgstr "receber" + +#. "One context of consecutive lines in a whole patch, which consists of many such hunks" +msgid "hunk" +msgstr "trecho" + +#. "A collection of files. The index is a stored version of your working tree." +msgid "index (in git-gui: staging area)" +msgstr "índice" + +#. "A successful merge results in the creation of a new commit representing the result of the merge." +msgid "merge [noun]" +msgstr "mesclagem" + +#. "To bring the contents of another branch into the current branch." +msgid "merge [verb]" +msgstr "mesclar" + +#. "" +msgid "message" +msgstr "descrição da revisão" + +#. "Deletes all stale tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in 'remotes/'." +msgid "prune" +msgstr "limpar" + +#. "Pulling a branch means to fetch it and merge it." +msgid "pull" +msgstr "receber e mesclar" + +#. "Pushing a branch means to get the branch's head ref from a remote repository, and ... (well, can someone please explain it for mere mortals?)" +msgid "push" +msgstr "enviar" + +#. "" +msgid "redo" +msgstr "refazer" + +#. "An other repository ('remote'). One might have a set of remotes whose branches one tracks." +msgid "remote" +msgstr "repositório remoto" + +#. "A collection of refs (?) together with an object database containing all objects which are reachable from the refs... (oops, you've lost me here. Again, please an explanation for mere mortals?)" +msgid "repository" +msgstr "repositório" + +#. "" +msgid "reset" +msgstr "descartar, redefinir" + +#. "" +msgid "revert" +msgstr "reverter" + +#. "A particular state of files and directories which was stored in the object database." +msgid "revision" +msgstr "revisão" + +#. "" +msgid "sign off" +msgstr "assinar embaixo" + +#. "" +msgid "staging area" +msgstr "???" + +#. "" +msgid "status" +msgstr "status" + +#. "A ref pointing to a tag or commit object" +msgid "tag [noun]" +msgstr "etiqueta" + +#. "" +msgid "tag [verb]" +msgstr "marcar etiqueta" + +#. "A regular git branch that is used to follow changes from another repository." +msgid "tracking branch" +msgstr "ramo de rastreamento" + +#. "" +msgid "undo" +msgstr "desfazer" + +#. "" +msgid "update" +msgstr "atualizar" + +#. "" +msgid "verify" +msgstr "verificar" + +#. "The tree of actual checked out files." +msgid "working copy, working tree" +msgstr "cópia de trabalho, árvore de trabalho" diff --git a/po/pt_br.po b/po/pt_br.po new file mode 100644 index 0000000..b175b97 --- /dev/null +++ b/po/pt_br.po @@ -0,0 +1,2568 @@ +# Translation of git-gui to Brazilian Portuguese +# Copyright (C) 2007 Shawn Pearce, et al. +# This file is distributed under the same license as the git-gui package. +# +# Alexandre Erwin Ittner , 2010. +msgid "" +msgstr "" +"Project-Id-Version: git-gui\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-01-26 15:47-0800\n" +"PO-Revision-Date: 2010-09-18 11:09-0300\n" +"Last-Translator: Alexandre Erwin Ittner \n" +"Language-Team: Brazilian Portuguese <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: git-gui.sh:41 git-gui.sh:793 git-gui.sh:807 git-gui.sh:820 git-gui.sh:903 +#: git-gui.sh:922 +msgid "git-gui: fatal error" +msgstr "git-gui: erro fatal" + +#: git-gui.sh:743 +#, tcl-format +msgid "Invalid font specified in %s:" +msgstr "Fonte inválida indicada em %s:" + +#: git-gui.sh:779 +msgid "Main Font" +msgstr "Fonte principal" + +#: git-gui.sh:780 +msgid "Diff/Console Font" +msgstr "Fonte para o diff/console" + +#: git-gui.sh:794 +msgid "Cannot find git in PATH." +msgstr "Impossível encontrar o git no \"PATH\"" + +#: git-gui.sh:821 +msgid "Cannot parse Git version string:" +msgstr "Impossível interpretar a versão do git:" + +#: git-gui.sh:839 +#, tcl-format +msgid "" +"Git version cannot be determined.\n" +"\n" +"%s claims it is version '%s'.\n" +"\n" +"%s requires at least Git 1.5.0 or later.\n" +"\n" +"Assume '%s' is version 1.5.0?\n" +msgstr "" +"Não foi possível determinar a versão do git:\n" +"\n" +"%s afirmar que sua versão é \"%s\".\n" +"\n" +"%s exige o Git 1.5.0 ou posterior.\n" +"\n" +"Assumir que '%s' é a versão 1.5.0?\n" + +#: git-gui.sh:1128 +msgid "Git directory not found:" +msgstr "Diretório do Git não encontrado:" + +#: git-gui.sh:1146 +msgid "Cannot move to top of working directory:" +msgstr "Impossível mover para o início do diretório de trabalho:" + +#: git-gui.sh:1154 +msgid "Cannot use bare repository:" +msgstr "Impossível usar repositório puro:" + +#: git-gui.sh:1162 +msgid "No working directory" +msgstr "Sem diretório de trabalho" + +#: git-gui.sh:1334 lib/checkout_op.tcl:306 +msgid "Refreshing file status..." +msgstr "Atualizando estado dos arquivos..." + +#: git-gui.sh:1390 +msgid "Scanning for modified files ..." +msgstr "Procurando por arquivos modificados ..." + +#: git-gui.sh:1454 +msgid "Calling prepare-commit-msg hook..." +msgstr "Executando hook \"prepare-commit-msg\"..." + +#: git-gui.sh:1471 +msgid "Commit declined by prepare-commit-msg hook." +msgstr "O script \"prepare-commit-msg\" negou a criação de uma nova revisão" + +#: git-gui.sh:1629 lib/browser.tcl:246 +msgid "Ready." +msgstr "Pronto." + +#: git-gui.sh:1787 +#, tcl-format +msgid "Displaying only %s of %s files." +msgstr "Exibindo apenas %s de %s arquivos." + +#: git-gui.sh:1913 +msgid "Unmodified" +msgstr "Não modificado" + +#: git-gui.sh:1915 +msgid "Modified, not staged" +msgstr "Modificado, não marcado" + +#: git-gui.sh:1916 git-gui.sh:1924 +msgid "Staged for commit" +msgstr "Marcado para uma nova revisão" + +#: git-gui.sh:1917 git-gui.sh:1925 +msgid "Portions staged for commit" +msgstr "Trechos marcados para revisão" + +#: git-gui.sh:1918 git-gui.sh:1926 +msgid "Staged for commit, missing" +msgstr "Marcado para revisão, faltando" + +#: git-gui.sh:1920 +msgid "File type changed, not staged" +msgstr "Tipo do arquivo modificado, não marcado" + +#: git-gui.sh:1921 +msgid "File type changed, staged" +msgstr "Tipo do arquivo modificado, marcado" + +#: git-gui.sh:1923 +msgid "Untracked, not staged" +msgstr "Não monitorado, não marcado" + +#: git-gui.sh:1928 +msgid "Missing" +msgstr "Faltando" + +#: git-gui.sh:1929 +msgid "Staged for removal" +msgstr "Marcado para remoção" + +#: git-gui.sh:1930 +msgid "Staged for removal, still present" +msgstr "Marcado para remoção, ainda presente" + +#: git-gui.sh:1932 git-gui.sh:1933 git-gui.sh:1934 git-gui.sh:1935 +#: git-gui.sh:1936 git-gui.sh:1937 +msgid "Requires merge resolution" +msgstr "Requer resolução de conflitos" + +#: git-gui.sh:1972 +msgid "Starting gitk... please wait..." +msgstr "Iniciando gitk... Aguarde..." + +#: git-gui.sh:1984 +msgid "Couldn't find gitk in PATH" +msgstr "Impossível encontrar o gitk no PATH" + +#: git-gui.sh:2043 +msgid "Couldn't find git gui in PATH" +msgstr "Impossível encontrar o \"git gui\" no PATH" + +#: git-gui.sh:2455 lib/choose_repository.tcl:36 +msgid "Repository" +msgstr "Repositório" + +#: git-gui.sh:2456 +msgid "Edit" +msgstr "Editar" + +#: git-gui.sh:2458 lib/choose_rev.tcl:561 +msgid "Branch" +msgstr "Ramo" + +#: git-gui.sh:2461 lib/choose_rev.tcl:548 +msgid "Commit@@noun" +msgstr "Revisão" + +#: git-gui.sh:2464 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168 +msgid "Merge" +msgstr "Mesclar" + +#: git-gui.sh:2465 lib/choose_rev.tcl:557 +msgid "Remote" +msgstr "Remoto" + +#: git-gui.sh:2468 +msgid "Tools" +msgstr "Ferramentas" + +#: git-gui.sh:2477 +msgid "Explore Working Copy" +msgstr "Explorar cópia de trabalho" + +#: git-gui.sh:2483 +msgid "Browse Current Branch's Files" +msgstr "Explorar arquivos do ramo atual" + +#: git-gui.sh:2487 +msgid "Browse Branch Files..." +msgstr "Explorar arquivos do ramo..." + +#: git-gui.sh:2492 +msgid "Visualize Current Branch's History" +msgstr "Visualizar histórico do ramo atual" + +#: git-gui.sh:2496 +msgid "Visualize All Branch History" +msgstr "Visualizar histórico de todos os ramos" + +#: git-gui.sh:2503 +#, tcl-format +msgid "Browse %s's Files" +msgstr "Explorar arquivos de %s" + +#: git-gui.sh:2505 +#, tcl-format +msgid "Visualize %s's History" +msgstr "Visualizar histórico de %s" + +#: git-gui.sh:2510 lib/database.tcl:27 lib/database.tcl:67 +msgid "Database Statistics" +msgstr "Estatísticas do banco de dados" + +#: git-gui.sh:2513 lib/database.tcl:34 +msgid "Compress Database" +msgstr "Compactar banco de dados" + +#: git-gui.sh:2516 +msgid "Verify Database" +msgstr "Verificar banco de dados" + +#: git-gui.sh:2523 git-gui.sh:2527 git-gui.sh:2531 lib/shortcut.tcl:8 +#: lib/shortcut.tcl:40 lib/shortcut.tcl:72 +msgid "Create Desktop Icon" +msgstr "Criar ícone na área de trabalho" + +#: git-gui.sh:2539 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191 +msgid "Quit" +msgstr "Sair" + +#: git-gui.sh:2547 +msgid "Undo" +msgstr "Desfazer" + +#: git-gui.sh:2550 +msgid "Redo" +msgstr "Refazer" + +#: git-gui.sh:2554 git-gui.sh:3109 +msgid "Cut" +msgstr "Recortar" + +#: git-gui.sh:2557 git-gui.sh:3112 git-gui.sh:3186 git-gui.sh:3259 +#: lib/console.tcl:69 +msgid "Copy" +msgstr "Copiar" + +#: git-gui.sh:2560 git-gui.sh:3115 +msgid "Paste" +msgstr "Colar" + +#: git-gui.sh:2563 git-gui.sh:3118 lib/branch_delete.tcl:26 +#: lib/remote_branch_delete.tcl:38 +msgid "Delete" +msgstr "Apagar" + +#: git-gui.sh:2567 git-gui.sh:3122 git-gui.sh:3263 lib/console.tcl:71 +msgid "Select All" +msgstr "Selecionar tudo" + +#: git-gui.sh:2576 +msgid "Create..." +msgstr "Criar..." + +#: git-gui.sh:2582 +msgid "Checkout..." +msgstr "Checkout..." + +#: git-gui.sh:2588 +msgid "Rename..." +msgstr "Renomear..." + +#: git-gui.sh:2593 +msgid "Delete..." +msgstr "Apagar..." + +#: git-gui.sh:2598 +msgid "Reset..." +msgstr "Redefinir..." + +#: git-gui.sh:2608 +msgid "Done" +msgstr "Pronto" + +#: git-gui.sh:2610 +msgid "Commit@@verb" +msgstr "Salvar revisão" + +#: git-gui.sh:2619 git-gui.sh:3050 +msgid "New Commit" +msgstr "Nova revisão" + +#: git-gui.sh:2627 git-gui.sh:3057 +msgid "Amend Last Commit" +msgstr "Corrigir última revisão" + +#: git-gui.sh:2637 git-gui.sh:3011 lib/remote_branch_delete.tcl:99 +msgid "Rescan" +msgstr "Atualizar" + +#: git-gui.sh:2643 +msgid "Stage To Commit" +msgstr "Marcar para revisão" + +#: git-gui.sh:2649 +msgid "Stage Changed Files To Commit" +msgstr "Marcar arquivos modificados" + +#: git-gui.sh:2655 +msgid "Unstage From Commit" +msgstr "Desmarcar" + +#: git-gui.sh:2661 lib/index.tcl:412 +msgid "Revert Changes" +msgstr "Reverter mudanças" + +#: git-gui.sh:2669 git-gui.sh:3310 git-gui.sh:3341 +msgid "Show Less Context" +msgstr "Mostrar menos contexto" + +#: git-gui.sh:2673 git-gui.sh:3314 git-gui.sh:3345 +msgid "Show More Context" +msgstr "Mostrar mais contexto" + +#: git-gui.sh:2680 git-gui.sh:3024 git-gui.sh:3133 +msgid "Sign Off" +msgstr "Assinar embaixo" + +#: git-gui.sh:2696 +msgid "Local Merge..." +msgstr "Mesclar localmente..." + +#: git-gui.sh:2701 +msgid "Abort Merge..." +msgstr "Abortar mesclagem..." + +#: git-gui.sh:2713 git-gui.sh:2741 +msgid "Add..." +msgstr "Adicionar..." + +#: git-gui.sh:2717 +msgid "Push..." +msgstr "Enviar..." + +#: git-gui.sh:2721 +msgid "Delete Branch..." +msgstr "Apagar ramo..." + +#: git-gui.sh:2731 git-gui.sh:3292 +msgid "Options..." +msgstr "Opções..." + +#: git-gui.sh:2742 +msgid "Remove..." +msgstr "Remover..." + +#: git-gui.sh:2751 lib/choose_repository.tcl:50 +msgid "Help" +msgstr "Ajuda" + +#: git-gui.sh:2755 git-gui.sh:2759 lib/about.tcl:14 +#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53 +#, tcl-format +msgid "About %s" +msgstr "Sobre o %s" + +#: git-gui.sh:2783 +msgid "Online Documentation" +msgstr "Ajuda online" + +#: git-gui.sh:2786 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56 +msgid "Show SSH Key" +msgstr "Mostrar chave SSH" + +#: git-gui.sh:2893 +#, tcl-format +msgid "fatal: cannot stat path %s: No such file or directory" +msgstr "" +"erro fatal: impossível executar \"stat\" em %s: Arquivo ou diretório não " +"encontrado" + +#: git-gui.sh:2926 +msgid "Current Branch:" +msgstr "Ramo atual:" + +#: git-gui.sh:2947 +msgid "Staged Changes (Will Commit)" +msgstr "Mudanças marcadas" + +#: git-gui.sh:2967 +msgid "Unstaged Changes" +msgstr "Mudanças não marcadas" + +#: git-gui.sh:3017 +msgid "Stage Changed" +msgstr "Marcar alterados" + +#: git-gui.sh:3036 lib/transport.tcl:104 lib/transport.tcl:193 +msgid "Push" +msgstr "Enviar" + +#: git-gui.sh:3071 +msgid "Initial Commit Message:" +msgstr "Descrição da revisão inicial:" + +#: git-gui.sh:3072 +msgid "Amended Commit Message:" +msgstr "Descrição da revisão corrigida:" + +#: git-gui.sh:3073 +msgid "Amended Initial Commit Message:" +msgstr "Descrição da revisão inicial corrigida:" + +#: git-gui.sh:3074 +msgid "Amended Merge Commit Message:" +msgstr "Descrição da revisão de mescla corrigida:" + +#: git-gui.sh:3075 +msgid "Merge Commit Message:" +msgstr "Descrição da revisão de mescla:" + +#: git-gui.sh:3076 +msgid "Commit Message:" +msgstr "Descrição da revisão:" + +#: git-gui.sh:3125 git-gui.sh:3267 lib/console.tcl:73 +msgid "Copy All" +msgstr "Copiar todos" + +#: git-gui.sh:3149 lib/blame.tcl:104 +msgid "File:" +msgstr "Arquivo:" + +#: git-gui.sh:3255 +msgid "Refresh" +msgstr "Atualizar" + +#: git-gui.sh:3276 +msgid "Decrease Font Size" +msgstr "Reduzir tamanho da fonte" + +#: git-gui.sh:3280 +msgid "Increase Font Size" +msgstr "Aumentar tamanho da fonte" + +#: git-gui.sh:3288 lib/blame.tcl:281 +msgid "Encoding" +msgstr "Codificação" + +#: git-gui.sh:3299 +msgid "Apply/Reverse Hunk" +msgstr "Aplicar/reverter trecho" + +#: git-gui.sh:3304 +msgid "Apply/Reverse Line" +msgstr "Aplicar/reverter linha" + +#: git-gui.sh:3323 +msgid "Run Merge Tool" +msgstr "Executar ferramenta de mescla" + +#: git-gui.sh:3328 +msgid "Use Remote Version" +msgstr "Usar versão remota" + +#: git-gui.sh:3332 +msgid "Use Local Version" +msgstr "Usar versão local" + +#: git-gui.sh:3336 +msgid "Revert To Base" +msgstr "Reverter para a versão-base" + +#: git-gui.sh:3354 +msgid "Visualize These Changes In The Submodule" +msgstr "Visualizar estas mudanças no sub-módulo" + +#: git-gui.sh:3358 +msgid "Visualize Current Branch History In The Submodule" +msgstr "Visualizar histórico do ramo atual no sub-módulo" + +#: git-gui.sh:3362 +msgid "Visualize All Branch History In The Submodule" +msgstr "Visualizar histórico de todos os camos no sub-módulo" + +#: git-gui.sh:3367 +msgid "Start git gui In The Submodule" +msgstr "Iniciar \"git gui\" no sub-módulo" + +#: git-gui.sh:3389 +msgid "Unstage Hunk From Commit" +msgstr "Desmarcar trecho para revisão" + +#: git-gui.sh:3391 +msgid "Unstage Lines From Commit" +msgstr "Desmarcar linhas para revisão" + +#: git-gui.sh:3393 +msgid "Unstage Line From Commit" +msgstr "Desmarcar linha para revisão" + +#: git-gui.sh:3396 +msgid "Stage Hunk For Commit" +msgstr "Marcar trecho para revisão" + +#: git-gui.sh:3398 +msgid "Stage Lines For Commit" +msgstr "Marcar linhas para revisão" + +#: git-gui.sh:3400 +msgid "Stage Line For Commit" +msgstr "Marcar linha para revisão" + +#: git-gui.sh:3424 +msgid "Initializing..." +msgstr "Iniciando..." + +#: git-gui.sh:3541 +#, tcl-format +msgid "" +"Possible environment issues exist.\n" +"\n" +"The following environment variables are probably\n" +"going to be ignored by any Git subprocess run\n" +"by %s:\n" +"\n" +msgstr "" +"Possíveis problemas com as variáveis de ambiente.\n" +"\n" +"As seguintes variáveis de ambiente provavelmente serão\n" +"ignoradas por qualquer sub-processo do Git executado por\n" +"%s:\n" + +#: git-gui.sh:3570 +msgid "" +"\n" +"This is due to a known issue with the\n" +"Tcl binary distributed by Cygwin." +msgstr "" +"\n" +"Isto se deve a um problema conhecido com os binários da Tcl \n" +"distribuídos com o Cygwin" + +#: git-gui.sh:3575 +#, tcl-format +msgid "" +"\n" +"\n" +"A good replacement for %s\n" +"is placing values for the user.name and\n" +"user.email settings into your personal\n" +"~/.gitconfig file.\n" +msgstr "" +"\n" +"\n" +"Uma boa alternativa para %s\n" +"é colocar os valores para o nome de usuário e e-mail\n" +"no seu arquivo \"~/.gitconfig\"\n" + +#: lib/about.tcl:26 +msgid "git-gui - a graphical user interface for Git." +msgstr "git-gui - uma interface gráfica para o Git" + +#: lib/blame.tcl:72 +msgid "File Viewer" +msgstr "Visualizador de arquivos" + +#: lib/blame.tcl:78 +msgid "Commit:" +msgstr "Revisão:" + +#: lib/blame.tcl:271 +msgid "Copy Commit" +msgstr "Copiar revisão" + +#: lib/blame.tcl:275 +msgid "Find Text..." +msgstr "Procurar texto..." + +#: lib/blame.tcl:284 +msgid "Do Full Copy Detection" +msgstr "Executar detecção completa de cópias" + +#: lib/blame.tcl:288 +msgid "Show History Context" +msgstr "Mostrar contexto do histórico" + +#: lib/blame.tcl:291 +msgid "Blame Parent Commit" +msgstr "Anotar revisão anterior" + +#: lib/blame.tcl:450 +#, tcl-format +msgid "Reading %s..." +msgstr "Lendo %s..." + +#: lib/blame.tcl:557 +msgid "Loading copy/move tracking annotations..." +msgstr "Carregando anotações de cópia/movimentação..." + +#: lib/blame.tcl:577 +msgid "lines annotated" +msgstr "linhas anotadas" + +#: lib/blame.tcl:769 +msgid "Loading original location annotations..." +msgstr "Carregando anotações originais..." + +#: lib/blame.tcl:772 +msgid "Annotation complete." +msgstr "Anotação completa." + +#: lib/blame.tcl:802 +msgid "Busy" +msgstr "Ocupado" + +#: lib/blame.tcl:803 +msgid "Annotation process is already running." +msgstr "O processo de anotação já está em execução" + +#: lib/blame.tcl:842 +msgid "Running thorough copy detection..." +msgstr "Executando detecção de cópia..." + +#: lib/blame.tcl:910 +msgid "Loading annotation..." +msgstr "Carregando anotações..." + +#: lib/blame.tcl:963 +msgid "Author:" +msgstr "Autor:" + +#: lib/blame.tcl:967 +msgid "Committer:" +msgstr "Revisor:" + +#: lib/blame.tcl:972 +msgid "Original File:" +msgstr "Arquivo original:" + +#: lib/blame.tcl:1020 +msgid "Cannot find HEAD commit:" +msgstr "Impossível encontrar revisão HEAD:" + +#: lib/blame.tcl:1075 +msgid "Cannot find parent commit:" +msgstr "Impossível encontrar revisão anterior:" + +#: lib/blame.tcl:1090 +msgid "Unable to display parent" +msgstr "Impossível exibir revisão anterior" + +#: lib/blame.tcl:1091 lib/diff.tcl:320 +msgid "Error loading diff:" +msgstr "Erro ao carregar as diferenças:" + +#: lib/blame.tcl:1231 +msgid "Originally By:" +msgstr "Originalmente por:" + +#: lib/blame.tcl:1237 +msgid "In File:" +msgstr "No arquivo:" + +#: lib/blame.tcl:1242 +msgid "Copied Or Moved Here By:" +msgstr "Copiado ou movido para cá por:" + +#: lib/branch_checkout.tcl:14 lib/branch_checkout.tcl:19 +msgid "Checkout Branch" +msgstr "Efetuar checkout do ramo" + +#: lib/branch_checkout.tcl:23 +msgid "Checkout" +msgstr "Checkout" + +#: lib/branch_checkout.tcl:27 lib/branch_create.tcl:35 +#: lib/branch_delete.tcl:32 lib/branch_rename.tcl:30 lib/browser.tcl:282 +#: lib/checkout_op.tcl:579 lib/choose_font.tcl:43 lib/merge.tcl:172 +#: lib/option.tcl:125 lib/remote_add.tcl:32 lib/remote_branch_delete.tcl:42 +#: lib/tools_dlg.tcl:40 lib/tools_dlg.tcl:204 lib/tools_dlg.tcl:352 +#: lib/transport.tcl:108 +msgid "Cancel" +msgstr "Cancelar" + +#: lib/branch_checkout.tcl:32 lib/browser.tcl:287 lib/tools_dlg.tcl:328 +msgid "Revision" +msgstr "Revisão" + +#: lib/branch_checkout.tcl:36 lib/branch_create.tcl:69 lib/option.tcl:280 +msgid "Options" +msgstr "Opções" + +#: lib/branch_checkout.tcl:39 lib/branch_create.tcl:92 +msgid "Fetch Tracking Branch" +msgstr "Obter ramo de rastreamento" + +#: lib/branch_checkout.tcl:44 +msgid "Detach From Local Branch" +msgstr "Separar do ramo local" + +#: lib/branch_create.tcl:22 +msgid "Create Branch" +msgstr "Criar ramo" + +#: lib/branch_create.tcl:27 +msgid "Create New Branch" +msgstr "Criar novo ramo" + +#: lib/branch_create.tcl:31 lib/choose_repository.tcl:381 +msgid "Create" +msgstr "Criar" + +#: lib/branch_create.tcl:40 +msgid "Branch Name" +msgstr "Nome do ramo" + +#: lib/branch_create.tcl:43 lib/remote_add.tcl:39 lib/tools_dlg.tcl:50 +msgid "Name:" +msgstr "Nome:" + +#: lib/branch_create.tcl:58 +msgid "Match Tracking Branch Name" +msgstr "Coincidir nome do ramo de rastreamento" + +#: lib/branch_create.tcl:66 +msgid "Starting Revision" +msgstr "Revisão inicial" + +#: lib/branch_create.tcl:72 +msgid "Update Existing Branch:" +msgstr "Atualizar ramo existente:" + +#: lib/branch_create.tcl:75 +msgid "No" +msgstr "Não" + +#: lib/branch_create.tcl:80 +msgid "Fast Forward Only" +msgstr "Somente se for um avanço rápido" + +#: lib/branch_create.tcl:85 lib/checkout_op.tcl:571 +msgid "Reset" +msgstr "Redefinir" + +#: lib/branch_create.tcl:97 +msgid "Checkout After Creation" +msgstr "Efetuar checkout após a criação" + +#: lib/branch_create.tcl:131 +msgid "Please select a tracking branch." +msgstr "Selecione um ramo de rastreamento." + +#: lib/branch_create.tcl:140 +#, tcl-format +msgid "Tracking branch %s is not a branch in the remote repository." +msgstr "O ramo de rastreamento %s não é um ramo do repositório remoto." + +#: lib/branch_create.tcl:153 lib/branch_rename.tcl:86 +msgid "Please supply a branch name." +msgstr "Indique um nome para o ramo." + +#: lib/branch_create.tcl:164 lib/branch_rename.tcl:106 +#, tcl-format +msgid "'%s' is not an acceptable branch name." +msgstr "\"%s\" não é um nome de ramo válido" + +#: lib/branch_delete.tcl:15 +msgid "Delete Branch" +msgstr "Apagar ramo" + +#: lib/branch_delete.tcl:20 +msgid "Delete Local Branch" +msgstr "Apagar ramo local" + +#: lib/branch_delete.tcl:37 +msgid "Local Branches" +msgstr "Ramos locais" + +#: lib/branch_delete.tcl:52 +msgid "Delete Only If Merged Into" +msgstr "Apagar somente se mesclado em" + +#: lib/branch_delete.tcl:54 lib/remote_branch_delete.tcl:119 +msgid "Always (Do not perform merge checks)" +msgstr "Forçar exclusão (não verificar se o ramo foi mesclado)" + +#: lib/branch_delete.tcl:103 +#, tcl-format +msgid "The following branches are not completely merged into %s:" +msgstr "Os ramos seguintes não foram completamente mesclados em %s:" + +#: lib/branch_delete.tcl:115 lib/remote_branch_delete.tcl:217 +msgid "" +"Recovering deleted branches is difficult.\n" +"\n" +"Delete the selected branches?" +msgstr "" +"Recuperar ramos apagados é difícil.\n" +"\n" +"Apagar os ramos selecionados?" + +#: lib/branch_delete.tcl:141 +#, tcl-format +msgid "" +"Failed to delete branches:\n" +"%s" +msgstr "" +"Erro ao apagar ramos:\n" +"%s" + +#: lib/branch_rename.tcl:14 lib/branch_rename.tcl:22 +msgid "Rename Branch" +msgstr "Renomear ramo" + +#: lib/branch_rename.tcl:26 +msgid "Rename" +msgstr "Renomear" + +#: lib/branch_rename.tcl:36 +msgid "Branch:" +msgstr "Ramo:" + +#: lib/branch_rename.tcl:39 +msgid "New Name:" +msgstr "Novo nome:" + +#: lib/branch_rename.tcl:75 +msgid "Please select a branch to rename." +msgstr "Selecione um ramo para renomear." + +#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:202 +#, tcl-format +msgid "Branch '%s' already exists." +msgstr "O ramo \"%s\" já existe." + +#: lib/branch_rename.tcl:117 +#, tcl-format +msgid "Failed to rename '%s'." +msgstr "Erro ao renomear \"%s\"." + +#: lib/browser.tcl:17 +msgid "Starting..." +msgstr "Inciando..." + +#: lib/browser.tcl:26 +msgid "File Browser" +msgstr "Navegador de arquivos" + +#: lib/browser.tcl:126 lib/browser.tcl:143 +#, tcl-format +msgid "Loading %s..." +msgstr "Carregando %s..." + +#: lib/browser.tcl:187 +msgid "[Up To Parent]" +msgstr "[Subir]" + +#: lib/browser.tcl:267 lib/browser.tcl:273 +msgid "Browse Branch Files" +msgstr "Explorar arquivos do ramo" + +#: lib/browser.tcl:278 lib/choose_repository.tcl:398 +#: lib/choose_repository.tcl:486 lib/choose_repository.tcl:497 +#: lib/choose_repository.tcl:1028 +msgid "Browse" +msgstr "Explorar" + +#: lib/checkout_op.tcl:85 +#, tcl-format +msgid "Fetching %s from %s" +msgstr "Obtendo %s de %s" + +#: lib/checkout_op.tcl:133 +#, tcl-format +msgid "fatal: Cannot resolve %s" +msgstr "Erro fatal: impossível resolver %s" + +#: lib/checkout_op.tcl:146 lib/console.tcl:81 lib/database.tcl:31 +#: lib/sshkey.tcl:53 +msgid "Close" +msgstr "Fechar" + +#: lib/checkout_op.tcl:175 +#, tcl-format +msgid "Branch '%s' does not exist." +msgstr "O ramo \"%s\" não existe." + +#: lib/checkout_op.tcl:194 +#, tcl-format +msgid "Failed to configure simplified git-pull for '%s'." +msgstr "Erro ao configurar git-pull simplificado para \"%s\"." + +#: lib/checkout_op.tcl:229 +#, tcl-format +msgid "" +"Branch '%s' already exists.\n" +"\n" +"It cannot fast-forward to %s.\n" +"A merge is required." +msgstr "" +"O ramo \"%s\" já existe.\n" +"\n" +"Não é possível avançá-lo para %s.\n" +"É preciso mesclar." + +#: lib/checkout_op.tcl:243 +#, tcl-format +msgid "Merge strategy '%s' not supported." +msgstr "Estratégia de mesclagem \"%s\" não suportada." + +#: lib/checkout_op.tcl:262 +#, tcl-format +msgid "Failed to update '%s'." +msgstr "Erro ao atualizar \"%s\"." + +#: lib/checkout_op.tcl:274 +msgid "Staging area (index) is already locked." +msgstr "A área de marcação (staging area, index) já está bloqueada." + +#: lib/checkout_op.tcl:289 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before the current branch can be changed.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" +"O último estado lido não confere com o estado atual.\n" +"\n" +"Outro programa do Git modificou o repositório desde a última leitura. Uma " +"atualização deve ser executada antes de alterar o ramo atual.\n" +"\n" +"A atualização começará automaticamente agora.\n" + +#: lib/checkout_op.tcl:345 +#, tcl-format +msgid "Updating working directory to '%s'..." +msgstr "Atualizando diretório de trabalho para \"%s\"..." + +#: lib/checkout_op.tcl:346 +msgid "files checked out" +msgstr "arquivos retirados" + +#: lib/checkout_op.tcl:376 +#, tcl-format +msgid "Aborted checkout of '%s' (file level merging is required)." +msgstr "Checkout de \"%s\" abortado (é preciso mesclar alguns arquivos)" + +#: lib/checkout_op.tcl:377 +msgid "File level merge required." +msgstr "Mesclagem de arquivos necessária." + +#: lib/checkout_op.tcl:381 +#, tcl-format +msgid "Staying on branch '%s'." +msgstr "Permanecendo no ramo \"%s\"." + +#: lib/checkout_op.tcl:452 +msgid "" +"You are no longer on a local branch.\n" +"\n" +"If you wanted to be on a branch, create one now starting from 'This Detached " +"Checkout'." +msgstr "" +"Você não está mais em um ramo local\n" +"\n" +"Se você deseja um ramo, crie um agora a partir deste checkout." + +#: lib/checkout_op.tcl:503 lib/checkout_op.tcl:507 +#, tcl-format +msgid "Checked out '%s'." +msgstr "Checkout de \"%s\" concluído." + +#: lib/checkout_op.tcl:535 +#, tcl-format +msgid "Resetting '%s' to '%s' will lose the following commits:" +msgstr "Redefinir \"%s\" para \"%s\" provocará a perda das seguintes revisões:" + +#: lib/checkout_op.tcl:557 +msgid "Recovering lost commits may not be easy." +msgstr "Recuperar revisões perdidas pode não ser fácil." + +#: lib/checkout_op.tcl:562 +#, tcl-format +msgid "Reset '%s'?" +msgstr "Redefinir \"%s\"?" + +#: lib/checkout_op.tcl:567 lib/merge.tcl:164 lib/tools_dlg.tcl:343 +msgid "Visualize" +msgstr "Visualizar" + +#: lib/checkout_op.tcl:635 +#, tcl-format +msgid "" +"Failed to set current branch.\n" +"\n" +"This working directory is only partially switched. We successfully updated " +"your files, but failed to update an internal Git file.\n" +"\n" +"This should not have occurred. %s will now close and give up." +msgstr "" +"Erro ao definir o ramo atual.\n" +"\n" +"Este diretório de trabalho está incompleto. Foi possível atualizar seus " +"arquivos, mas houve uma falha ao atualizar os arquivos internos do Git.\n" +"\n" +"Isto não deveria ter acontecido, %s terminará agora." + +#: lib/choose_font.tcl:39 +msgid "Select" +msgstr "Selecionar" + +#: lib/choose_font.tcl:53 +msgid "Font Family" +msgstr "Tipo da fonte" + +#: lib/choose_font.tcl:74 +msgid "Font Size" +msgstr "Tamanho da fonte" + +#: lib/choose_font.tcl:91 +msgid "Font Example" +msgstr "Exemplo" + +#: lib/choose_font.tcl:103 +msgid "" +"This is example text.\n" +"If you like this text, it can be your font." +msgstr "" +"Este é um texto de exemplo.\n" +"Se você gostar deste texto, esta pode ser sua fonte." + +#: lib/choose_repository.tcl:28 +msgid "Git Gui" +msgstr "Git Gui" + +#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:386 +msgid "Create New Repository" +msgstr "Criar novo repositório" + +#: lib/choose_repository.tcl:93 +msgid "New..." +msgstr "Novo..." + +#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:471 +msgid "Clone Existing Repository" +msgstr "Clonar repositório existente" + +#: lib/choose_repository.tcl:106 +msgid "Clone..." +msgstr "Clonar..." + +#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:1016 +msgid "Open Existing Repository" +msgstr "Abrir repositório existente" + +#: lib/choose_repository.tcl:119 +msgid "Open..." +msgstr "Abrir..." + +#: lib/choose_repository.tcl:132 +msgid "Recent Repositories" +msgstr "Repositórios recentes" + +#: lib/choose_repository.tcl:138 +msgid "Open Recent Repository:" +msgstr "Abrir repositório recente:" + +#: lib/choose_repository.tcl:306 lib/choose_repository.tcl:313 +#: lib/choose_repository.tcl:320 +#, tcl-format +msgid "Failed to create repository %s:" +msgstr "Erro ao criar repositório %s:" + +#: lib/choose_repository.tcl:391 +msgid "Directory:" +msgstr "Diretório:" + +#: lib/choose_repository.tcl:423 lib/choose_repository.tcl:550 +#: lib/choose_repository.tcl:1052 +msgid "Git Repository" +msgstr "Repositório Git" + +#: lib/choose_repository.tcl:448 +#, tcl-format +msgid "Directory %s already exists." +msgstr "O diretório %s já existe." + +#: lib/choose_repository.tcl:452 +#, tcl-format +msgid "File %s already exists." +msgstr "O arquivo %s já existe." + +#: lib/choose_repository.tcl:466 +msgid "Clone" +msgstr "Clonar" + +#: lib/choose_repository.tcl:479 +msgid "Source Location:" +msgstr "Origem:" + +#: lib/choose_repository.tcl:490 +msgid "Target Directory:" +msgstr "Diretório de destino:" + +#: lib/choose_repository.tcl:502 +msgid "Clone Type:" +msgstr "Tipo de clonagem:" + +#: lib/choose_repository.tcl:508 +msgid "Standard (Fast, Semi-Redundant, Hardlinks)" +msgstr "Padrão (rápida, semi-redundante, com hardlinks)" + +#: lib/choose_repository.tcl:514 +msgid "Full Copy (Slower, Redundant Backup)" +msgstr "Cópia completa (mais lenta, backup redundante)" + +#: lib/choose_repository.tcl:520 +msgid "Shared (Fastest, Not Recommended, No Backup)" +msgstr "Compartilhada (A mais rápida, não recomendada, sem backup)" + +#: lib/choose_repository.tcl:556 lib/choose_repository.tcl:603 +#: lib/choose_repository.tcl:749 lib/choose_repository.tcl:819 +#: lib/choose_repository.tcl:1058 lib/choose_repository.tcl:1066 +#, tcl-format +msgid "Not a Git repository: %s" +msgstr "Este não é um repositório do Git: %s" + +#: lib/choose_repository.tcl:592 +msgid "Standard only available for local repository." +msgstr "Clonagens padrões só são possíveis em repositórios locais." + +#: lib/choose_repository.tcl:596 +msgid "Shared only available for local repository." +msgstr "Clonagens parciais só são possíveis em repositórios locais." + +#: lib/choose_repository.tcl:617 +#, tcl-format +msgid "Location %s already exists." +msgstr "O local %s já existe." + +#: lib/choose_repository.tcl:628 +msgid "Failed to configure origin" +msgstr "Erro ao configurar origem" + +#: lib/choose_repository.tcl:640 +msgid "Counting objects" +msgstr "Contando objetos" + +#: lib/choose_repository.tcl:641 +msgid "buckets" +msgstr "buckets" + +#: lib/choose_repository.tcl:665 +#, tcl-format +msgid "Unable to copy objects/info/alternates: %s" +msgstr "Erro ao copiar objetos ou informações adicionais: %s" + +#: lib/choose_repository.tcl:701 +#, tcl-format +msgid "Nothing to clone from %s." +msgstr "Não há nada para clonar em %s." + +#: lib/choose_repository.tcl:703 lib/choose_repository.tcl:917 +#: lib/choose_repository.tcl:929 +msgid "The 'master' branch has not been initialized." +msgstr "O ramo \"master\" não foi inicializado." + +#: lib/choose_repository.tcl:716 +msgid "Hardlinks are unavailable. Falling back to copying." +msgstr "Não foi possível criar hardlinks, usando cópias convencionais." + +#: lib/choose_repository.tcl:728 +#, tcl-format +msgid "Cloning from %s" +msgstr "Clonando de %s" + +#: lib/choose_repository.tcl:759 +msgid "Copying objects" +msgstr "Copiando objetos" + +#: lib/choose_repository.tcl:760 +msgid "KiB" +msgstr "KiB" + +#: lib/choose_repository.tcl:784 +#, tcl-format +msgid "Unable to copy object: %s" +msgstr "Não foi possível copiar o objeto: %s" + +#: lib/choose_repository.tcl:794 +msgid "Linking objects" +msgstr "Ligando objetos" + +#: lib/choose_repository.tcl:795 +msgid "objects" +msgstr "objetos" + +#: lib/choose_repository.tcl:803 +#, tcl-format +msgid "Unable to hardlink object: %s" +msgstr "Não foi possível ligar o objeto: %s" + +#: lib/choose_repository.tcl:858 +msgid "Cannot fetch branches and objects. See console output for details." +msgstr "" +"Não foi possível receber ramos ou objetos. Veja a saída do console para " +"detalhes." + +#: lib/choose_repository.tcl:869 +msgid "Cannot fetch tags. See console output for details." +msgstr "" +"Não foi possível receber as etiquetas. Veja a saída do console para detalhes." + +#: lib/choose_repository.tcl:893 +msgid "Cannot determine HEAD. See console output for details." +msgstr "" +"Não foi possível determinar a etiqueta HEAD. Veja a saída do console para " +"detalhes." + +#: lib/choose_repository.tcl:902 +#, tcl-format +msgid "Unable to cleanup %s" +msgstr "Não foi possível limpar %s" + +#: lib/choose_repository.tcl:908 +msgid "Clone failed." +msgstr "A clonagem falhou." + +#: lib/choose_repository.tcl:915 +msgid "No default branch obtained." +msgstr "O ramo padrão não foi recebido." + +#: lib/choose_repository.tcl:926 +#, tcl-format +msgid "Cannot resolve %s as a commit." +msgstr "Não foi possível resolver %s como uma revisão." + +#: lib/choose_repository.tcl:938 +msgid "Creating working directory" +msgstr "Criando diretório de trabalho." + +#: lib/choose_repository.tcl:939 lib/index.tcl:67 lib/index.tcl:130 +#: lib/index.tcl:198 +msgid "files" +msgstr "arquivos" + +#: lib/choose_repository.tcl:968 +msgid "Initial file checkout failed." +msgstr "Erro ao efetuar checkout inicial." + +#: lib/choose_repository.tcl:1011 +msgid "Open" +msgstr "Abrir" + +#: lib/choose_repository.tcl:1021 +msgid "Repository:" +msgstr "Repositório:" + +#: lib/choose_repository.tcl:1072 +#, tcl-format +msgid "Failed to open repository %s:" +msgstr "Erro ao abrir o repositório %s:" + +#: lib/choose_rev.tcl:53 +msgid "This Detached Checkout" +msgstr "Este checkout" + +#: lib/choose_rev.tcl:60 +msgid "Revision Expression:" +msgstr "Expressão de revisão:" + +#: lib/choose_rev.tcl:74 +msgid "Local Branch" +msgstr "Ramo local" + +#: lib/choose_rev.tcl:79 +msgid "Tracking Branch" +msgstr "Ramo de rastreamento" + +#: lib/choose_rev.tcl:84 lib/choose_rev.tcl:538 +msgid "Tag" +msgstr "Etiqueta" + +#: lib/choose_rev.tcl:317 +#, tcl-format +msgid "Invalid revision: %s" +msgstr "Revisão inválida: %s" + +#: lib/choose_rev.tcl:338 +msgid "No revision selected." +msgstr "Nenhuma revisão selecionada." + +#: lib/choose_rev.tcl:346 +msgid "Revision expression is empty." +msgstr "A expressão de revisão está vazia." + +#: lib/choose_rev.tcl:531 +msgid "Updated" +msgstr "Atualizado" + +#: lib/choose_rev.tcl:559 +msgid "URL" +msgstr "URL" + +#: lib/commit.tcl:9 +msgid "" +"There is nothing to amend.\n" +"\n" +"You are about to create the initial commit. There is no commit before this " +"to amend.\n" +msgstr "" +"Não há nada para corrigir.\n" +"\n" +"Você está prestes a criar uma revisão inicial. Não há revisão anterior para " +"corrigir.\n" + +#: lib/commit.tcl:18 +msgid "" +"Cannot amend while merging.\n" +"\n" +"You are currently in the middle of a merge that has not been fully " +"completed. You cannot amend the prior commit unless you first abort the " +"current merge activity.\n" +msgstr "" +"Não é possível corrigir durante uma mesclagem.\n" +"\n" +"Você está em meio a uma operação de mesclagem que não foi completada. Não é " +"possível corrigir a revisão anterior a menos que você aborte a mescla atual " +"antes.\n" + +#: lib/commit.tcl:48 +msgid "Error loading commit data for amend:" +msgstr "Erro ao carregar dados da revisão para corrigir:" + +#: lib/commit.tcl:75 +msgid "Unable to obtain your identity:" +msgstr "Não foi possível obter a sua identidade:" + +#: lib/commit.tcl:80 +msgid "Invalid GIT_COMMITTER_IDENT:" +msgstr "Variável \"GIT_COMMITTER_IDENT\" inválida:" + +#: lib/commit.tcl:129 +#, tcl-format +msgid "warning: Tcl does not support encoding '%s'." +msgstr "aviso: O Tcl não suporta a codificação \"%s\"." + +#: lib/commit.tcl:149 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before another commit can be created.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" +"O último estado lido não confere com o estado atual.\n" +"\n" +"Outro programa do Git modificou o repositório desde a última leitura. Uma " +"atualização deve ser executada antes de criar outra revisão.\n" +"\n" +"A atualização começará automaticamente agora.\n" + +#: lib/commit.tcl:172 +#, tcl-format +msgid "" +"Unmerged files cannot be committed.\n" +"\n" +"File %s has merge conflicts. You must resolve them and stage the file " +"before committing.\n" +msgstr "" +"Não é possível salvar revisões para arquivos não mesclados.\n" +"\n" +"O arquivo %s possui conflitos de mesclagem. Você deve resolvê-los e marcar o " +"arquivo antes de salvar a revisão.\n" + +#: lib/commit.tcl:180 +#, tcl-format +msgid "" +"Unknown file state %s detected.\n" +"\n" +"File %s cannot be committed by this program.\n" +msgstr "" +"Estado desconhecido detectado para o arquivo %s.\n" +"\n" +"Este programa não pode salvar uma revisão para o arquivo %s.\n" + +#: lib/commit.tcl:188 +msgid "" +"No changes to commit.\n" +"\n" +"You must stage at least 1 file before you can commit.\n" +msgstr "" +"Não há mudanças para salvar.\n" +"\n" +"Você deve marcar ao menos um arquivo antes de salvar a revisão.\n" + +#: lib/commit.tcl:203 +msgid "" +"Please supply a commit message.\n" +"\n" +"A good commit message has the following format:\n" +"\n" +"- First line: Describe in one sentence what you did.\n" +"- Second line: Blank\n" +"- Remaining lines: Describe why this change is good.\n" +msgstr "" +"Por favor, indique uma descrição para a revisão.\n" +"\n" +"Uma boa descrição tem o seguinte formato:\n" +"\n" +"- Primeira linha: descreve, em uma única frase, o que você fez.\n" +"- Segunda linha: em branco.\n" +"- Demais linhas: Descreve detalhadamente a revisão.\n" + +#: lib/commit.tcl:234 +msgid "Calling pre-commit hook..." +msgstr "Executando script \"pre-commit\"..." + +#: lib/commit.tcl:249 +msgid "Commit declined by pre-commit hook." +msgstr "A revisão foi bloqueada pelo script \"pre-commit\"." + +#: lib/commit.tcl:272 +msgid "Calling commit-msg hook..." +msgstr "Executando script \"commit-msg\"..." + +#: lib/commit.tcl:287 +msgid "Commit declined by commit-msg hook." +msgstr "Revisão bloqueada pelo script \"commit-msg\"." + +#: lib/commit.tcl:300 +msgid "Committing changes..." +msgstr "Salvando revisão..." + +#: lib/commit.tcl:316 +msgid "write-tree failed:" +msgstr "write-tree falhou:" + +#: lib/commit.tcl:317 lib/commit.tcl:361 lib/commit.tcl:382 +msgid "Commit failed." +msgstr "A revisão falhou." + +#: lib/commit.tcl:334 +#, tcl-format +msgid "Commit %s appears to be corrupt" +msgstr "A revisão %s parece estar corrompida." + +#: lib/commit.tcl:339 +msgid "" +"No changes to commit.\n" +"\n" +"No files were modified by this commit and it was not a merge commit.\n" +"\n" +"A rescan will be automatically started now.\n" +msgstr "" +"Não há alterações para salvar.\n" +"\n" +"Nenhum arquivo foi modificado e esta não é uma revisão de mesclagem.\n" +"\n" +"Uma atualização será executada automaticamente agora.\n" + +#: lib/commit.tcl:346 +msgid "No changes to commit." +msgstr "Não há alterações para salvar." + +#: lib/commit.tcl:360 +msgid "commit-tree failed:" +msgstr "commit-tree falhou:" + +#: lib/commit.tcl:381 +msgid "update-ref failed:" +msgstr "update-ref falhou:" + +#: lib/commit.tcl:469 +#, tcl-format +msgid "Created commit %s: %s" +msgstr "Revisão %s criada: %s" + +#: lib/console.tcl:59 +msgid "Working... please wait..." +msgstr "Trabalhando... aguarde..." + +#: lib/console.tcl:186 +msgid "Success" +msgstr "Sucesso" + +#: lib/console.tcl:200 +msgid "Error: Command Failed" +msgstr "Erro: o comando falhou" + +#: lib/database.tcl:43 +msgid "Number of loose objects" +msgstr "Número de objetos soltos" + +#: lib/database.tcl:44 +msgid "Disk space used by loose objects" +msgstr "Espaço ocupado pelos objetos soltos" + +#: lib/database.tcl:45 +msgid "Number of packed objects" +msgstr "Número de objetos compactados" + +#: lib/database.tcl:46 +msgid "Number of packs" +msgstr "Número de pacotes" + +#: lib/database.tcl:47 +msgid "Disk space used by packed objects" +msgstr "Espaço ocupado pelos objetos compactados" + +#: lib/database.tcl:48 +msgid "Packed objects waiting for pruning" +msgstr "Objetos compactados aguardando eliminação" + +#: lib/database.tcl:49 +msgid "Garbage files" +msgstr "Arquivos de lixo" + +#: lib/database.tcl:72 +msgid "Compressing the object database" +msgstr "Compactando banco de dados de objetos" + +#: lib/database.tcl:83 +msgid "Verifying the object database with fsck-objects" +msgstr "Verificando banco de dados de objetos com fsck-objects" + +#: lib/database.tcl:107 +#, tcl-format +msgid "" +"This repository currently has approximately %i loose objects.\n" +"\n" +"To maintain optimal performance it is strongly recommended that you compress " +"the database.\n" +"\n" +"Compress the database now?" +msgstr "" +"Este repositório possui aproximadamente %i objetos soltos.\n" +"\n" +"Para manter o desempenho ótimo é altamente recomendado que você compacte o " +"banco de dados.\n" +"\n" +"Compactar o banco de dados agora?" + +#: lib/date.tcl:25 +#, tcl-format +msgid "Invalid date from Git: %s" +msgstr "Data inválida recebida do Git: %s" + +#: lib/diff.tcl:64 +#, tcl-format +msgid "" +"No differences detected.\n" +"\n" +"%s has no changes.\n" +"\n" +"The modification date of this file was updated by another application, but " +"the content within the file was not changed.\n" +"\n" +"A rescan will be automatically started to find other files which may have " +"the same state." +msgstr "" +"Nenhuma diferença foi detectada.\n" +"\n" +"%s não possui mudanças.\n" +"\n" +"A data de modificação deste arquivo foi atualizada por outro aplicativo, mas " +"o conteúdo do arquivo não foi alterado.\n" +"\n" +"Uma atualização ser executada para encontrar outros arquivos que possam ter " +"o mesmo estado." + +#: lib/diff.tcl:104 +#, tcl-format +msgid "Loading diff of %s..." +msgstr "Carregando diferenças de %s..." + +#: lib/diff.tcl:125 +msgid "" +"LOCAL: deleted\n" +"REMOTE:\n" +msgstr "" +"Local: apagado\n" +"Remoto:\n" + +#: lib/diff.tcl:130 +msgid "" +"REMOTE: deleted\n" +"LOCAL:\n" +msgstr "" +"Remoto: apagado\n" +"Local:\n" + +#: lib/diff.tcl:137 +msgid "LOCAL:\n" +msgstr "Local:\n" + +#: lib/diff.tcl:140 +msgid "REMOTE:\n" +msgstr "Remoto:\n" + +#: lib/diff.tcl:202 lib/diff.tcl:319 +#, tcl-format +msgid "Unable to display %s" +msgstr "Impossível exibir %s" + +#: lib/diff.tcl:203 +msgid "Error loading file:" +msgstr "Erro ao carregar o arquivo:" + +#: lib/diff.tcl:210 +msgid "Git Repository (subproject)" +msgstr "Repositório Git (sub-projeto)" + +#: lib/diff.tcl:222 +msgid "* Binary file (not showing content)." +msgstr "* Arquivo binário (conteúdo não exibido)." + +#: lib/diff.tcl:227 +#, tcl-format +msgid "" +"* Untracked file is %d bytes.\n" +"* Showing only first %d bytes.\n" +msgstr "" +"* O arquivo não rastreado possui %d bytes.\n" +"* Exibindo apenas os primeiros %d bytes.\n" + +#: lib/diff.tcl:233 +#, tcl-format +msgid "" +"\n" +"* Untracked file clipped here by %s.\n" +"* To see the entire file, use an external editor.\n" +msgstr "" +"\n" +"* O arquivo não rastreado foi cortado aqui por %s.\n" +"* Para ver o arquivo completo, use um editor externo.\n" + +#: lib/diff.tcl:482 +msgid "Failed to unstage selected hunk." +msgstr "Erro ao desmarcar o trecho selecionado." + +#: lib/diff.tcl:489 +msgid "Failed to stage selected hunk." +msgstr "Erro ao marcar o trecho selecionado." + +#: lib/diff.tcl:568 +msgid "Failed to unstage selected line." +msgstr "Erro ao desmarcar a linha selecionada." + +#: lib/diff.tcl:576 +msgid "Failed to stage selected line." +msgstr "Erro ao marcar a linha selecionada." + +#: lib/encoding.tcl:443 +msgid "Default" +msgstr "Padrão" + +#: lib/encoding.tcl:448 +#, tcl-format +msgid "System (%s)" +msgstr "Sistema (%s)" + +#: lib/encoding.tcl:459 lib/encoding.tcl:465 +msgid "Other" +msgstr "Outro" + +#: lib/error.tcl:20 lib/error.tcl:114 +msgid "error" +msgstr "Erro" + +#: lib/error.tcl:36 +msgid "warning" +msgstr "aviso" + +#: lib/error.tcl:94 +msgid "You must correct the above errors before committing." +msgstr "Você precisa corrigir os erros acima antes de salvar a revisão." + +#: lib/index.tcl:6 +msgid "Unable to unlock the index." +msgstr "Impossível desbloquear o índice." + +#: lib/index.tcl:15 +msgid "Index Error" +msgstr "Erro no índice" + +#: lib/index.tcl:17 +msgid "" +"Updating the Git index failed. A rescan will be automatically started to " +"resynchronize git-gui." +msgstr "" +"A atualização do índice do Git falhou. Uma atualização será executada " +"automaticamente para ressincronizar o Git GUI" + +#: lib/index.tcl:28 +msgid "Continue" +msgstr "Continuar" + +#: lib/index.tcl:31 +msgid "Unlock Index" +msgstr "Desbloquear índice" + +#: lib/index.tcl:289 +#, tcl-format +msgid "Unstaging %s from commit" +msgstr "Desmarcando %s para revisão" + +#: lib/index.tcl:328 +msgid "Ready to commit." +msgstr "Pronto para salvar a revisão." + +#: lib/index.tcl:341 +#, tcl-format +msgid "Adding %s" +msgstr "Adicionando %s" + +#: lib/index.tcl:398 +#, tcl-format +msgid "Revert changes in file %s?" +msgstr "Reverter as alterações no arquivo %s?" + +#: lib/index.tcl:400 +#, tcl-format +msgid "Revert changes in these %i files?" +msgstr "Reverter as alterações nestes %i arquivos?" + +#: lib/index.tcl:408 +msgid "Any unstaged changes will be permanently lost by the revert." +msgstr "" +"Qualquer alteração não marcada será permanentemente perdida na reversão." + +#: lib/index.tcl:411 +msgid "Do Nothing" +msgstr "Não fazer nada" + +#: lib/index.tcl:429 +msgid "Reverting selected files" +msgstr "Revertendo os arquivos selecionados" + +#: lib/index.tcl:433 +#, tcl-format +msgid "Reverting %s" +msgstr "Revertendo %s" + +#: lib/merge.tcl:13 +msgid "" +"Cannot merge while amending.\n" +"\n" +"You must finish amending this commit before starting any type of merge.\n" +msgstr "" +"Não é possível mesclar durante uma correção.\n" +"\n" +"Você deve concluir a correção antes de começar qualquer mesclagem.\n" + +#: lib/merge.tcl:27 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before a merge can be performed.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" +"O último estado lido não confere com o estado atual.\n" +"\n" +"Outro programa do Git modificou o repositório desde a última leitura. Uma " +"atualização deve ser executada antes de efetuar uma mesclagem.\n" +"\n" +"A atualização começará automaticamente agora.\n" + +#: lib/merge.tcl:45 +#, tcl-format +msgid "" +"You are in the middle of a conflicted merge.\n" +"\n" +"File %s has merge conflicts.\n" +"\n" +"You must resolve them, stage the file, and commit to complete the current " +"merge. Only then can you begin another merge.\n" +msgstr "" +"Há uma mesclagem com conflitos em progresso.\n" +"\n" +"O arquivo %s possui conflitos de mesclagem.\n" +"\n" +"Você deve resolvê-los, marcar o arquivo e salvar a revisão para completar a " +"mesclagem atual. Só então você poderá começar outra.\n" + +#: lib/merge.tcl:55 +#, tcl-format +msgid "" +"You are in the middle of a change.\n" +"\n" +"File %s is modified.\n" +"\n" +"You should complete the current commit before starting a merge. Doing so " +"will help you abort a failed merge, should the need arise.\n" +msgstr "" +"Você está em meio a uma mudança.\n" +"\n" +"O arquivo %s foi modificado.\n" +"\n" +"Você deve completar e salvar a revisão atual antes de começar uma mesclagem. " +"Ao fazê-lo, você poderá abortar a mesclagem caso haja algum erro.\n" + +#: lib/merge.tcl:107 +#, tcl-format +msgid "%s of %s" +msgstr "%s de %s" + +#: lib/merge.tcl:120 +#, tcl-format +msgid "Merging %s and %s..." +msgstr "Mesclando %s e %s..." + +#: lib/merge.tcl:131 +msgid "Merge completed successfully." +msgstr "Mesclagem completada com sucesso." + +#: lib/merge.tcl:133 +msgid "Merge failed. Conflict resolution is required." +msgstr "A mesclagem falhou. É necessário resolver conflitos." + +#: lib/merge.tcl:158 +#, tcl-format +msgid "Merge Into %s" +msgstr "Mesclar em %s" + +#: lib/merge.tcl:177 +msgid "Revision To Merge" +msgstr "Revisão para mesclar" + +#: lib/merge.tcl:212 +msgid "" +"Cannot abort while amending.\n" +"\n" +"You must finish amending this commit.\n" +msgstr "" +"Não é possível abortar durante uma correção.\n" +"\n" +"Você precisa finalizar a correção desta revisão.\n" + +#: lib/merge.tcl:222 +msgid "" +"Abort merge?\n" +"\n" +"Aborting the current merge will cause *ALL* uncommitted changes to be lost.\n" +"\n" +"Continue with aborting the current merge?" +msgstr "" +"Abortar mesclagem?\n" +"\n" +"Abortar a mesclagem atual implicará na perda de *TODAS* as mudanças não " +"salvas.\n" +"\n" +"Abortar a mesclagem atual?" + +#: lib/merge.tcl:228 +msgid "" +"Reset changes?\n" +"\n" +"Resetting the changes will cause *ALL* uncommitted changes to be lost.\n" +"\n" +"Continue with resetting the current changes?" +msgstr "" +"Descartar as mudanças?\n" +"\n" +"Ao fazê-lo, *TODAS* as alterações não salvas serão perdidas.\n" +"\n" +"Continuar e descartar as mudanças atuais?" + +#: lib/merge.tcl:239 +msgid "Aborting" +msgstr "Abortando" + +#: lib/merge.tcl:239 +msgid "files reset" +msgstr "arquivos redefindos" + +#: lib/merge.tcl:267 +msgid "Abort failed." +msgstr "A tentativa de abortar a operação falhou" + +#: lib/merge.tcl:269 +msgid "Abort completed. Ready." +msgstr "Operação abortada com sucesso. Pronto." + +#: lib/mergetool.tcl:8 +msgid "Force resolution to the base version?" +msgstr "Forçar a resolução para a versão base?" + +#: lib/mergetool.tcl:9 +msgid "Force resolution to this branch?" +msgstr "Forçar resolução para este ramo?" + +#: lib/mergetool.tcl:10 +msgid "Force resolution to the other branch?" +msgstr "Forçar resolução para o outro ramo?" + +#: lib/mergetool.tcl:14 +#, tcl-format +msgid "" +"Note that the diff shows only conflicting changes.\n" +"\n" +"%s will be overwritten.\n" +"\n" +"This operation can be undone only by restarting the merge." +msgstr "" +"Note que o diff mostra apenas as mudanças conflitantes.\n" +"\n" +"%s será sobrescrito.\n" +"\n" +"Caso necessário, será preciso reiniciar a mesclagem para desfazer esta " +"operação." + +#: lib/mergetool.tcl:45 +#, tcl-format +msgid "File %s seems to have unresolved conflicts, still stage?" +msgstr "O arquivo %s parece ter conflitos não resolvidos. Marcar mesmo assim?" + +#: lib/mergetool.tcl:60 +#, tcl-format +msgid "Adding resolution for %s" +msgstr "Adicionando resolução para %s" + +#: lib/mergetool.tcl:141 +msgid "Cannot resolve deletion or link conflicts using a tool" +msgstr "" +"Impossível resolver conflitos envolvendo exclusão ou links de arquivos com " +"esta ferramenta." + +#: lib/mergetool.tcl:146 +msgid "Conflict file does not exist" +msgstr "O arquivo conflitante não existe" + +#: lib/mergetool.tcl:264 +#, tcl-format +msgid "Not a GUI merge tool: '%s'" +msgstr "Não é uma ferramenta de mesclagem gráfica: \"%s\"" + +#: lib/mergetool.tcl:268 +#, tcl-format +msgid "Unsupported merge tool '%s'" +msgstr "Ferramenta de mesclagem não suportada \"%s\"" + +#: lib/mergetool.tcl:303 +msgid "Merge tool is already running, terminate it?" +msgstr "A ferramenta de mesclagem já está em execução. Finalizar?" + +#: lib/mergetool.tcl:323 +#, tcl-format +msgid "" +"Error retrieving versions:\n" +"%s" +msgstr "" +"Erro ao obter as versões:\n" +"%s" + +#: lib/mergetool.tcl:343 +#, tcl-format +msgid "" +"Could not start the merge tool:\n" +"\n" +"%s" +msgstr "" +"Não foi possível iniciar a ferramenta de mesclagem:\n" +"\n" +"%s" + +#: lib/mergetool.tcl:347 +msgid "Running merge tool..." +msgstr "Executando ferramenta de mesclagem..." + +#: lib/mergetool.tcl:375 lib/mergetool.tcl:383 +msgid "Merge tool failed." +msgstr "Ferramenta de mesclagem falhou." + +#: lib/option.tcl:11 +#, tcl-format +msgid "Invalid global encoding '%s'" +msgstr "Codificação global inválida \"%s\"" + +#: lib/option.tcl:19 +#, tcl-format +msgid "Invalid repo encoding '%s'" +msgstr "Codificação do repositório inválida \"%s\"" + +#: lib/option.tcl:117 +msgid "Restore Defaults" +msgstr "Restaurar padrões" + +#: lib/option.tcl:121 +msgid "Save" +msgstr "Salvar" + +#: lib/option.tcl:131 +#, tcl-format +msgid "%s Repository" +msgstr "Repositório %s" + +#: lib/option.tcl:132 +msgid "Global (All Repositories)" +msgstr "Global (todos os repositórios)" + +#: lib/option.tcl:138 +msgid "User Name" +msgstr "Nome do usuário" + +#: lib/option.tcl:139 +msgid "Email Address" +msgstr "Endereço de e-mail" + +#: lib/option.tcl:141 +msgid "Summarize Merge Commits" +msgstr "Exibir sumário das revisões de mesclagem" + +#: lib/option.tcl:142 +msgid "Merge Verbosity" +msgstr "Nível de detalhamento da mesclagem" + +#: lib/option.tcl:143 +msgid "Show Diffstat After Merge" +msgstr "Exibir estatísticas após mesclagens" + +#: lib/option.tcl:144 +msgid "Use Merge Tool" +msgstr "Usar ferramenta de mesclagem" + +#: lib/option.tcl:146 +msgid "Trust File Modification Timestamps" +msgstr "Confiar nas datas de modificação dos arquivos" + +#: lib/option.tcl:147 +msgid "Prune Tracking Branches During Fetch" +msgstr "Eliminar ramos de rastreamento ao receber" + +#: lib/option.tcl:148 +msgid "Match Tracking Branches" +msgstr "Coincidir ramos de rastreamento" + +#: lib/option.tcl:149 +msgid "Blame Copy Only On Changed Files" +msgstr "Detectar cópias somente em arquivos modificados" + +#: lib/option.tcl:150 +msgid "Minimum Letters To Blame Copy On" +msgstr "Número mínimo de letras para detectar cópias" + +#: lib/option.tcl:151 +msgid "Blame History Context Radius (days)" +msgstr "Extensão do contexto de detecção (em dias)" + +#: lib/option.tcl:152 +msgid "Number of Diff Context Lines" +msgstr "Número de linhas para o diff contextual" + +#: lib/option.tcl:153 +msgid "Commit Message Text Width" +msgstr "Largura do texto da descrição da revisão" + +#: lib/option.tcl:154 +msgid "New Branch Name Template" +msgstr "Modelo de nome para novos ramos" + +#: lib/option.tcl:155 +msgid "Default File Contents Encoding" +msgstr "Codificação padrão dos arquivos" + +#: lib/option.tcl:203 +msgid "Change" +msgstr "Alterar" + +#: lib/option.tcl:230 +msgid "Spelling Dictionary:" +msgstr "Dicionário para o verificador ortográfico:" + +#: lib/option.tcl:254 +msgid "Change Font" +msgstr "Mudar fonte" + +#: lib/option.tcl:258 +#, tcl-format +msgid "Choose %s" +msgstr "Escolher %s" + +#: lib/option.tcl:264 +msgid "pt." +msgstr "pt." + +#: lib/option.tcl:278 +msgid "Preferences" +msgstr "Preferências" + +#: lib/option.tcl:314 +msgid "Failed to completely save options:" +msgstr "Houve um erro ao salvar as opções:" + +#: lib/remote.tcl:163 +msgid "Remove Remote" +msgstr "Excluir" + +#: lib/remote.tcl:168 +msgid "Prune from" +msgstr "Limpar de" + +#: lib/remote.tcl:173 +msgid "Fetch from" +msgstr "Receber de" + +#: lib/remote.tcl:215 +msgid "Push to" +msgstr "Enviar para" + +#: lib/remote_add.tcl:19 +msgid "Add Remote" +msgstr "Adicionar repositório remoto" + +#: lib/remote_add.tcl:24 +msgid "Add New Remote" +msgstr "Adicionar novo repositório remoto" + +#: lib/remote_add.tcl:28 lib/tools_dlg.tcl:36 +msgid "Add" +msgstr "Adicionar" + +#: lib/remote_add.tcl:37 +msgid "Remote Details" +msgstr "Detalhes do repositório remoto" + +#: lib/remote_add.tcl:50 +msgid "Location:" +msgstr "Local:" + +#: lib/remote_add.tcl:62 +msgid "Further Action" +msgstr "Ações adicionais" + +#: lib/remote_add.tcl:65 +msgid "Fetch Immediately" +msgstr "Receber imediatamente" + +#: lib/remote_add.tcl:71 +msgid "Initialize Remote Repository and Push" +msgstr "Inicializar repositório remoto e enviar" + +#: lib/remote_add.tcl:77 +msgid "Do Nothing Else Now" +msgstr "Não fazer nada agora" + +#: lib/remote_add.tcl:101 +msgid "Please supply a remote name." +msgstr "Por favor, indique um nome para o repositório remoto." + +#: lib/remote_add.tcl:114 +#, tcl-format +msgid "'%s' is not an acceptable remote name." +msgstr "\"%s\" não é um nome válido para um repositório remoto." + +#: lib/remote_add.tcl:125 +#, tcl-format +msgid "Failed to add remote '%s' of location '%s'." +msgstr "Erro ao adicionar repositório remoto \"%s\" do local \"%s\":" + +#: lib/remote_add.tcl:133 lib/transport.tcl:6 +#, tcl-format +msgid "fetch %s" +msgstr "receber %s" + +#: lib/remote_add.tcl:134 +#, tcl-format +msgid "Fetching the %s" +msgstr "Recebendo o %s" + +#: lib/remote_add.tcl:157 +#, tcl-format +msgid "Do not know how to initialize repository at location '%s'." +msgstr "Não sabe como inicializar o repositório remoto em \"%s\"." + +#: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:63 +#: lib/transport.tcl:81 +#, tcl-format +msgid "push %s" +msgstr "enviar %s" + +#: lib/remote_add.tcl:164 +#, tcl-format +msgid "Setting up the %s (at %s)" +msgstr "Configurando %s (em %s)" + +#: lib/remote_branch_delete.tcl:29 lib/remote_branch_delete.tcl:34 +msgid "Delete Branch Remotely" +msgstr "Apagar ramo remoto" + +#: lib/remote_branch_delete.tcl:47 +msgid "From Repository" +msgstr "Do repositório" + +#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:134 +msgid "Remote:" +msgstr "Remoto:" + +#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:149 +msgid "Arbitrary Location:" +msgstr "Outro local:" + +#: lib/remote_branch_delete.tcl:84 +msgid "Branches" +msgstr "Ramos" + +#: lib/remote_branch_delete.tcl:109 +msgid "Delete Only If" +msgstr "Apagar somente se" + +#: lib/remote_branch_delete.tcl:111 +msgid "Merged Into:" +msgstr "Mesclado em:" + +#: lib/remote_branch_delete.tcl:152 +msgid "A branch is required for 'Merged Into'." +msgstr "É preciso indicar um ramo para \"Mesclado em\"." + +#: lib/remote_branch_delete.tcl:184 +#, tcl-format +msgid "" +"The following branches are not completely merged into %s:\n" +"\n" +" - %s" +msgstr "" +"Os seguintes ramos não estão inteiramente mesclados em %s:\n" +"\n" +" - %s" + +#: lib/remote_branch_delete.tcl:189 +#, tcl-format +msgid "" +"One or more of the merge tests failed because you have not fetched the " +"necessary commits. Try fetching from %s first." +msgstr "" +"Um ou mais testes de mesclagem falharam porque você não possui as revisões " +"necessárias. Tente receber revisões de %s primeiro." + +#: lib/remote_branch_delete.tcl:207 +msgid "Please select one or more branches to delete." +msgstr "Por favor selecione um ou mais ramos para apagar." + +#: lib/remote_branch_delete.tcl:226 +#, tcl-format +msgid "Deleting branches from %s" +msgstr "Apagar ramos de %s" + +#: lib/remote_branch_delete.tcl:292 +msgid "No repository selected." +msgstr "Nenhum repositório foi selecionado." + +#: lib/remote_branch_delete.tcl:297 +#, tcl-format +msgid "Scanning %s..." +msgstr "Atualizando %s..." + +#: lib/search.tcl:21 +msgid "Find:" +msgstr "Encontrar:" + +#: lib/search.tcl:23 +msgid "Next" +msgstr "Próximo" + +#: lib/search.tcl:24 +msgid "Prev" +msgstr "Anterior" + +#: lib/search.tcl:25 +msgid "Case-Sensitive" +msgstr "Sensível a maiúsculas/minúsculas" + +#: lib/shortcut.tcl:21 lib/shortcut.tcl:62 +msgid "Cannot write shortcut:" +msgstr "Não foi possível gravar o atalho:" + +#: lib/shortcut.tcl:137 +msgid "Cannot write icon:" +msgstr "Não foi possível gravar o ícone:" + +#: lib/spellcheck.tcl:57 +msgid "Unsupported spell checker" +msgstr "Verificador ortográfico não suportado" + +#: lib/spellcheck.tcl:65 +msgid "Spell checking is unavailable" +msgstr "Verificação ortográfica indisponível" + +#: lib/spellcheck.tcl:68 +msgid "Invalid spell checking configuration" +msgstr "Configuração do verificador ortográfico inválida" + +#: lib/spellcheck.tcl:70 +#, tcl-format +msgid "Reverting dictionary to %s." +msgstr "Revertendo dicionário para %s." + +#: lib/spellcheck.tcl:73 +msgid "Spell checker silently failed on startup" +msgstr "O verificador ortográfico falhou sem relatar nenhum erro" + +#: lib/spellcheck.tcl:80 +msgid "Unrecognized spell checker" +msgstr "Verificador ortográfico não reconhecido" + +#: lib/spellcheck.tcl:186 +msgid "No Suggestions" +msgstr "Sem sugestões" + +#: lib/spellcheck.tcl:388 +msgid "Unexpected EOF from spell checker" +msgstr "Final de arquivo inesperado recebido do verificador ortográfico" + +#: lib/spellcheck.tcl:392 +msgid "Spell Checker Failed" +msgstr "A verificação ortográfica falhou" + +#: lib/sshkey.tcl:31 +msgid "No keys found." +msgstr "Nenhuma chave encontrada" + +#: lib/sshkey.tcl:34 +#, tcl-format +msgid "Found a public key in: %s" +msgstr "Chave pública encontrada em: %s" + +#: lib/sshkey.tcl:40 +msgid "Generate Key" +msgstr "Gerar chave" + +#: lib/sshkey.tcl:56 +msgid "Copy To Clipboard" +msgstr "Copiar para a área de transferência" + +#: lib/sshkey.tcl:70 +msgid "Your OpenSSH Public Key" +msgstr "Sua chave pública OpenSSH" + +#: lib/sshkey.tcl:78 +msgid "Generating..." +msgstr "Gerando..." + +#: lib/sshkey.tcl:84 +#, tcl-format +msgid "" +"Could not start ssh-keygen:\n" +"\n" +"%s" +msgstr "" +"Impossível iniciar ssh-keygen:\n" +"\n" +"%s" + +#: lib/sshkey.tcl:111 +msgid "Generation failed." +msgstr "A geração da chave falhou." + +#: lib/sshkey.tcl:118 +msgid "Generation succeded, but no keys found." +msgstr "A geração da chave foi bem-sucedida, mas nenhuma chave foi encontrada." + +#: lib/sshkey.tcl:121 +#, tcl-format +msgid "Your key is in: %s" +msgstr "Sua chave em: %s" + +#: lib/status_bar.tcl:83 +#, tcl-format +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i de %*i %s (%3i%%)" + +#: lib/tools.tcl:75 +#, tcl-format +msgid "Running %s requires a selected file." +msgstr "É preciso selecionar um arquivo para executar %s." + +#: lib/tools.tcl:90 +#, tcl-format +msgid "Are you sure you want to run %s?" +msgstr "Você tem certeza que deseja executar %s?" + +#: lib/tools.tcl:110 +#, tcl-format +msgid "Tool: %s" +msgstr "Ferramenta: %s" + +#: lib/tools.tcl:111 +#, tcl-format +msgid "Running: %s" +msgstr "Executando: %s" + +#: lib/tools.tcl:149 +#, tcl-format +msgid "Tool completed successfully: %s" +msgstr "Execução completada com sucesso: %s" + +#: lib/tools.tcl:151 +#, tcl-format +msgid "Tool failed: %s" +msgstr "Ferramenta falhou: %s" + +#: lib/tools_dlg.tcl:22 +msgid "Add Tool" +msgstr "Adicionar ferramenta" + +#: lib/tools_dlg.tcl:28 +msgid "Add New Tool Command" +msgstr "Adicionar novo comando de ferramenta" + +#: lib/tools_dlg.tcl:33 +msgid "Add globally" +msgstr "Adicionar globalmente" + +#: lib/tools_dlg.tcl:45 +msgid "Tool Details" +msgstr "Detalhes da ferramenta" + +#: lib/tools_dlg.tcl:48 +msgid "Use '/' separators to create a submenu tree:" +msgstr "Use o separador \"/\" para criar uma árvore de sub-menus:" + +#: lib/tools_dlg.tcl:61 +msgid "Command:" +msgstr "Comando:" + +#: lib/tools_dlg.tcl:74 +msgid "Show a dialog before running" +msgstr "Exibir uma caixa de diálogo antes de executar" + +#: lib/tools_dlg.tcl:80 +msgid "Ask the user to select a revision (sets $REVISION)" +msgstr "Solicitar a seleção de uma revisão (a variável $REVISION)" + +#: lib/tools_dlg.tcl:85 +msgid "Ask the user for additional arguments (sets $ARGS)" +msgstr "Solicitar argumentos adicionais (define a variável $ARGS)" + +#: lib/tools_dlg.tcl:92 +msgid "Don't show the command output window" +msgstr "Não exibir a janela de saída do comando" + +#: lib/tools_dlg.tcl:97 +msgid "Run only if a diff is selected ($FILENAME not empty)" +msgstr "Executar apenas se houver um diff selecionado ($FILENAME não-vazio)" + +#: lib/tools_dlg.tcl:121 +msgid "Please supply a name for the tool." +msgstr "Por favor, indique um nome para a ferramenta." + +#: lib/tools_dlg.tcl:129 +#, tcl-format +msgid "Tool '%s' already exists." +msgstr "A ferramenta \"%s\" já existe." + +#: lib/tools_dlg.tcl:151 +#, tcl-format +msgid "" +"Could not add tool:\n" +"%s" +msgstr "" +"Não foi possível adicionar a ferramenta:\n" +"%s" + +#: lib/tools_dlg.tcl:190 +msgid "Remove Tool" +msgstr "Excluir ferramenta" + +#: lib/tools_dlg.tcl:196 +msgid "Remove Tool Commands" +msgstr "Excluir comando de ferramenta" + +#: lib/tools_dlg.tcl:200 +msgid "Remove" +msgstr "Excluir" + +#: lib/tools_dlg.tcl:236 +msgid "(Blue denotes repository-local tools)" +msgstr "(Azul indica ferramentas do repositório local)" + +#: lib/tools_dlg.tcl:297 +#, tcl-format +msgid "Run Command: %s" +msgstr "Executar comando: %s" + +#: lib/tools_dlg.tcl:311 +msgid "Arguments" +msgstr "Argumentos" + +#: lib/tools_dlg.tcl:348 +msgid "OK" +msgstr "OK" + +#: lib/transport.tcl:7 +#, tcl-format +msgid "Fetching new changes from %s" +msgstr "Recebendo novas mudanças de %s" + +#: lib/transport.tcl:18 +#, tcl-format +msgid "remote prune %s" +msgstr "Limpar %s" + +#: lib/transport.tcl:19 +#, tcl-format +msgid "Pruning tracking branches deleted from %s" +msgstr "Limpando ramos excluídos de %s" + +#: lib/transport.tcl:26 +#, tcl-format +msgid "Pushing changes to %s" +msgstr "Enviando mudanças para %s" + +#: lib/transport.tcl:64 +#, tcl-format +msgid "Mirroring to %s" +msgstr "Duplicando para %s" + +#: lib/transport.tcl:82 +#, tcl-format +msgid "Pushing %s %s to %s" +msgstr "Enviando %s %s para %s" + +#: lib/transport.tcl:100 +msgid "Push Branches" +msgstr "Enviar ramos" + +#: lib/transport.tcl:114 +msgid "Source Branches" +msgstr "Ramos de origem" + +#: lib/transport.tcl:131 +msgid "Destination Repository" +msgstr "Repositório de destino" + +#: lib/transport.tcl:169 +msgid "Transfer Options" +msgstr "Opções de transferência" + +#: lib/transport.tcl:171 +msgid "Force overwrite existing branch (may discard changes)" +msgstr "Sobrescrever ramos existentes (pode descartar mudanças)" + +#: lib/transport.tcl:175 +msgid "Use thin pack (for slow network connections)" +msgstr "Usar compactação minimalista (para redes lentas)" + +#: lib/transport.tcl:179 +msgid "Include tags" +msgstr "Incluir etiquetas" -- cgit v0.10.2-6-g49f6 From bf5fe3f33c2296f2a092d8dce4e1dbec171fde02 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:46:21 +0100 Subject: git-gui: fix typo in image data Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/git-gui.sh b/git-gui.sh index 8c3cf6b..8d576b3 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1962,8 +1962,8 @@ static unsigned char file_merge_bits[] = { } -maskdata $filemask image create bitmap file_statechange -background white -foreground green -data { -#define file_merge_width 14 -#define file_merge_height 15 +#define file_statechange_width 14 +#define file_statechange_height 15 static unsigned char file_statechange_bits[] = { 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x62, 0x10, 0x62, 0x10, 0xba, 0x11, 0xba, 0x11, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10, -- cgit v0.10.2-6-g49f6 From 4a065c8a6f0415da6d778dae83ff88e5385a2f0f Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:46:22 +0100 Subject: git-gui: remove 'no such variable' for s error when encounter unknown file states $s will be referenced in the error message. Which was broken since "git-gui: Automatically update-index all included files before commit" (bbe3b3b, 2006-11-16). Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/commit.tcl b/lib/commit.tcl index 7f459cd..83b3d9d 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -161,7 +161,8 @@ The rescan will be automatically started now. # set files_ready 0 foreach path [array names file_states] { - switch -glob -- [lindex $file_states($path) 0] { + set s $file_states($path) + switch -glob -- [lindex $s 0] { _? {continue} A? - D? - -- cgit v0.10.2-6-g49f6 From 7587f4d32f7479a9fa9ae1767708597702a0be5f Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:46:23 +0100 Subject: git-gui: learn more type change states Support the following states with type change in git-gui: AT, MT, TD, TM Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/git-gui.sh b/git-gui.sh index 8d576b3..886719a 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1997,7 +1997,11 @@ foreach i { {MD {mc "Staged for commit, missing"}} {_T {mc "File type changed, not staged"}} + {MT {mc "File type changed, old type staged for commit"}} + {AT {mc "File type changed, old type staged for commit"}} {T_ {mc "File type changed, staged"}} + {TM {mc "File type change staged, modification not staged"}} + {TD {mc "File type change staged, file missing"}} {_O {mc "Untracked, not staged"}} {A_ {mc "Staged for commit"}} @@ -3539,8 +3543,8 @@ proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} { || $current_diff_path eq {} || {__} eq $state || {_O} eq $state - || {_T} eq $state - || {T_} eq $state + || [string match {?T} $state] + || [string match {T?} $state] || [has_textconv $current_diff_path]} { set s disabled } else { diff --git a/lib/commit.tcl b/lib/commit.tcl index 83b3d9d..5ce4687 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -166,7 +166,7 @@ The rescan will be automatically started now. _? {continue} A? - D? - - T_ - + T? - M? {set files_ready 1} _U - U? { @@ -453,7 +453,11 @@ A rescan will be automatically started now. } AM - AD - + AT - + TM - + TD - MM - + MT - MD { set file_states($path) [list \ _[string index $m 1] \ diff --git a/lib/index.tcl b/lib/index.tcl index e9db0c4..5d7bbf2 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -103,8 +103,11 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} { set s $file_states($path) switch -glob -- [lindex $s 0] { A? {set new _O} - M? {set new _M} + MT - + TM - T_ {set new _T} + M? {set new _M} + TD - D_ {set new _D} D? {set new _?} ?? {continue} @@ -167,7 +170,10 @@ proc write_update_index {fd pathList totalCnt batch after} { AD {set new __} ?D {set new D_} _O - + AT - AM {set new A_} + TM - + MT - _T {set new T_} _U - U? { @@ -261,7 +267,7 @@ proc unstage_helper {txt paths} { switch -glob -- [lindex $file_states($path) 0] { A? - M? - - T_ - + T? - D? { lappend pathList $path if {$path eq $current_diff_path} { -- cgit v0.10.2-6-g49f6 From c976bbff3c3e46e700adbdc14def8c9432fc925c Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:52 +0100 Subject: git-gui: rework handling of diff header The fix in ca53c3f (Fix diff parsing for lines starting with "--" or "++", 2008-09-05) got a bug report from Johannes Sixt, that new files in the index now looks like: new file mode 100644 --- /dev/null +++ b/foo @@ -0,0 +1 @@ +foo The introduced problem was that the 'in-diff-header'-flag was unconditially disabled. Now it is only disabled when a hunk line is detected. And also re-enabled when we encounter a new diff header. The second part solves also the issue reported by me for diffs with file type changes (i.e. the ''error: Unhandled 2 way diff marker: {d}"', which comes from the second 'diff --git' line). Reported-by: Johannes Sixt Reported-by: Bert Wesarg Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 9d0dc07..dae6ca6 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -382,23 +382,35 @@ proc read_diff {fd conflict_size cont_info} { foreach {line markup} [parse_color_line $line] break set line [string map {\033 ^} $line] - # -- Cleanup uninteresting diff header lines. + # -- Check for start of diff header. + if { [string match {diff --git *} $line] + || [string match {diff --cc *} $line] + || [string match {diff --combined *} $line]} { + set ::current_diff_inheader 1 + } + + # -- Check for end of diff header (any hunk line will do this). # + if {[regexp {^@@+ } $line]} {set ::current_diff_inheader 0} + if {$::current_diff_inheader} { + append current_diff_header $line "\n" + + # -- Cleanup uninteresting diff header lines. + # if { [string match {diff --git *} $line] || [string match {diff --cc *} $line] || [string match {diff --combined *} $line] || [string match {--- *} $line] || [string match {+++ *} $line]} { - append current_diff_header $line "\n" continue } } + if {[string match {index *} $line]} continue if {$line eq {deleted file mode 120000}} { set line "deleted symlink" } - set ::current_diff_inheader 0 # -- Automatically detect if this is a 3 way diff. # -- cgit v0.10.2-6-g49f6 From ebd143ff999f40996832e9c221c41cb609578cd1 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:53 +0100 Subject: git-gui: handle index lines only in the diff header Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index dae6ca6..0b72924 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -402,12 +402,12 @@ proc read_diff {fd conflict_size cont_info} { || [string match {diff --cc *} $line] || [string match {diff --combined *} $line] || [string match {--- *} $line] - || [string match {+++ *} $line]} { + || [string match {+++ *} $line] + || [string match {index *} $line]} { continue } } - if {[string match {index *} $line]} continue if {$line eq {deleted file mode 120000}} { set line "deleted symlink" } -- cgit v0.10.2-6-g49f6 From 97b8ee167154b66ec59367d3cc6d6abf5a996440 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:54 +0100 Subject: git-gui: name also new symlinks so and rename them only in the diff header Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 0b72924..aa30089 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -406,12 +406,13 @@ proc read_diff {fd conflict_size cont_info} { || [string match {index *} $line]} { continue } - } - if {$line eq {deleted file mode 120000}} { - set line "deleted symlink" + # -- Name it symlink, not 120000 + # Note, that the original line is in $current_diff_header + regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line } + # -- Automatically detect if this is a 3 way diff. # if {[string match {@@@ *} $line]} {set is_3way_diff 1} @@ -421,6 +422,7 @@ proc read_diff {fd conflict_size cont_info} { || [regexp {^(old|new) mode *} $line] || [string match {deleted file *} $line] || [string match {deleted symlink} $line] + || [string match {new symlink} $line] || [string match {Binary files * and * differ} $line] || $line eq {\ No newline at end of file} || [regexp {^\* Unmerged path } $line]} { -- cgit v0.10.2-6-g49f6 From 3c9ae64c81bf6261fa9b19de5b6134e321905838 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:55 +0100 Subject: git-gui: there is no "mode *" diff header line Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index aa30089..20f50dd 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -417,8 +417,7 @@ proc read_diff {fd conflict_size cont_info} { # if {[string match {@@@ *} $line]} {set is_3way_diff 1} - if {[string match {mode *} $line] - || [string match {new file *} $line] + if {[string match {new file *} $line] || [regexp {^(old|new) mode *} $line] || [string match {deleted file *} $line] || [string match {deleted symlink} $line] -- cgit v0.10.2-6-g49f6 From 963ceab57e0743ed76889b93d051dee828eed859 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:56 +0100 Subject: git-gui: move 3way diff autodetect up Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 20f50dd..2290919 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -393,6 +393,10 @@ proc read_diff {fd conflict_size cont_info} { # if {[regexp {^@@+ } $line]} {set ::current_diff_inheader 0} + # -- Automatically detect if this is a 3 way diff. + # + if {[string match {@@@ *} $line]} {set is_3way_diff 1} + if {$::current_diff_inheader} { append current_diff_header $line "\n" @@ -413,9 +417,6 @@ proc read_diff {fd conflict_size cont_info} { } - # -- Automatically detect if this is a 3 way diff. - # - if {[string match {@@@ *} $line]} {set is_3way_diff 1} if {[string match {new file *} $line] || [regexp {^(old|new) mode *} $line] -- cgit v0.10.2-6-g49f6 From 6459d7c046e5ab618ffde2d5a04dc83b5f97a600 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:57 +0100 Subject: git-gui: always reset the current tag Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 2290919..91ed7c6 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -382,6 +382,8 @@ proc read_diff {fd conflict_size cont_info} { foreach {line markup} [parse_color_line $line] break set line [string map {\033 ^} $line] + set tags {} + # -- Check for start of diff header. if { [string match {diff --git *} $line] || [string match {diff --cc *} $line] @@ -426,7 +428,6 @@ proc read_diff {fd conflict_size cont_info} { || [string match {Binary files * and * differ} $line] || $line eq {\ No newline at end of file} || [regexp {^\* Unmerged path } $line]} { - set tags {} } elseif {$is_3way_diff} { set op [string range $line 0 1] switch -- $op { -- cgit v0.10.2-6-g49f6 From d1c7f8aa666dfc96743782cba452112c7678e9eb Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:58 +0100 Subject: git-gui: handle special content lines only in the diff header section These two also stop the diff header. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 91ed7c6..4eaf7e7 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -400,7 +400,14 @@ proc read_diff {fd conflict_size cont_info} { if {[string match {@@@ *} $line]} {set is_3way_diff 1} if {$::current_diff_inheader} { - append current_diff_header $line "\n" + + # -- These two lines stop a diff header and shouldn't be in there + if { [string match {Binary files * and * differ} $line] + || [regexp {^\* Unmerged path } $line]} { + set ::current_diff_inheader 0 + } else { + append current_diff_header $line "\n" + } # -- Cleanup uninteresting diff header lines. # @@ -418,16 +425,12 @@ proc read_diff {fd conflict_size cont_info} { regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line } - - if {[string match {new file *} $line] || [regexp {^(old|new) mode *} $line] || [string match {deleted file *} $line] || [string match {deleted symlink} $line] || [string match {new symlink} $line] - || [string match {Binary files * and * differ} $line] - || $line eq {\ No newline at end of file} - || [regexp {^\* Unmerged path } $line]} { + || $line eq {\ No newline at end of file}} { } elseif {$is_3way_diff} { set op [string range $line 0 1] switch -- $op { -- cgit v0.10.2-6-g49f6 From bf59439847369ce8c1169fdf58aca5ca857dc568 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 9 Dec 2010 21:47:59 +0100 Subject: git-gui: handle meta diff header lines only in the header section Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts diff --git a/lib/diff.tcl b/lib/diff.tcl index 4eaf7e7..cf8a95e 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -423,14 +423,9 @@ proc read_diff {fd conflict_size cont_info} { # -- Name it symlink, not 120000 # Note, that the original line is in $current_diff_header regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line - } - if {[string match {new file *} $line] - || [regexp {^(old|new) mode *} $line] - || [string match {deleted file *} $line] - || [string match {deleted symlink} $line] - || [string match {new symlink} $line] - || $line eq {\ No newline at end of file}} { + } elseif { $line eq {\ No newline at end of file}} { + # -- Handle some special lines } elseif {$is_3way_diff} { set op [string range $line 0 1] switch -- $op { -- cgit v0.10.2-6-g49f6 From 0602f3e916a2727dfc4954b81ce5aacd69d9692c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:36 +0700 Subject: Add struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old pathspec structure remains as pathspec.raw[]. New things are stored in pathspec.items[]. There's no guarantee that the pathspec order in raw[] is exactly as in items[]. raw[] is external (source) data and is untouched by pathspec manipulation functions. It eases migration from old const char ** to this new struct. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/cache.h b/cache.h index d83d68c..a645614 100644 --- a/cache.h +++ b/cache.h @@ -500,6 +500,17 @@ extern int index_name_is_other(const struct index_state *, const char *, int); extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); +struct pathspec { + const char **raw; /* get_pathspec() result, not freed by free_pathspec() */ + int nr; + struct pathspec_item { + const char *match; + int len; + } *items; +}; + +extern int init_pathspec(struct pathspec *, const char **); +extern void free_pathspec(struct pathspec *); extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); diff --git a/dir.c b/dir.c index 570b651..70d10bc 100644 --- a/dir.c +++ b/dir.c @@ -1151,3 +1151,34 @@ int remove_path(const char *name) return 0; } +int init_pathspec(struct pathspec *pathspec, const char **paths) +{ + const char **p = paths; + int i; + + memset(pathspec, 0, sizeof(*pathspec)); + if (!p) + return 0; + while (*p) + p++; + pathspec->raw = paths; + pathspec->nr = p - paths; + if (!pathspec->nr) + return 0; + + pathspec->items = xmalloc(sizeof(struct pathspec_item)*pathspec->nr); + for (i = 0; i < pathspec->nr; i++) { + struct pathspec_item *item = pathspec->items+i; + const char *path = paths[i]; + + item->match = path; + item->len = strlen(path); + } + return 0; +} + +void free_pathspec(struct pathspec *pathspec) +{ + free(pathspec->items); + pathspec->items = NULL; +} -- cgit v0.10.2-6-g49f6 From 16dc36fea87e917a7f734400eb91e62e170db1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:37 +0700 Subject: diff-no-index: use diff_tree_setup_paths() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff_options.{paths,nr_paths} will be removed later. Do not modify them directly. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/diff-no-index.c b/diff-no-index.c index ce9e783..e48ab92 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -231,8 +231,9 @@ void diff_no_index(struct rev_info *revs, if (prefix) { int len = strlen(prefix); + const char *paths[3]; + memset(paths, 0, sizeof(paths)); - revs->diffopt.paths = xcalloc(2, sizeof(char *)); for (i = 0; i < 2; i++) { const char *p = argv[argc - 2 + i]; /* @@ -242,12 +243,12 @@ void diff_no_index(struct rev_info *revs, p = (strcmp(p, "-") ? xstrdup(prefix_filename(prefix, len, p)) : p); - revs->diffopt.paths[i] = p; + paths[i] = p; } + diff_tree_setup_paths(paths, &revs->diffopt); } else - revs->diffopt.paths = argv + argc - 2; - revs->diffopt.nr_paths = 2; + diff_tree_setup_paths(argv + argc - 2, &revs->diffopt); revs->diffopt.skip_stat_unmatch = 1; if (!revs->diffopt.output_format) revs->diffopt.output_format = DIFF_FORMAT_PATCH; -- cgit v0.10.2-6-g49f6 From 66f136252fe1998e2c1381c913795b5f56b6dc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:38 +0700 Subject: Convert struct diff_options to use struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 951c7c8..46085f8 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -61,7 +61,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) rev.combine_merges = rev.dense_combined_merges = 1; - if (read_cache_preload(rev.diffopt.paths) < 0) { + if (read_cache_preload(rev.diffopt.pathspec.raw) < 0) { perror("read_cache_preload"); return -1; } diff --git a/builtin/diff.c b/builtin/diff.c index 945e758..a08c324 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -135,7 +135,7 @@ static int builtin_diff_index(struct rev_info *revs, revs->max_count != -1 || revs->min_age != -1 || revs->max_age != -1) usage(builtin_diff_usage); - if (read_cache_preload(revs->diffopt.paths) < 0) { + if (read_cache_preload(revs->diffopt.pathspec.raw) < 0) { perror("read_cache_preload"); return -1; } @@ -237,7 +237,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv revs->combine_merges = revs->dense_combined_merges = 1; setup_work_tree(); - if (read_cache_preload(revs->diffopt.paths) < 0) { + if (read_cache_preload(revs->diffopt.pathspec.raw) < 0) { perror("read_cache_preload"); return -1; } diff --git a/builtin/log.c b/builtin/log.c index d8c6c28..f5ed690 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -89,7 +89,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, rev->always_show_header = 0; if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) { rev->always_show_header = 0; - if (rev->diffopt.nr_paths != 1) + if (rev->diffopt.pathspec.nr != 1) usage("git logs can only follow renames on one pathname at a time"); } for (i = 1; i < argc; i++) { diff --git a/diff-lib.c b/diff-lib.c index 392ce2b..3b809f2 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -501,7 +501,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt) active_nr = dst - active_cache; init_revisions(&revs, NULL); - revs.prune_data = opt->paths; + revs.prune_data = opt->pathspec.raw; tree = parse_tree_indirect(tree_sha1); if (!tree) die("bad tree object %s", sha1_to_hex(tree_sha1)); diff --git a/diff-no-index.c b/diff-no-index.c index e48ab92..3a36144 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -260,8 +260,8 @@ void diff_no_index(struct rev_info *revs, if (diff_setup_done(&revs->diffopt) < 0) die("diff_setup_done failed"); - if (queue_diff(&revs->diffopt, revs->diffopt.paths[0], - revs->diffopt.paths[1])) + if (queue_diff(&revs->diffopt, revs->diffopt.pathspec.raw[0], + revs->diffopt.pathspec.raw[1])) exit(1); diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/"); diffcore_std(&revs->diffopt); diff --git a/diff.h b/diff.h index 0083d92..310bd6b 100644 --- a/diff.h +++ b/diff.h @@ -133,9 +133,7 @@ struct diff_options { FILE *file; int close_file; - int nr_paths; - const char **paths; - int *pathlens; + struct pathspec pathspec; change_fn_t change; add_remove_fn_t add_remove; diff_format_fn_t format_callback; diff --git a/revision.c b/revision.c index 7b9eaef..0c511aa 100644 --- a/revision.c +++ b/revision.c @@ -553,11 +553,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs) left_first = left_count < right_count; init_patch_ids(&ids); - if (revs->diffopt.nr_paths) { - ids.diffopts.nr_paths = revs->diffopt.nr_paths; - ids.diffopts.paths = revs->diffopt.paths; - ids.diffopts.pathlens = revs->diffopt.pathlens; - } + ids.diffopts.pathspec = revs->diffopt.pathspec; /* Compute patch-ids for one side */ for (p = list; p; p = p->next) { diff --git a/tree-diff.c b/tree-diff.c index 12c9a88..f6b4aa4 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -102,16 +102,17 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int int pathlen; int never_interesting = -1; - if (!opt->nr_paths) + if (!opt->pathspec.nr) return 2; sha1 = tree_entry_extract(desc, &path, &mode); pathlen = tree_entry_len(path, sha1); - for (i = 0; i < opt->nr_paths; i++) { - const char *match = opt->paths[i]; - int matchlen = opt->pathlens[i]; + for (i = 0; i < opt->pathspec.nr; i++) { + const struct pathspec_item *item = opt->pathspec.items+i; + const char *match = item->match; + int matchlen = item->len; int m = -1; /* signals that we haven't called strncmp() */ if (baselen >= matchlen) { @@ -286,7 +287,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru if (DIFF_OPT_TST(opt, QUICK) && DIFF_OPT_TST(opt, HAS_CHANGES)) break; - if (opt->nr_paths) { + if (opt->pathspec.nr) { if (!all_t1_interesting) skip_uninteresting(t1, base, baselen, opt, &all_t1_interesting); @@ -349,7 +350,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co DIFF_OPT_SET(&diff_opts, RECURSIVE); DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER); diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT; - diff_opts.single_follow = opt->paths[0]; + diff_opts.single_follow = opt->pathspec.raw[0]; diff_opts.break_opt = opt->break_opt; paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); @@ -369,15 +370,16 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co * diff_queued_diff, we will also use that as the path in * the future! */ - if ((p->status == 'R' || p->status == 'C') && !strcmp(p->two->path, opt->paths[0])) { + if ((p->status == 'R' || p->status == 'C') && + !strcmp(p->two->path, opt->pathspec.raw[0])) { /* Switch the file-pairs around */ q->queue[i] = choice; choice = p; /* Update the path we use from now on.. */ diff_tree_release_paths(opt); - opt->paths[0] = xstrdup(p->one->path); - diff_tree_setup_paths(opt->paths, opt); + opt->pathspec.raw[0] = xstrdup(p->one->path); + diff_tree_setup_paths(opt->pathspec.raw, opt); /* * The caller expects us to return a set of vanilla @@ -452,36 +454,12 @@ int diff_root_tree_sha1(const unsigned char *new, const char *base, struct diff_ return retval; } -static int count_paths(const char **paths) -{ - int i = 0; - while (*paths++) - i++; - return i; -} - void diff_tree_release_paths(struct diff_options *opt) { - free(opt->pathlens); + free_pathspec(&opt->pathspec); } void diff_tree_setup_paths(const char **p, struct diff_options *opt) { - opt->nr_paths = 0; - opt->pathlens = NULL; - opt->paths = NULL; - - if (p) { - int i; - - opt->paths = p; - opt->nr_paths = count_paths(p); - if (opt->nr_paths == 0) { - opt->pathlens = NULL; - return; - } - opt->pathlens = xmalloc(opt->nr_paths * sizeof(int)); - for (i=0; i < opt->nr_paths; i++) - opt->pathlens[i] = strlen(p[i]); - } + init_pathspec(&opt->pathspec, p); } -- cgit v0.10.2-6-g49f6 From 475005a11768a3906c42fac55e8b3371794bdef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:39 +0700 Subject: tree_entry_interesting(): remove dependency on struct diff_options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function can be potentially used in more places than just tree-diff.c. "struct diff_options" does not make much sense outside diff_tree_sha1(). While removing the use of diff_options, it also removes tree_entry_extract() call, which means S_ISDIR() uses the entry->mode directly, without being filtered by canon_mode() (called internally inside tree_entry_extract). The only use of the mode information in this function is to check the type of the entry by giving it to S_ISDIR() macro, and the result does not change with or without canon_mode(), so it is ok to bypass tree_entry_extract(). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/tree-diff.c b/tree-diff.c index f6b4aa4..281b48c 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -93,24 +93,19 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const * - zero for no * - negative for "no, and no subsequent entries will be either" */ -static int tree_entry_interesting(struct tree_desc *desc, const char *base, int baselen, struct diff_options *opt) +static int tree_entry_interesting(const struct name_entry *entry, const char *base, int baselen, const struct pathspec *ps) { - const char *path; - const unsigned char *sha1; - unsigned mode; int i; int pathlen; int never_interesting = -1; - if (!opt->pathspec.nr) + if (!ps || !ps->nr) return 2; - sha1 = tree_entry_extract(desc, &path, &mode); - - pathlen = tree_entry_len(path, sha1); + pathlen = tree_entry_len(entry->path, entry->sha1); - for (i = 0; i < opt->pathspec.nr; i++) { - const struct pathspec_item *item = opt->pathspec.items+i; + for (i = 0; i < ps->nr; i++) { + const struct pathspec_item *item = ps->items+i; const char *match = item->match; int matchlen = item->len; int m = -1; /* signals that we haven't called strncmp() */ @@ -150,7 +145,7 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int * Does match sort strictly earlier than path * with their common parts? */ - m = strncmp(match, path, + m = strncmp(match, entry->path, (matchlen < pathlen) ? matchlen : pathlen); if (m < 0) continue; @@ -177,7 +172,7 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int if (matchlen > pathlen) { if (match[pathlen] != '/') continue; - if (!S_ISDIR(mode)) + if (!S_ISDIR(entry->mode)) continue; } @@ -186,7 +181,7 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int * we cheated and did not do strncmp(), so we do * that here. */ - m = strncmp(match, path, pathlen); + m = strncmp(match, entry->path, pathlen); /* * If common part matched earlier then it is a hit, @@ -209,8 +204,7 @@ static void show_tree(struct diff_options *opt, const char *prefix, struct tree_ if (all_interesting) show = 1; else { - show = tree_entry_interesting(desc, base, baselen, - opt); + show = tree_entry_interesting(&desc->entry, base, baselen, &opt->pathspec); if (show == 2) all_interesting = 1; } @@ -263,7 +257,7 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree static void skip_uninteresting(struct tree_desc *t, const char *base, int baselen, struct diff_options *opt, int *all_interesting) { while (t->size) { - int show = tree_entry_interesting(t, base, baselen, opt); + int show = tree_entry_interesting(&t->entry, base, baselen, &opt->pathspec); if (show == 2) *all_interesting = 1; if (!show) { -- cgit v0.10.2-6-g49f6 From 2c389fc8ec57722aa1e8f49d316401e2e21d1b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:40 +0700 Subject: Move tree_entry_interesting() to tree-walk.c and export it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/tree-diff.c b/tree-diff.c index 281b48c..23f4478 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -82,118 +82,6 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const return 0; } -/* - * Is a tree entry interesting given the pathspec we have? - * - * Pre-condition: baselen == 0 || base[baselen-1] == '/' - * - * Return: - * - 2 for "yes, and all subsequent entries will be" - * - 1 for yes - * - zero for no - * - negative for "no, and no subsequent entries will be either" - */ -static int tree_entry_interesting(const struct name_entry *entry, const char *base, int baselen, const struct pathspec *ps) -{ - int i; - int pathlen; - int never_interesting = -1; - - if (!ps || !ps->nr) - return 2; - - pathlen = tree_entry_len(entry->path, entry->sha1); - - for (i = 0; i < ps->nr; i++) { - const struct pathspec_item *item = ps->items+i; - const char *match = item->match; - int matchlen = item->len; - int m = -1; /* signals that we haven't called strncmp() */ - - if (baselen >= matchlen) { - /* If it doesn't match, move along... */ - if (strncmp(base, match, matchlen)) - continue; - - /* - * If the base is a subdirectory of a path which - * was specified, all of them are interesting. - */ - if (!matchlen || - base[matchlen] == '/' || - match[matchlen - 1] == '/') - return 2; - - /* Just a random prefix match */ - continue; - } - - /* Does the base match? */ - if (strncmp(base, match, baselen)) - continue; - - match += baselen; - matchlen -= baselen; - - if (never_interesting) { - /* - * We have not seen any match that sorts later - * than the current path. - */ - - /* - * Does match sort strictly earlier than path - * with their common parts? - */ - m = strncmp(match, entry->path, - (matchlen < pathlen) ? matchlen : pathlen); - if (m < 0) - continue; - - /* - * If we come here even once, that means there is at - * least one pathspec that would sort equal to or - * later than the path we are currently looking at. - * In other words, if we have never reached this point - * after iterating all pathspecs, it means all - * pathspecs are either outside of base, or inside the - * base but sorts strictly earlier than the current - * one. In either case, they will never match the - * subsequent entries. In such a case, we initialized - * the variable to -1 and that is what will be - * returned, allowing the caller to terminate early. - */ - never_interesting = 0; - } - - if (pathlen > matchlen) - continue; - - if (matchlen > pathlen) { - if (match[pathlen] != '/') - continue; - if (!S_ISDIR(entry->mode)) - continue; - } - - if (m == -1) - /* - * we cheated and did not do strncmp(), so we do - * that here. - */ - m = strncmp(match, entry->path, pathlen); - - /* - * If common part matched earlier then it is a hit, - * because we rejected the case where path is not a - * leading directory and is shorter than match. - */ - if (!m) - return 1; - } - return never_interesting; /* No matches */ -} - /* A whole sub-tree went away or appeared */ static void show_tree(struct diff_options *opt, const char *prefix, struct tree_desc *desc, const char *base, int baselen) { diff --git a/tree-walk.c b/tree-walk.c index a9bbf4e..522bb6b 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -455,3 +455,117 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch free(tree); return retval; } + +/* + * Is a tree entry interesting given the pathspec we have? + * + * Pre-condition: baselen == 0 || base[baselen-1] == '/' + * + * Return: + * - 2 for "yes, and all subsequent entries will be" + * - 1 for yes + * - zero for no + * - negative for "no, and no subsequent entries will be either" + */ +int tree_entry_interesting(const struct name_entry *entry, + const char *base, int baselen, + const struct pathspec *ps) +{ + int i; + int pathlen; + int never_interesting = -1; + + if (!ps || !ps->nr) + return 2; + + pathlen = tree_entry_len(entry->path, entry->sha1); + + for (i = 0; i < ps->nr; i++) { + const struct pathspec_item *item = ps->items+i; + const char *match = item->match; + int matchlen = item->len; + int m = -1; /* signals that we haven't called strncmp() */ + + if (baselen >= matchlen) { + /* If it doesn't match, move along... */ + if (strncmp(base, match, matchlen)) + continue; + + /* + * If the base is a subdirectory of a path which + * was specified, all of them are interesting. + */ + if (!matchlen || + base[matchlen] == '/' || + match[matchlen - 1] == '/') + return 2; + + /* Just a random prefix match */ + continue; + } + + /* Does the base match? */ + if (strncmp(base, match, baselen)) + continue; + + match += baselen; + matchlen -= baselen; + + if (never_interesting) { + /* + * We have not seen any match that sorts later + * than the current path. + */ + + /* + * Does match sort strictly earlier than path + * with their common parts? + */ + m = strncmp(match, entry->path, + (matchlen < pathlen) ? matchlen : pathlen); + if (m < 0) + continue; + + /* + * If we come here even once, that means there is at + * least one pathspec that would sort equal to or + * later than the path we are currently looking at. + * In other words, if we have never reached this point + * after iterating all pathspecs, it means all + * pathspecs are either outside of base, or inside the + * base but sorts strictly earlier than the current + * one. In either case, they will never match the + * subsequent entries. In such a case, we initialized + * the variable to -1 and that is what will be + * returned, allowing the caller to terminate early. + */ + never_interesting = 0; + } + + if (pathlen > matchlen) + continue; + + if (matchlen > pathlen) { + if (match[pathlen] != '/') + continue; + if (!S_ISDIR(entry->mode)) + continue; + } + + if (m == -1) + /* + * we cheated and did not do strncmp(), so we do + * that here. + */ + m = strncmp(match, entry->path, pathlen); + + /* + * If common part matched earlier then it is a hit, + * because we rejected the case where path is not a + * leading directory and is shorter than match. + */ + if (!m) + return 1; + } + return never_interesting; /* No matches */ +} diff --git a/tree-walk.h b/tree-walk.h index 7e3e0b5..c12f0a2 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -60,4 +60,6 @@ static inline int traverse_path_len(const struct traverse_info *info, const stru return info->pathlen + tree_entry_len(n->path, n->sha1); } +extern int tree_entry_interesting(const struct name_entry *, const char *, int, const struct pathspec *ps); + #endif -- cgit v0.10.2-6-g49f6 From 3bd2bcfa982c69c0f5722c3dfe72b15cd0469d15 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 15 Dec 2010 22:02:41 +0700 Subject: glossary: define pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt index f04b48e..33716a3 100644 --- a/Documentation/glossary-content.txt +++ b/Documentation/glossary-content.txt @@ -273,6 +273,29 @@ This commit is referred to as a "merge commit", or sometimes just a <>, to assist in efficiently accessing the contents of a pack. +[[def_pathspec]]pathspec:: + Pattern used to specify paths. ++ +Pathspecs are used on the command line of "git ls-files", "git +ls-tree", "git grep", "git checkout", and many other commands to +limit the scope of operations to some subset of the tree or +worktree. See the documentation of each command for whether +paths are relative to the current directory or toplevel. The +pathspec syntax is as follows: + +* any path matches itself +* the pathspec up to the last slash represents a + directory prefix. The scope of that pathspec is + limited to that subtree. +* the rest of the pathspec is a pattern for the remainder + of the pathname. Paths relative to the directory + prefix will be matched against that pattern using fnmatch(3); + in particular, '*' and '?' _can_ match directory separators. ++ +For example, Documentation/*.jpg will match all .jpg files +in the Documentation subtree, +including Documentation/chapter_1/figure_1.jpg. + [[def_parent]]parent:: A <> contains a (possibly empty) list of the logical predecessor(s) in the line of development, i.e. its -- cgit v0.10.2-6-g49f6 From 48932677d62e426b3f26ac236384cb5195fb9dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:42 +0700 Subject: diff-tree: convert base+baselen to writable strbuf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In traversing trees, a full path is splitted into two parts: base directory and entry. They are however quite often concatenated whenever a full path is needed. Current code allocates a new buffer, do two memcpy(), use it, then release. Instead this patch turns "base" to a writable, extendable buffer. When a concatenation is needed, the callee only needs to append "entry" to base, use it, then truncate the entry out again. "base" must remain unchanged before and after entering a function. This avoids quite a bit of malloc() and memcpy(). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/tree-diff.c b/tree-diff.c index 23f4478..45a3845 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -6,34 +6,18 @@ #include "diffcore.h" #include "tree.h" -static char *malloc_base(const char *base, int baselen, const char *path, int pathlen) -{ - char *newbase = xmalloc(baselen + pathlen + 2); - memcpy(newbase, base, baselen); - memcpy(newbase + baselen, path, pathlen); - memcpy(newbase + baselen + pathlen, "/", 2); - return newbase; -} +static void show_entry(struct diff_options *opt, const char *prefix, + struct tree_desc *desc, struct strbuf *base); -static char *malloc_fullname(const char *base, int baselen, const char *path, int pathlen) -{ - char *fullname = xmalloc(baselen + pathlen + 1); - memcpy(fullname, base, baselen); - memcpy(fullname + baselen, path, pathlen); - fullname[baselen + pathlen] = 0; - return fullname; -} - -static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc, - const char *base, int baselen); - -static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const char *base, int baselen, struct diff_options *opt) +static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, + struct strbuf *base, struct diff_options *opt) { unsigned mode1, mode2; const char *path1, *path2; const unsigned char *sha1, *sha2; int cmp, pathlen1, pathlen2; - char *fullname; + int old_baselen = base->len; + int retval = 0; sha1 = tree_entry_extract(t1, &path1, &mode1); sha2 = tree_entry_extract(t2, &path2, &mode2); @@ -42,11 +26,11 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const pathlen2 = tree_entry_len(path2, sha2); cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2); if (cmp < 0) { - show_entry(opt, "-", t1, base, baselen); + show_entry(opt, "-", t1, base); return -1; } if (cmp > 0) { - show_entry(opt, "+", t2, base, baselen); + show_entry(opt, "+", t2, base); return 1; } if (!DIFF_OPT_TST(opt, FIND_COPIES_HARDER) && !hashcmp(sha1, sha2) && mode1 == mode2) @@ -57,33 +41,29 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const * file, we need to consider it a remove and an add. */ if (S_ISDIR(mode1) != S_ISDIR(mode2)) { - show_entry(opt, "-", t1, base, baselen); - show_entry(opt, "+", t2, base, baselen); + show_entry(opt, "-", t1, base); + show_entry(opt, "+", t2, base); return 0; } + strbuf_add(base, path1, pathlen1); if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode1)) { - int retval; - char *newbase = malloc_base(base, baselen, path1, pathlen1); if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) { - newbase[baselen + pathlen1] = 0; opt->change(opt, mode1, mode2, - sha1, sha2, newbase, 0, 0); - newbase[baselen + pathlen1] = '/'; + sha1, sha2, base->buf, 0, 0); } - retval = diff_tree_sha1(sha1, sha2, newbase, opt); - free(newbase); - return retval; + strbuf_addch(base, '/'); + retval = diff_tree_sha1(sha1, sha2, base->buf, opt); + } else { + opt->change(opt, mode1, mode2, sha1, sha2, base->buf, 0, 0); } - - fullname = malloc_fullname(base, baselen, path1, pathlen1); - opt->change(opt, mode1, mode2, sha1, sha2, fullname, 0, 0); - free(fullname); + strbuf_setlen(base, old_baselen); return 0; } /* A whole sub-tree went away or appeared */ -static void show_tree(struct diff_options *opt, const char *prefix, struct tree_desc *desc, const char *base, int baselen) +static void show_tree(struct diff_options *opt, const char *prefix, + struct tree_desc *desc, struct strbuf *base) { int all_interesting = 0; while (desc->size) { @@ -92,30 +72,32 @@ static void show_tree(struct diff_options *opt, const char *prefix, struct tree_ if (all_interesting) show = 1; else { - show = tree_entry_interesting(&desc->entry, base, baselen, &opt->pathspec); + show = tree_entry_interesting(&desc->entry, base, + &opt->pathspec); if (show == 2) all_interesting = 1; } if (show < 0) break; if (show) - show_entry(opt, prefix, desc, base, baselen); + show_entry(opt, prefix, desc, base); update_tree_entry(desc); } } /* A file entry went away or appeared */ -static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc, - const char *base, int baselen) +static void show_entry(struct diff_options *opt, const char *prefix, + struct tree_desc *desc, struct strbuf *base) { unsigned mode; const char *path; const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode); int pathlen = tree_entry_len(path, sha1); + int old_baselen = base->len; + strbuf_add(base, path, pathlen); if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) { enum object_type type; - char *newbase = malloc_base(base, baselen, path, pathlen); struct tree_desc inner; void *tree; unsigned long size; @@ -124,28 +106,25 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree if (!tree || type != OBJ_TREE) die("corrupt tree sha %s", sha1_to_hex(sha1)); - if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) { - newbase[baselen + pathlen] = 0; - opt->add_remove(opt, *prefix, mode, sha1, newbase, 0); - newbase[baselen + pathlen] = '/'; - } + if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) + opt->add_remove(opt, *prefix, mode, sha1, base->buf, 0); - init_tree_desc(&inner, tree, size); - show_tree(opt, prefix, &inner, newbase, baselen + 1 + pathlen); + strbuf_addch(base, '/'); + init_tree_desc(&inner, tree, size); + show_tree(opt, prefix, &inner, base); free(tree); - free(newbase); - } else { - char *fullname = malloc_fullname(base, baselen, path, pathlen); - opt->add_remove(opt, prefix[0], mode, sha1, fullname, 0); - free(fullname); - } + } else + opt->add_remove(opt, prefix[0], mode, sha1, base->buf, 0); + + strbuf_setlen(base, old_baselen); } -static void skip_uninteresting(struct tree_desc *t, const char *base, int baselen, struct diff_options *opt, int *all_interesting) +static void skip_uninteresting(struct tree_desc *t, struct strbuf *base, + struct diff_options *opt, int *all_interesting) { while (t->size) { - int show = tree_entry_interesting(&t->entry, base, baselen, &opt->pathspec); + int show = tree_entry_interesting(&t->entry, base, &opt->pathspec); if (show == 2) *all_interesting = 1; if (!show) { @@ -159,37 +138,40 @@ static void skip_uninteresting(struct tree_desc *t, const char *base, int basele } } -int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, struct diff_options *opt) +int diff_tree(struct tree_desc *t1, struct tree_desc *t2, + const char *base_str, struct diff_options *opt) { - int baselen = strlen(base); + struct strbuf base; + int baselen = strlen(base_str); int all_t1_interesting = 0; int all_t2_interesting = 0; + strbuf_init(&base, PATH_MAX); + strbuf_add(&base, base_str, baselen); + for (;;) { if (DIFF_OPT_TST(opt, QUICK) && DIFF_OPT_TST(opt, HAS_CHANGES)) break; if (opt->pathspec.nr) { if (!all_t1_interesting) - skip_uninteresting(t1, base, baselen, opt, - &all_t1_interesting); + skip_uninteresting(t1, &base, opt, &all_t1_interesting); if (!all_t2_interesting) - skip_uninteresting(t2, base, baselen, opt, - &all_t2_interesting); + skip_uninteresting(t2, &base, opt, &all_t2_interesting); } if (!t1->size) { if (!t2->size) break; - show_entry(opt, "+", t2, base, baselen); + show_entry(opt, "+", t2, &base); update_tree_entry(t2); continue; } if (!t2->size) { - show_entry(opt, "-", t1, base, baselen); + show_entry(opt, "-", t1, &base); update_tree_entry(t1); continue; } - switch (compare_tree_entry(t1, t2, base, baselen, opt)) { + switch (compare_tree_entry(t1, t2, &base, opt)) { case -1: update_tree_entry(t1); continue; @@ -202,6 +184,8 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru } die("git diff-tree: internal error"); } + + strbuf_release(&base); return 0; } diff --git a/tree-walk.c b/tree-walk.c index 522bb6b..21028d0 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -468,12 +468,13 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch * - negative for "no, and no subsequent entries will be either" */ int tree_entry_interesting(const struct name_entry *entry, - const char *base, int baselen, + const struct strbuf *base_buf, const struct pathspec *ps) { int i; - int pathlen; + int pathlen, baselen = base_buf->len; int never_interesting = -1; + const char *base = base_buf->buf; if (!ps || !ps->nr) return 2; diff --git a/tree-walk.h b/tree-walk.h index c12f0a2..f81c232 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -60,6 +60,6 @@ static inline int traverse_path_len(const struct traverse_info *info, const stru return info->pathlen + tree_entry_len(n->path, n->sha1); } -extern int tree_entry_interesting(const struct name_entry *, const char *, int, const struct pathspec *ps); +extern int tree_entry_interesting(const struct name_entry *, const struct strbuf *, const struct pathspec *ps); #endif -- cgit v0.10.2-6-g49f6 From 58c4d66619eb21fa23a1305401e0ec4988c1c17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:43 +0700 Subject: tree_entry_interesting(): refactor into separate smaller functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/tree-walk.c b/tree-walk.c index 21028d0..83bede9 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -456,6 +456,90 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch return retval; } +static int match_entry(const struct name_entry *entry, int pathlen, + const char *match, int matchlen, + int *never_interesting) +{ + int m = -1; /* signals that we haven't called strncmp() */ + + if (*never_interesting) { + /* + * We have not seen any match that sorts later + * than the current path. + */ + + /* + * Does match sort strictly earlier than path + * with their common parts? + */ + m = strncmp(match, entry->path, + (matchlen < pathlen) ? matchlen : pathlen); + if (m < 0) + return 0; + + /* + * If we come here even once, that means there is at + * least one pathspec that would sort equal to or + * later than the path we are currently looking at. + * In other words, if we have never reached this point + * after iterating all pathspecs, it means all + * pathspecs are either outside of base, or inside the + * base but sorts strictly earlier than the current + * one. In either case, they will never match the + * subsequent entries. In such a case, we initialized + * the variable to -1 and that is what will be + * returned, allowing the caller to terminate early. + */ + *never_interesting = 0; + } + + if (pathlen > matchlen) + return 0; + + if (matchlen > pathlen) { + if (match[pathlen] != '/') + return 0; + if (!S_ISDIR(entry->mode)) + return 0; + } + + if (m == -1) + /* + * we cheated and did not do strncmp(), so we do + * that here. + */ + m = strncmp(match, entry->path, pathlen); + + /* + * If common part matched earlier then it is a hit, + * because we rejected the case where path is not a + * leading directory and is shorter than match. + */ + if (!m) + return 1; + + return 0; +} + +static int match_dir_prefix(const char *base, int baselen, + const char *match, int matchlen) +{ + if (strncmp(base, match, matchlen)) + return 0; + + /* + * If the base is a subdirectory of a path which + * was specified, all of them are interesting. + */ + if (!matchlen || + base[matchlen] == '/' || + match[matchlen - 1] == '/') + return 1; + + /* Just a random prefix match */ + return 0; +} + /* * Is a tree entry interesting given the pathspec we have? * @@ -468,13 +552,12 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch * - negative for "no, and no subsequent entries will be either" */ int tree_entry_interesting(const struct name_entry *entry, - const struct strbuf *base_buf, + const struct strbuf *base, const struct pathspec *ps) { int i; - int pathlen, baselen = base_buf->len; + int pathlen, baselen = base->len; int never_interesting = -1; - const char *base = base_buf->buf; if (!ps || !ps->nr) return 2; @@ -485,88 +568,21 @@ int tree_entry_interesting(const struct name_entry *entry, const struct pathspec_item *item = ps->items+i; const char *match = item->match; int matchlen = item->len; - int m = -1; /* signals that we haven't called strncmp() */ if (baselen >= matchlen) { /* If it doesn't match, move along... */ - if (strncmp(base, match, matchlen)) + if (!match_dir_prefix(base->buf, baselen, match, matchlen)) continue; - - /* - * If the base is a subdirectory of a path which - * was specified, all of them are interesting. - */ - if (!matchlen || - base[matchlen] == '/' || - match[matchlen - 1] == '/') - return 2; - - /* Just a random prefix match */ - continue; + return 2; } /* Does the base match? */ - if (strncmp(base, match, baselen)) - continue; - - match += baselen; - matchlen -= baselen; - - if (never_interesting) { - /* - * We have not seen any match that sorts later - * than the current path. - */ - - /* - * Does match sort strictly earlier than path - * with their common parts? - */ - m = strncmp(match, entry->path, - (matchlen < pathlen) ? matchlen : pathlen); - if (m < 0) - continue; - - /* - * If we come here even once, that means there is at - * least one pathspec that would sort equal to or - * later than the path we are currently looking at. - * In other words, if we have never reached this point - * after iterating all pathspecs, it means all - * pathspecs are either outside of base, or inside the - * base but sorts strictly earlier than the current - * one. In either case, they will never match the - * subsequent entries. In such a case, we initialized - * the variable to -1 and that is what will be - * returned, allowing the caller to terminate early. - */ - never_interesting = 0; + if (!strncmp(base->buf, match, baselen)) { + if (match_entry(entry, pathlen, + match + baselen, matchlen - baselen, + &never_interesting)) + return 1; } - - if (pathlen > matchlen) - continue; - - if (matchlen > pathlen) { - if (match[pathlen] != '/') - continue; - if (!S_ISDIR(entry->mode)) - continue; - } - - if (m == -1) - /* - * we cheated and did not do strncmp(), so we do - * that here. - */ - m = strncmp(match, entry->path, pathlen); - - /* - * If common part matched earlier then it is a hit, - * because we rejected the case where path is not a - * leading directory and is shorter than match. - */ - if (!m) - return 1; } return never_interesting; /* No matches */ } -- cgit v0.10.2-6-g49f6 From bc96cc87dbb229cbdabfd93391e24ef168713a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:44 +0700 Subject: tree_entry_interesting(): support depth limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed to replace pathspec_matches() in builtin/grep.c. max_depth == -1 means infinite depth. Depth limit is only effective when pathspec.recursive == 1. When pathspec.recursive == 0, the behavior depends on match functions: non-recursive for tree_entry_interesting() and recursive for match_pathspec{,_depth} Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/cache.h b/cache.h index a645614..0cf0bac 100644 --- a/cache.h +++ b/cache.h @@ -503,6 +503,8 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct struct pathspec { const char **raw; /* get_pathspec() result, not freed by free_pathspec() */ int nr; + int recursive:1; + int max_depth; struct pathspec_item { const char *match; int len; diff --git a/dir.c b/dir.c index 70d10bc..c3bddb6 100644 --- a/dir.c +++ b/dir.c @@ -87,6 +87,21 @@ int fill_directory(struct dir_struct *dir, const char **pathspec) return len; } +int within_depth(const char *name, int namelen, + int depth, int max_depth) +{ + const char *cp = name, *cpe = name + namelen; + + while (cp < cpe) { + if (*cp++ != '/') + continue; + depth++; + if (depth > max_depth) + return 0; + } + return 1; +} + /* * Does 'match' match the given name? * A match is found if diff --git a/dir.h b/dir.h index 72a764e..5fa3fbe 100644 --- a/dir.h +++ b/dir.h @@ -65,6 +65,7 @@ struct dir_struct { #define MATCHED_FNMATCH 2 #define MATCHED_EXACTLY 3 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen); +extern int within_depth(const char *name, int namelen, int depth, int max_depth); extern int fill_directory(struct dir_struct *dir, const char **pathspec); extern int read_directory(struct dir_struct *, const char *path, int len, const char **pathspec); diff --git a/tree-diff.c b/tree-diff.c index 45a3845..03dc5c8 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -146,6 +146,10 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, int all_t1_interesting = 0; int all_t2_interesting = 0; + /* Enable recursion indefinitely */ + opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE); + opt->pathspec.max_depth = -1; + strbuf_init(&base, PATH_MAX); strbuf_add(&base, base_str, baselen); diff --git a/tree-walk.c b/tree-walk.c index 83bede9..33feafa 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -1,6 +1,7 @@ #include "cache.h" #include "tree-walk.h" #include "unpack-trees.h" +#include "dir.h" #include "tree.h" static const char *get_mode(const char *str, unsigned int *modep) @@ -559,8 +560,13 @@ int tree_entry_interesting(const struct name_entry *entry, int pathlen, baselen = base->len; int never_interesting = -1; - if (!ps || !ps->nr) - return 2; + if (!ps->nr) { + if (!ps->recursive || ps->max_depth == -1) + return 2; + return !!within_depth(base->buf, baselen, + !!S_ISDIR(entry->mode), + ps->max_depth); + } pathlen = tree_entry_len(entry->path, entry->sha1); @@ -573,7 +579,14 @@ int tree_entry_interesting(const struct name_entry *entry, /* If it doesn't match, move along... */ if (!match_dir_prefix(base->buf, baselen, match, matchlen)) continue; - return 2; + + if (!ps->recursive || ps->max_depth == -1) + return 2; + + return !!within_depth(base->buf + matchlen + 1, + baselen - matchlen - 1, + !!S_ISDIR(entry->mode), + ps->max_depth); } /* Does the base match? */ -- cgit v0.10.2-6-g49f6 From 86e4ca69e358836599d4eb0c0e217caa9c9e455b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:45 +0700 Subject: tree_entry_interesting(): fix depth limit with overlapping pathspecs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suppose we have two pathspecs 'a' and 'a/b' (both are dirs) and depth limit 1. In current code, pathspecs are checked in input order. When 'a/b' is checked against pathspec 'a', it fails depth limit and therefore is excluded, although it should match 'a/b' pathspec. This patch reorders all pathspecs alphabetically, then teaches tree_entry_interesting() to check against the deepest pathspec first, so depth limit of a shallower pathspec won't affect a deeper one. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/dir.c b/dir.c index c3bddb6..5b4e2b1 100644 --- a/dir.c +++ b/dir.c @@ -1166,6 +1166,15 @@ int remove_path(const char *name) return 0; } +static int pathspec_item_cmp(const void *a_, const void *b_) +{ + struct pathspec_item *a, *b; + + a = (struct pathspec_item *)a_; + b = (struct pathspec_item *)b_; + return strcmp(a->match, b->match); +} + int init_pathspec(struct pathspec *pathspec, const char **paths) { const char **p = paths; @@ -1189,6 +1198,10 @@ int init_pathspec(struct pathspec *pathspec, const char **paths) item->match = path; item->len = strlen(path); } + + qsort(pathspec->items, pathspec->nr, + sizeof(struct pathspec_item), pathspec_item_cmp); + return 0; } diff --git a/tree-walk.c b/tree-walk.c index 33feafa..be8182c 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -570,7 +570,7 @@ int tree_entry_interesting(const struct name_entry *entry, pathlen = tree_entry_len(entry->path, entry->sha1); - for (i = 0; i < ps->nr; i++) { + for (i = ps->nr-1; i >= 0; i--) { const struct pathspec_item *item = ps->items+i; const char *match = item->match; int matchlen = item->len; -- cgit v0.10.2-6-g49f6 From d38f28093ef795bef13d2fda6621b4952afb42db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:46 +0700 Subject: tree_entry_interesting(): support wildcard matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit never_interesting optimization is disabled if there is any wildcard pathspec, even if it only matches exactly on trees. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/cache.h b/cache.h index 0cf0bac..800efa2 100644 --- a/cache.h +++ b/cache.h @@ -503,11 +503,13 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct struct pathspec { const char **raw; /* get_pathspec() result, not freed by free_pathspec() */ int nr; + int has_wildcard:1; int recursive:1; int max_depth; struct pathspec_item { const char *match; int len; + int has_wildcard:1; } *items; }; diff --git a/dir.c b/dir.c index 5b4e2b1..b6ccaf3 100644 --- a/dir.c +++ b/dir.c @@ -1197,6 +1197,9 @@ int init_pathspec(struct pathspec *pathspec, const char **paths) item->match = path; item->len = strlen(path); + item->has_wildcard = !no_wildcard(path); + if (item->has_wildcard) + pathspec->has_wildcard = 1; } qsort(pathspec->items, pathspec->nr, diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 94df7ae..4b120f8 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -70,4 +70,18 @@ test_expect_success 'diff-tree pathspec' ' test_cmp expected current ' +EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904 + +test_expect_success 'diff-tree with wildcard shows dir also matches' ' + git diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result && + echo file0 >expected && + test_cmp expected result +' + +test_expect_success 'diff-tree -r with wildcard' ' + git diff-tree -r --name-only $EMPTY_TREE $tree -- "*file1" >result && + echo path1/file1 >expected && + test_cmp expected result +' + test_done diff --git a/tree-walk.c b/tree-walk.c index be8182c..ae7ac1a 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -553,12 +553,12 @@ static int match_dir_prefix(const char *base, int baselen, * - negative for "no, and no subsequent entries will be either" */ int tree_entry_interesting(const struct name_entry *entry, - const struct strbuf *base, + struct strbuf *base, const struct pathspec *ps) { int i; int pathlen, baselen = base->len; - int never_interesting = -1; + int never_interesting = ps->has_wildcard ? 0 : -1; if (!ps->nr) { if (!ps->recursive || ps->max_depth == -1) @@ -578,7 +578,7 @@ int tree_entry_interesting(const struct name_entry *entry, if (baselen >= matchlen) { /* If it doesn't match, move along... */ if (!match_dir_prefix(base->buf, baselen, match, matchlen)) - continue; + goto match_wildcards; if (!ps->recursive || ps->max_depth == -1) return 2; @@ -596,6 +596,30 @@ int tree_entry_interesting(const struct name_entry *entry, &never_interesting)) return 1; } + +match_wildcards: + if (!ps->items[i].has_wildcard) + continue; + + /* + * Concatenate base and entry->path into one and do + * fnmatch() on it. + */ + + strbuf_add(base, entry->path, pathlen); + + if (!fnmatch(match, base->buf, 0)) { + strbuf_setlen(base, baselen); + return 1; + } + strbuf_setlen(base, baselen); + + /* + * Match all directories. We'll try to match files + * later on. + */ + if (ps->recursive && S_ISDIR(entry->mode)) + return 1; } return never_interesting; /* No matches */ } diff --git a/tree-walk.h b/tree-walk.h index f81c232..6589ee2 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -60,6 +60,6 @@ static inline int traverse_path_len(const struct traverse_info *info, const stru return info->pathlen + tree_entry_len(n->path, n->sha1); } -extern int tree_entry_interesting(const struct name_entry *, const struct strbuf *, const struct pathspec *ps); +extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, const struct pathspec *ps); #endif -- cgit v0.10.2-6-g49f6 From f1a2ddbbc2df4e81e005a7e82f9e23fb6a9f95e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:47 +0700 Subject: tree_entry_interesting(): optimize wildcard matching when base is matched MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If base is already matched, skip that part when calling fnmatch(). This happens quite often if users start a command from worktree's subdirectory and prefix is usually prepended to all pathspecs. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 4b120f8..fbc8cd8 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -84,4 +84,22 @@ test_expect_success 'diff-tree -r with wildcard' ' test_cmp expected result ' +test_expect_success 'diff-tree with wildcard shows dir also matches' ' + git diff-tree --name-only $tree $tree2 -- "path1/f*" >result && + echo path1 >expected && + test_cmp expected result +' + +test_expect_success 'diff-tree -r with wildcard from beginning' ' + git diff-tree -r --name-only $tree $tree2 -- "path1/*file1" >result && + echo path1/file1 >expected && + test_cmp expected result +' + +test_expect_success 'diff-tree -r with wildcard' ' + git diff-tree -r --name-only $tree $tree2 -- "path1/f*" >result && + echo path1/file1 >expected && + test_cmp expected result +' + test_done diff --git a/tree-walk.c b/tree-walk.c index ae7ac1a..7596716 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -595,6 +595,20 @@ int tree_entry_interesting(const struct name_entry *entry, match + baselen, matchlen - baselen, &never_interesting)) return 1; + + if (ps->items[i].has_wildcard) { + if (!fnmatch(match + baselen, entry->path, 0)) + return 1; + + /* + * Match all directories. We'll try to + * match files later on. + */ + if (ps->recursive && S_ISDIR(entry->mode)) + return 1; + } + + continue; } match_wildcards: -- cgit v0.10.2-6-g49f6 From 61cf28204508c095a68e7a9cb6307ca2a27112c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:48 +0700 Subject: pathspec: add match_pathspec_depth() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit match_pathspec_depth() is a clone of match_pathspec() except that it can take depth limit. Computation is a bit lighter compared to match_pathspec() because it's usually precomputed and stored in struct pathspec. In long term, match_pathspec() and match_one() should be removed in favor of this function. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/dir.c b/dir.c index b6ccaf3..168dad6 100644 --- a/dir.c +++ b/dir.c @@ -199,6 +199,95 @@ int match_pathspec(const char **pathspec, const char *name, int namelen, return retval; } +/* + * Does 'match' match the given name? + * A match is found if + * + * (1) the 'match' string is leading directory of 'name', or + * (2) the 'match' string is a wildcard and matches 'name', or + * (3) the 'match' string is exactly the same as 'name'. + * + * and the return value tells which case it was. + * + * It returns 0 when there is no match. + */ +static int match_pathspec_item(const struct pathspec_item *item, int prefix, + const char *name, int namelen) +{ + /* name/namelen has prefix cut off by caller */ + const char *match = item->match + prefix; + int matchlen = item->len - prefix; + + /* If the match was just the prefix, we matched */ + if (!*match) + return MATCHED_RECURSIVELY; + + if (matchlen <= namelen && !strncmp(match, name, matchlen)) { + if (matchlen == namelen) + return MATCHED_EXACTLY; + + if (match[matchlen-1] == '/' || name[matchlen] == '/') + return MATCHED_RECURSIVELY; + } + + if (item->has_wildcard && !fnmatch(match, name, 0)) + return MATCHED_FNMATCH; + + return 0; +} + +/* + * Given a name and a list of pathspecs, see if the name matches + * any of the pathspecs. The caller is also interested in seeing + * all pathspec matches some names it calls this function with + * (otherwise the user could have mistyped the unmatched pathspec), + * and a mark is left in seen[] array for pathspec element that + * actually matched anything. + */ +int match_pathspec_depth(const struct pathspec *ps, + const char *name, int namelen, + int prefix, char *seen) +{ + int i, retval = 0; + + if (!ps->nr) { + if (!ps->recursive || ps->max_depth == -1) + return MATCHED_RECURSIVELY; + + if (within_depth(name, namelen, 0, ps->max_depth)) + return MATCHED_EXACTLY; + else + return 0; + } + + name += prefix; + namelen -= prefix; + + for (i = ps->nr - 1; i >= 0; i--) { + int how; + if (seen && seen[i] == MATCHED_EXACTLY) + continue; + how = match_pathspec_item(ps->items+i, prefix, name, namelen); + if (ps->recursive && ps->max_depth != -1 && + how && how != MATCHED_FNMATCH) { + int len = ps->items[i].len; + if (name[len] == '/') + len++; + if (within_depth(name+len, namelen-len, 0, ps->max_depth)) + how = MATCHED_EXACTLY; + else + how = 0; + } + if (how) { + if (retval < how) + retval = how; + if (seen && seen[i] < how) + seen[i] = how; + } + } + return retval; +} + static int no_wildcard(const char *string) { return string[strcspn(string, "*?[{\\")] == '\0'; diff --git a/dir.h b/dir.h index 5fa3fbe..aa511da 100644 --- a/dir.h +++ b/dir.h @@ -65,6 +65,9 @@ struct dir_struct { #define MATCHED_FNMATCH 2 #define MATCHED_EXACTLY 3 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen); +extern int match_pathspec_depth(const struct pathspec *pathspec, + const char *name, int namelen, + int prefix, char *seen); extern int within_depth(const char *name, int namelen, int depth, int max_depth); extern int fill_directory(struct dir_struct *dir, const char **pathspec); -- cgit v0.10.2-6-g49f6 From afe069d16618190a6f7e84ef8451970e274aedb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 17 Dec 2010 19:43:06 +0700 Subject: struct rev_info: convert prune_data to struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/add.c b/builtin/add.c index 12b964e..5f817ad 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -86,7 +86,7 @@ int add_files_to_cache(const char *prefix, const char **pathspec, int flags) struct rev_info rev; init_revisions(&rev, prefix); setup_revisions(0, NULL, &rev, NULL); - rev.prune_data = pathspec; + init_pathspec(&rev.prune_data, pathspec); rev.diffopt.output_format = DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = update_callback; data.flags = flags; diff --git a/builtin/diff.c b/builtin/diff.c index a08c324..d12de8f 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -371,14 +371,10 @@ int cmd_diff(int argc, const char **argv, const char *prefix) } die("unhandled object '%s' given.", name); } - if (rev.prune_data) { - const char **pathspec = rev.prune_data; - while (*pathspec) { - if (!path) - path = *pathspec; - paths++; - pathspec++; - } + if (rev.prune_data.nr) { + if (!path) + path = rev.prune_data.items[0].match; + paths += rev.prune_data.nr; } /* diff --git a/builtin/fast-export.c b/builtin/fast-export.c index c8fd46b..ba57457 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -651,7 +651,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) if (import_filename) import_marks(import_filename); - if (import_filename && revs.prune_data) + if (import_filename && revs.prune_data.nr) full_tree = 1; get_tags_and_duplicates(&revs.pending, &extra_refs); diff --git a/diff-lib.c b/diff-lib.c index 3b809f2..2251f3d 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -106,7 +106,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES)) break; - if (!ce_path_match(ce, revs->prune_data)) + if (!ce_path_match(ce, revs->prune_data.raw)) continue; if (ce_stage(ce)) { @@ -427,7 +427,7 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o) if (tree == o->df_conflict_entry) tree = NULL; - if (ce_path_match(idx ? idx : tree, revs->prune_data)) + if (ce_path_match(idx ? idx : tree, revs->prune_data.raw)) do_oneway_diff(o, idx, tree); return 0; @@ -501,7 +501,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt) active_nr = dst - active_cache; init_revisions(&revs, NULL); - revs.prune_data = opt->pathspec.raw; + init_pathspec(&revs.prune_data, opt->pathspec.raw); tree = parse_tree_indirect(tree_sha1); if (!tree) die("bad tree object %s", sha1_to_hex(tree_sha1)); diff --git a/revision.c b/revision.c index 0c511aa..bf87e01 100644 --- a/revision.c +++ b/revision.c @@ -323,7 +323,7 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct * tagged commit by specifying both --simplify-by-decoration * and pathspec. */ - if (!revs->prune_data) + if (!revs->prune_data.nr) return REV_TREE_SAME; } @@ -969,7 +969,7 @@ static void prepare_show_merge(struct rev_info *revs) struct cache_entry *ce = active_cache[i]; if (!ce_stage(ce)) continue; - if (ce_path_match(ce, revs->prune_data)) { + if (ce_path_match(ce, revs->prune_data.raw)) { prune_num++; prune = xrealloc(prune, sizeof(*prune) * prune_num); prune[prune_num-2] = ce->name; @@ -979,7 +979,8 @@ static void prepare_show_merge(struct rev_info *revs) ce_same_name(ce, active_cache[i+1])) i++; } - revs->prune_data = prune; + free_pathspec(&revs->prune_data); + init_pathspec(&revs->prune_data, prune); revs->limited = 1; } @@ -1616,7 +1617,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s } if (prune_data) - revs->prune_data = get_pathspec(revs->prefix, prune_data); + init_pathspec(&revs->prune_data, get_pathspec(revs->prefix, prune_data)); if (revs->def == NULL) revs->def = opt ? opt->def : NULL; @@ -1647,13 +1648,13 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s if (revs->topo_order) revs->limited = 1; - if (revs->prune_data) { - diff_tree_setup_paths(revs->prune_data, &revs->pruning); + if (revs->prune_data.nr) { + diff_tree_setup_paths(revs->prune_data.raw, &revs->pruning); /* Can't prune commits with rename following: the paths change.. */ if (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES)) revs->prune = 1; if (!revs->full_diff) - diff_tree_setup_paths(revs->prune_data, &revs->diffopt); + diff_tree_setup_paths(revs->prune_data.raw, &revs->diffopt); } if (revs->combine_merges) revs->ignore_merges = 0; diff --git a/revision.h b/revision.h index 05659c6..82509dd 100644 --- a/revision.h +++ b/revision.h @@ -34,7 +34,7 @@ struct rev_info { /* Basic information */ const char *prefix; const char *def; - void *prune_data; + struct pathspec prune_data; unsigned int early_output; /* Traversal flags */ diff --git a/wt-status.c b/wt-status.c index 123582b..1ea330e 100644 --- a/wt-status.c +++ b/wt-status.c @@ -323,7 +323,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s) } rev.diffopt.format_callback = wt_status_collect_changed_cb; rev.diffopt.format_callback_data = s; - rev.prune_data = s->pathspec; + init_pathspec(&rev.prune_data, s->pathspec); run_diff_files(&rev, 0); } @@ -348,7 +348,7 @@ static void wt_status_collect_changes_index(struct wt_status *s) rev.diffopt.detect_rename = 1; rev.diffopt.rename_limit = 200; rev.diffopt.break_opt = 0; - rev.prune_data = s->pathspec; + init_pathspec(&rev.prune_data, s->pathspec); run_diff_index(&rev, 1); } -- cgit v0.10.2-6-g49f6 From eb9cb55b944796374402ab4e2639300dc9b0b409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 17 Dec 2010 19:43:07 +0700 Subject: Convert ce_path_match() to use struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/update-index.c b/builtin/update-index.c index 56baf27..d7850c6 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -546,7 +546,10 @@ static int do_reupdate(int ac, const char **av, */ int pos; int has_head = 1; - const char **pathspec = get_pathspec(prefix, av + 1); + const char **paths = get_pathspec(prefix, av + 1); + struct pathspec pathspec; + + init_pathspec(&pathspec, paths); if (read_ref("HEAD", head_sha1)) /* If there is no HEAD, that means it is an initial @@ -559,7 +562,7 @@ static int do_reupdate(int ac, const char **av, struct cache_entry *old = NULL; int save_nr; - if (ce_stage(ce) || !ce_path_match(ce, pathspec)) + if (ce_stage(ce) || !ce_path_match(ce, &pathspec)) continue; if (has_head) old = read_one_ent(NULL, head_sha1, @@ -578,6 +581,7 @@ static int do_reupdate(int ac, const char **av, if (save_nr != active_nr) goto redo; } + free_pathspec(&pathspec); return 0; } diff --git a/cache.h b/cache.h index 800efa2..4beb2dc 100644 --- a/cache.h +++ b/cache.h @@ -515,7 +515,7 @@ struct pathspec { extern int init_pathspec(struct pathspec *, const char **); extern void free_pathspec(struct pathspec *); -extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); +extern int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec); extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); diff --git a/diff-lib.c b/diff-lib.c index 2251f3d..1e22992 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -106,7 +106,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES)) break; - if (!ce_path_match(ce, revs->prune_data.raw)) + if (!ce_path_match(ce, &revs->prune_data)) continue; if (ce_stage(ce)) { @@ -427,7 +427,7 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o) if (tree == o->df_conflict_entry) tree = NULL; - if (ce_path_match(idx ? idx : tree, revs->prune_data.raw)) + if (ce_path_match(idx ? idx : tree, &revs->prune_data)) do_oneway_diff(o, idx, tree); return 0; diff --git a/preload-index.c b/preload-index.c index e3d0bda..49cb08d 100644 --- a/preload-index.c +++ b/preload-index.c @@ -35,7 +35,9 @@ static void *preload_thread(void *_data) struct index_state *index = p->index; struct cache_entry **cep = index->cache + p->offset; struct cache_def cache; + struct pathspec pathspec; + init_pathspec(&pathspec, p->pathspec); memset(&cache, 0, sizeof(cache)); nr = p->nr; if (nr + p->offset > index->cache_nr) @@ -51,7 +53,7 @@ static void *preload_thread(void *_data) continue; if (ce_uptodate(ce)) continue; - if (!ce_path_match(ce, p->pathspec)) + if (!ce_path_match(ce, &pathspec)) continue; if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce))) continue; @@ -61,6 +63,7 @@ static void *preload_thread(void *_data) continue; ce_mark_uptodate(ce); } while (--nr > 0); + free_pathspec(&pathspec); return NULL; } diff --git a/read-cache.c b/read-cache.c index 4f2e890..8b2d537 100644 --- a/read-cache.c +++ b/read-cache.c @@ -706,17 +706,18 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b) return ce_namelen(b) == len && !memcmp(a->name, b->name, len); } -int ce_path_match(const struct cache_entry *ce, const char **pathspec) +int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec) { const char *match, *name; + const char **ps = pathspec->raw; int len; - if (!pathspec) + if (!pathspec->nr) return 1; len = ce_namelen(ce); name = ce->name; - while ((match = *pathspec++) != NULL) { + while ((match = *ps++) != NULL) { int matchlen = strlen(match); if (matchlen > len) continue; diff --git a/revision.c b/revision.c index bf87e01..86d2470 100644 --- a/revision.c +++ b/revision.c @@ -969,7 +969,7 @@ static void prepare_show_merge(struct rev_info *revs) struct cache_entry *ce = active_cache[i]; if (!ce_stage(ce)) continue; - if (ce_path_match(ce, revs->prune_data.raw)) { + if (ce_path_match(ce, &revs->prune_data)) { prune_num++; prune = xrealloc(prune, sizeof(*prune) * prune_num); prune[prune_num-2] = ce->name; diff --git a/wt-status.c b/wt-status.c index 1ea330e..a82b11d 100644 --- a/wt-status.c +++ b/wt-status.c @@ -354,14 +354,16 @@ static void wt_status_collect_changes_index(struct wt_status *s) static void wt_status_collect_changes_initial(struct wt_status *s) { + struct pathspec pathspec; int i; + init_pathspec(&pathspec, s->pathspec); for (i = 0; i < active_nr; i++) { struct string_list_item *it; struct wt_status_change_data *d; struct cache_entry *ce = active_cache[i]; - if (!ce_path_match(ce, s->pathspec)) + if (!ce_path_match(ce, &pathspec)) continue; it = string_list_insert(&s->change, ce->name); d = it->util; @@ -376,6 +378,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s) else d->index_status = DIFF_STATUS_ADDED; } + free_pathspec(&pathspec); } static void wt_status_collect_untracked(struct wt_status *s) -- cgit v0.10.2-6-g49f6 From 898bbd9fb4c749afbddcb8a6b68a64b394366e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:50 +0700 Subject: Convert ce_path_match() to use match_pathspec_depth() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/read-cache.c b/read-cache.c index 8b2d537..7772079 100644 --- a/read-cache.c +++ b/read-cache.c @@ -708,29 +708,7 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b) int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec) { - const char *match, *name; - const char **ps = pathspec->raw; - int len; - - if (!pathspec->nr) - return 1; - - len = ce_namelen(ce); - name = ce->name; - while ((match = *ps++) != NULL) { - int matchlen = strlen(match); - if (matchlen > len) - continue; - if (memcmp(name, match, matchlen)) - continue; - if (matchlen && name[matchlen-1] == '/') - return 1; - if (name[matchlen] == '/' || !name[matchlen]) - return 1; - if (!matchlen) - return 1; - } - return 0; + return match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL); } /* -- cgit v0.10.2-6-g49f6 From f34bbc15ce0749a3e9f749f0fef6c486e1482719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:51 +0700 Subject: grep: convert to use struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/grep.c b/builtin/grep.c index fdf7131..ad9ec4a 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -581,7 +581,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix) free(argv); } -static int grep_cache(struct grep_opt *opt, const char **paths, int cached) +static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int cached) { int hit = 0; int nr; @@ -591,7 +591,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached) struct cache_entry *ce = active_cache[nr]; if (!S_ISREG(ce->ce_mode)) continue; - if (!pathspec_matches(paths, ce->name, opt->max_depth)) + if (!pathspec_matches(pathspec->raw, ce->name, opt->max_depth)) continue; /* * If CE_VALID is on, we assume worktree file and its cache entry @@ -618,7 +618,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached) return hit; } -static int grep_tree(struct grep_opt *opt, const char **paths, +static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, struct tree_desc *tree, const char *tree_name, const char *base) { @@ -652,7 +652,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths, strbuf_addch(&pathbuf, '/'); down = pathbuf.buf + tn_len; - if (!pathspec_matches(paths, down, opt->max_depth)) + if (!pathspec_matches(pathspec->raw, down, opt->max_depth)) ; else if (S_ISREG(entry.mode)) hit |= grep_sha1(opt, entry.sha1, pathbuf.buf, tn_len); @@ -667,7 +667,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths, die("unable to read tree (%s)", sha1_to_hex(entry.sha1)); init_tree_desc(&sub, data, size); - hit |= grep_tree(opt, paths, &sub, tree_name, down); + hit |= grep_tree(opt, pathspec, &sub, tree_name, down); free(data); } if (hit && opt->status_only) @@ -677,7 +677,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths, return hit; } -static int grep_object(struct grep_opt *opt, const char **paths, +static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, struct object *obj, const char *name) { if (obj->type == OBJ_BLOB) @@ -692,14 +692,14 @@ static int grep_object(struct grep_opt *opt, const char **paths, if (!data) die("unable to read tree (%s)", sha1_to_hex(obj->sha1)); init_tree_desc(&tree, data, size); - hit = grep_tree(opt, paths, &tree, name, ""); + hit = grep_tree(opt, pathspec, &tree, name, ""); free(data); return hit; } die("unable to grep from object of type %s", typename(obj->type)); } -static int grep_objects(struct grep_opt *opt, const char **paths, +static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, const struct object_array *list) { unsigned int i; @@ -709,7 +709,7 @@ static int grep_objects(struct grep_opt *opt, const char **paths, for (i = 0; i < nr; i++) { struct object *real_obj; real_obj = deref_tag(list->objects[i].item, NULL, 0); - if (grep_object(opt, paths, real_obj, list->objects[i].name)) { + if (grep_object(opt, pathspec, real_obj, list->objects[i].name)) { hit = 1; if (opt->status_only) break; @@ -718,7 +718,7 @@ static int grep_objects(struct grep_opt *opt, const char **paths, return hit; } -static int grep_directory(struct grep_opt *opt, const char **paths) +static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec) { struct dir_struct dir; int i, hit = 0; @@ -726,7 +726,7 @@ static int grep_directory(struct grep_opt *opt, const char **paths) memset(&dir, 0, sizeof(dir)); setup_standard_excludes(&dir); - fill_directory(&dir, paths); + fill_directory(&dir, pathspec->raw); for (i = 0; i < dir.nr; i++) { hit |= grep_file(opt, dir.entries[i]->name); if (hit && opt->status_only) @@ -832,6 +832,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) struct grep_opt opt; struct object_array list = OBJECT_ARRAY_INIT; const char **paths = NULL; + struct pathspec pathspec; struct string_list path_list = STRING_LIST_INIT_NODUP; int i; int dummy; @@ -1059,6 +1060,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) paths[0] = prefix; paths[1] = NULL; } + init_pathspec(&pathspec, paths); if (show_in_pager && (cached || list.nr)) die("--open-files-in-pager only works on the worktree"); @@ -1089,16 +1091,16 @@ int cmd_grep(int argc, const char **argv, const char *prefix) die("--cached cannot be used with --no-index."); if (list.nr) die("--no-index cannot be used with revs."); - hit = grep_directory(&opt, paths); + hit = grep_directory(&opt, &pathspec); } else if (!list.nr) { if (!cached) setup_work_tree(); - hit = grep_cache(&opt, paths, cached); + hit = grep_cache(&opt, &pathspec, cached); } else { if (cached) die("both --cached and trees are given."); - hit = grep_objects(&opt, paths, &list); + hit = grep_objects(&opt, &pathspec, &list); } if (use_threads) -- cgit v0.10.2-6-g49f6 From 2ed2437a143391c9e882318874905c964f313977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:52 +0700 Subject: grep: use match_pathspec_depth() for cache/worktree grepping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/grep.c b/builtin/grep.c index ad9ec4a..16a2fde 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -591,7 +591,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int struct cache_entry *ce = active_cache[nr]; if (!S_ISREG(ce->ce_mode)) continue; - if (!pathspec_matches(pathspec->raw, ce->name, opt->max_depth)) + if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL)) continue; /* * If CE_VALID is on, we assume worktree file and its cache entry -- cgit v0.10.2-6-g49f6 From e5e062b6dcdbbc338a0501b97a35e2e5efa56075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 17 Dec 2010 19:44:25 +0700 Subject: grep: use writable strbuf from caller for grep_tree() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/grep.c b/builtin/grep.c index 16a2fde..c9622d6 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -619,43 +619,29 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int } static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, - struct tree_desc *tree, - const char *tree_name, const char *base) + struct tree_desc *tree, struct strbuf *base, int tn_len) { - int len; int hit = 0; struct name_entry entry; - char *down; - int tn_len = strlen(tree_name); - struct strbuf pathbuf; - - strbuf_init(&pathbuf, PATH_MAX + tn_len); - - if (tn_len) { - strbuf_add(&pathbuf, tree_name, tn_len); - strbuf_addch(&pathbuf, ':'); - tn_len = pathbuf.len; - } - strbuf_addstr(&pathbuf, base); - len = pathbuf.len; + int old_baselen = base->len; while (tree_entry(tree, &entry)) { int te_len = tree_entry_len(entry.path, entry.sha1); - pathbuf.len = len; - strbuf_add(&pathbuf, entry.path, te_len); + + strbuf_add(base, entry.path, te_len); if (S_ISDIR(entry.mode)) /* Match "abc/" against pathspec to * decide if we want to descend into "abc" * directory. */ - strbuf_addch(&pathbuf, '/'); + strbuf_addch(base, '/'); - down = pathbuf.buf + tn_len; - if (!pathspec_matches(pathspec->raw, down, opt->max_depth)) + if (!pathspec_matches(pathspec->raw, base->buf + tn_len, opt->max_depth)) ; - else if (S_ISREG(entry.mode)) - hit |= grep_sha1(opt, entry.sha1, pathbuf.buf, tn_len); + else if (S_ISREG(entry.mode)) { + hit |= grep_sha1(opt, entry.sha1, base->buf, tn_len); + } else if (S_ISDIR(entry.mode)) { enum object_type type; struct tree_desc sub; @@ -667,13 +653,14 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, die("unable to read tree (%s)", sha1_to_hex(entry.sha1)); init_tree_desc(&sub, data, size); - hit |= grep_tree(opt, pathspec, &sub, tree_name, down); + hit |= grep_tree(opt, pathspec, &sub, base, tn_len); free(data); } + strbuf_setlen(base, old_baselen); + if (hit && opt->status_only) break; } - strbuf_release(&pathbuf); return hit; } @@ -686,13 +673,23 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, struct tree_desc tree; void *data; unsigned long size; - int hit; + struct strbuf base; + int hit, len; + data = read_object_with_reference(obj->sha1, tree_type, &size, NULL); if (!data) die("unable to read tree (%s)", sha1_to_hex(obj->sha1)); + + len = name ? strlen(name) : 0; + strbuf_init(&base, PATH_MAX + len + 1); + if (len) { + strbuf_add(&base, name, len); + strbuf_addch(&base, ':'); + } init_tree_desc(&tree, data, size); - hit = grep_tree(opt, pathspec, &tree, name, ""); + hit = grep_tree(opt, pathspec, &tree, &base, base.len); + strbuf_release(&base); free(data); return hit; } -- cgit v0.10.2-6-g49f6 From 1376e50723228fc21b7183fe86d71ee484a70dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 17 Dec 2010 19:45:33 +0700 Subject: grep: drop pathspec_matches() in favor of tree_entry_interesting() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/grep.c b/builtin/grep.c index c9622d6..c3af876 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -329,106 +329,6 @@ static int grep_config(const char *var, const char *value, void *cb) return 0; } -/* - * Return non-zero if max_depth is negative or path has no more then max_depth - * slashes. - */ -static int accept_subdir(const char *path, int max_depth) -{ - if (max_depth < 0) - return 1; - - while ((path = strchr(path, '/')) != NULL) { - max_depth--; - if (max_depth < 0) - return 0; - path++; - } - return 1; -} - -/* - * Return non-zero if name is a subdirectory of match and is not too deep. - */ -static int is_subdir(const char *name, int namelen, - const char *match, int matchlen, int max_depth) -{ - if (matchlen > namelen || strncmp(name, match, matchlen)) - return 0; - - if (name[matchlen] == '\0') /* exact match */ - return 1; - - if (!matchlen || match[matchlen-1] == '/' || name[matchlen] == '/') - return accept_subdir(name + matchlen + 1, max_depth); - - return 0; -} - -/* - * git grep pathspecs are somewhat different from diff-tree pathspecs; - * pathname wildcards are allowed. - */ -static int pathspec_matches(const char **paths, const char *name, int max_depth) -{ - int namelen, i; - if (!paths || !*paths) - return accept_subdir(name, max_depth); - namelen = strlen(name); - for (i = 0; paths[i]; i++) { - const char *match = paths[i]; - int matchlen = strlen(match); - const char *cp, *meta; - - if (is_subdir(name, namelen, match, matchlen, max_depth)) - return 1; - if (!fnmatch(match, name, 0)) - return 1; - if (name[namelen-1] != '/') - continue; - - /* We are being asked if the directory ("name") is worth - * descending into. - * - * Find the longest leading directory name that does - * not have metacharacter in the pathspec; the name - * we are looking at must overlap with that directory. - */ - for (cp = match, meta = NULL; cp - match < matchlen; cp++) { - char ch = *cp; - if (ch == '*' || ch == '[' || ch == '?') { - meta = cp; - break; - } - } - if (!meta) - meta = cp; /* fully literal */ - - if (namelen <= meta - match) { - /* Looking at "Documentation/" and - * the pattern says "Documentation/howto/", or - * "Documentation/diff*.txt". The name we - * have should match prefix. - */ - if (!memcmp(match, name, namelen)) - return 1; - continue; - } - - if (meta - match < namelen) { - /* Looking at "Documentation/howto/" and - * the pattern says "Documentation/h*"; - * match up to "Do.../h"; this avoids descending - * into "Documentation/technical/". - */ - if (!memcmp(match, name, meta - match)) - return 1; - continue; - } - } - return 0; -} - static void *lock_and_read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size) { void *data; @@ -621,25 +521,24 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, struct tree_desc *tree, struct strbuf *base, int tn_len) { - int hit = 0; + int hit = 0, matched = 0; struct name_entry entry; int old_baselen = base->len; while (tree_entry(tree, &entry)) { int te_len = tree_entry_len(entry.path, entry.sha1); - strbuf_add(base, entry.path, te_len); + if (matched != 2) { + matched = tree_entry_interesting(&entry, base, tn_len, pathspec); + if (matched == -1) + break; /* no more matches */ + if (!matched) + continue; + } - if (S_ISDIR(entry.mode)) - /* Match "abc/" against pathspec to - * decide if we want to descend into "abc" - * directory. - */ - strbuf_addch(base, '/'); + strbuf_add(base, entry.path, te_len); - if (!pathspec_matches(pathspec->raw, base->buf + tn_len, opt->max_depth)) - ; - else if (S_ISREG(entry.mode)) { + if (S_ISREG(entry.mode)) { hit |= grep_sha1(opt, entry.sha1, base->buf, tn_len); } else if (S_ISDIR(entry.mode)) { @@ -652,6 +551,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, if (!data) die("unable to read tree (%s)", sha1_to_hex(entry.sha1)); + + strbuf_addch(base, '/'); init_tree_desc(&sub, data, size); hit |= grep_tree(opt, pathspec, &sub, base, tn_len); free(data); @@ -1058,6 +959,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) paths[1] = NULL; } init_pathspec(&pathspec, paths); + pathspec.max_depth = opt.max_depth; + pathspec.recursive = 1; if (show_in_pager && (cached || list.nr)) die("--open-files-in-pager only works on the worktree"); diff --git a/tree-diff.c b/tree-diff.c index 03dc5c8..3954281 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -72,7 +72,7 @@ static void show_tree(struct diff_options *opt, const char *prefix, if (all_interesting) show = 1; else { - show = tree_entry_interesting(&desc->entry, base, + show = tree_entry_interesting(&desc->entry, base, 0, &opt->pathspec); if (show == 2) all_interesting = 1; @@ -124,7 +124,7 @@ static void skip_uninteresting(struct tree_desc *t, struct strbuf *base, struct diff_options *opt, int *all_interesting) { while (t->size) { - int show = tree_entry_interesting(&t->entry, base, &opt->pathspec); + int show = tree_entry_interesting(&t->entry, base, 0, &opt->pathspec); if (show == 2) *all_interesting = 1; if (!show) { diff --git a/tree-walk.c b/tree-walk.c index 7596716..322becc 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -544,7 +544,8 @@ static int match_dir_prefix(const char *base, int baselen, /* * Is a tree entry interesting given the pathspec we have? * - * Pre-condition: baselen == 0 || base[baselen-1] == '/' + * Pre-condition: either baselen == base_offset (i.e. empty path) + * or base[baselen-1] == '/' (i.e. with trailing slash). * * Return: * - 2 for "yes, and all subsequent entries will be" @@ -553,44 +554,45 @@ static int match_dir_prefix(const char *base, int baselen, * - negative for "no, and no subsequent entries will be either" */ int tree_entry_interesting(const struct name_entry *entry, - struct strbuf *base, + struct strbuf *base, int base_offset, const struct pathspec *ps) { int i; - int pathlen, baselen = base->len; + int pathlen, baselen = base->len - base_offset; int never_interesting = ps->has_wildcard ? 0 : -1; if (!ps->nr) { if (!ps->recursive || ps->max_depth == -1) return 2; - return !!within_depth(base->buf, baselen, + return !!within_depth(base->buf + base_offset, baselen, !!S_ISDIR(entry->mode), ps->max_depth); } pathlen = tree_entry_len(entry->path, entry->sha1); - for (i = ps->nr-1; i >= 0; i--) { + for (i = ps->nr - 1; i >= 0; i--) { const struct pathspec_item *item = ps->items+i; const char *match = item->match; + const char *base_str = base->buf + base_offset; int matchlen = item->len; if (baselen >= matchlen) { /* If it doesn't match, move along... */ - if (!match_dir_prefix(base->buf, baselen, match, matchlen)) + if (!match_dir_prefix(base_str, baselen, match, matchlen)) goto match_wildcards; if (!ps->recursive || ps->max_depth == -1) return 2; - return !!within_depth(base->buf + matchlen + 1, + return !!within_depth(base_str + matchlen + 1, baselen - matchlen - 1, !!S_ISDIR(entry->mode), ps->max_depth); } /* Does the base match? */ - if (!strncmp(base->buf, match, baselen)) { + if (!strncmp(base_str, match, baselen)) { if (match_entry(entry, pathlen, match + baselen, matchlen - baselen, &never_interesting)) @@ -622,11 +624,11 @@ match_wildcards: strbuf_add(base, entry->path, pathlen); - if (!fnmatch(match, base->buf, 0)) { - strbuf_setlen(base, baselen); + if (!fnmatch(match, base->buf + base_offset, 0)) { + strbuf_setlen(base, base_offset + baselen); return 1; } - strbuf_setlen(base, baselen); + strbuf_setlen(base, base_offset + baselen); /* * Match all directories. We'll try to match files diff --git a/tree-walk.h b/tree-walk.h index 6589ee2..39524b7 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -60,6 +60,6 @@ static inline int traverse_path_len(const struct traverse_info *info, const stru return info->pathlen + tree_entry_len(n->path, n->sha1); } -extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, const struct pathspec *ps); +extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, int, const struct pathspec *ps); #endif -- cgit v0.10.2-6-g49f6 From b31f688040d07ed8a6fd887e2960db005c20d832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 15 Dec 2010 22:02:56 +0700 Subject: t7810: overlapping pathspecs and depth limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index c877758..8a7788d 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -182,6 +182,24 @@ do test_cmp expected actual ' + test_expect_success "grep --max-depth 0 -- . t $L" ' + { + echo ${HC}t/v:1:vvv + echo ${HC}v:1:vvv + } >expected && + git grep --max-depth 0 -n -e vvv $H -- . t >actual && + test_cmp expected actual + ' + + test_expect_success "grep --max-depth 0 -- t . $L" ' + { + echo ${HC}t/v:1:vvv + echo ${HC}v:1:vvv + } >expected && + git grep --max-depth 0 -n -e vvv $H -- t . >actual && + test_cmp expected actual + ' + done cat >expected < Date: Mon, 31 Jan 2011 12:09:53 -0800 Subject: t6004: add pathspec globbing test for log family Earlier e10cb0f (tree_entry_interesting(): support wildcard matching, 2010-12-15) and b3d4b34 (tree_entry_interesting(): optimize wildcard matching when base is matched, 2010-12-15) added tests for globbing support for diff-tree plumbing. This is a follow-up to update the test for revision traversal and path pruning machinery for the same topic. Signed-off-by: Junio C Hamano diff --git a/t/t6004-rev-list-path-optim.sh b/t/t6004-rev-list-path-optim.sh index 5dabf1c..3e8c42e 100755 --- a/t/t6004-rev-list-path-optim.sh +++ b/t/t6004-rev-list-path-optim.sh @@ -1,51 +1,96 @@ #!/bin/sh -test_description='git rev-list trivial path optimization test' +test_description='git rev-list trivial path optimization test + + d/z1 + b0 b1 + o------------------------*----o master + / / + o---------o----o----o----o side + a0 c0 c1 a1 c2 + d/f0 d/f1 + d/z0 + +' . ./test-lib.sh test_expect_success setup ' -echo Hello > a && -git add a && -git commit -m "Initial commit" a && -initial=$(git rev-parse --verify HEAD) + echo Hello >a && + mkdir d && + echo World >d/f && + echo World >d/z && + git add a d && + test_tick && + git commit -m "Initial commit" && + git rev-parse --verify HEAD && + git tag initial ' test_expect_success path-optimization ' - commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) && - test $(git rev-list $commit | wc -l) = 2 && - test $(git rev-list $commit -- . | wc -l) = 1 + test_tick && + commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) && + test $(git rev-list $commit | wc -l) = 2 && + test $(git rev-list $commit -- . | wc -l) = 1 ' test_expect_success 'further setup' ' git checkout -b side && echo Irrelevant >c && - git add c && + echo Irrelevant >d/f && + git add c d/f && + test_tick && git commit -m "Side makes an irrelevant commit" && + git tag side_c0 && echo "More Irrelevancy" >c && git add c && + test_tick && git commit -m "Side makes another irrelevant commit" && echo Bye >a && git add a && + test_tick && git commit -m "Side touches a" && - side=$(git rev-parse --verify HEAD) && + git tag side_a1 && echo "Yet more Irrelevancy" >c && git add c && + test_tick && git commit -m "Side makes yet another irrelevant commit" && git checkout master && echo Another >b && - git add b && + echo Munged >d/z && + git add b d/z && + test_tick && git commit -m "Master touches b" && + git tag master_b0 && git merge side && echo Touched >b && git add b && + test_tick && git commit -m "Master touches b again" ' test_expect_success 'path optimization 2' ' - ( echo "$side"; echo "$initial" ) >expected && + git rev-parse side_a1 initial >expected && git rev-list HEAD -- a >actual && test_cmp expected actual ' +test_expect_success 'pathspec with leading path' ' + git rev-parse master^ master_b0 side_c0 initial >expected && + git rev-list HEAD -- d >actual && + test_cmp expected actual +' + +test_expect_success 'pathspec with glob (1)' ' + git rev-parse master^ master_b0 side_c0 initial >expected && + git rev-list HEAD -- "d/*" >actual && + test_cmp expected actual +' + +test_expect_success 'pathspec with glob (2)' ' + git rev-parse side_c0 initial >expected && + git rev-list HEAD -- "d/[a-m]*" >actual && + test_cmp expected actual +' + test_done -- cgit v0.10.2-6-g49f6 From cc5fa2fdafa186d6e1e310828b22d0028e1fb51b Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Fri, 17 Dec 2010 20:26:47 +0700 Subject: Make rev-list --objects work together with pathspecs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When traversing commits, the selection of commits would heed the list of pathspecs passed, but subsequent walking of the trees of those commits would not. This resulted in 'rev-list --objects HEAD -- ' displaying objects at unwanted paths. Have process_tree() call tree_entry_interesting() to determine which paths are interesting and should be walked. Naturally, this change can provide a large speedup when paths are specified together with --objects, since many tree entries are now correctly ignored. Interestingly, though, this change also gives me a small (~1%) but repeatable speedup even when no paths are specified with --objects. Signed-off-by: Elijah Newren Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/list-objects.c b/list-objects.c index 8953548..61f6cc9 100644 --- a/list-objects.c +++ b/list-objects.c @@ -61,12 +61,15 @@ static void process_tree(struct rev_info *revs, struct tree *tree, show_object_fn show, struct name_path *path, + struct strbuf *base, const char *name) { struct object *obj = &tree->object; struct tree_desc desc; struct name_entry entry; struct name_path me; + int all_interesting = (revs->diffopt.pathspec.nr == 0); + int baselen = base->len; if (!revs->tree_objects) return; @@ -82,13 +85,32 @@ static void process_tree(struct rev_info *revs, me.elem = name; me.elem_len = strlen(name); + if (!all_interesting) { + strbuf_addstr(base, name); + if (base->len) + strbuf_addch(base, '/'); + } + init_tree_desc(&desc, tree->buffer, tree->size); while (tree_entry(&desc, &entry)) { + if (!all_interesting) { + int showit = tree_entry_interesting(&entry, + base, 0, + &revs->diffopt.pathspec); + + if (showit < 0) + break; + else if (!showit) + continue; + else if (showit == 2) + all_interesting = 1; + } + if (S_ISDIR(entry.mode)) process_tree(revs, lookup_tree(entry.sha1), - show, &me, entry.path); + show, &me, base, entry.path); else if (S_ISGITLINK(entry.mode)) process_gitlink(revs, entry.sha1, show, &me, entry.path); @@ -97,6 +119,7 @@ static void process_tree(struct rev_info *revs, lookup_blob(entry.sha1), show, &me, entry.path); } + strbuf_setlen(base, baselen); free(tree->buffer); tree->buffer = NULL; } @@ -146,7 +169,9 @@ void traverse_commit_list(struct rev_info *revs, { int i; struct commit *commit; + struct strbuf base; + strbuf_init(&base, PATH_MAX); while ((commit = get_revision(revs)) != NULL) { add_pending_tree(revs, commit->tree); show_commit(commit, data); @@ -164,7 +189,7 @@ void traverse_commit_list(struct rev_info *revs, } if (obj->type == OBJ_TREE) { process_tree(revs, (struct tree *)obj, show_object, - NULL, name); + NULL, &base, name); continue; } if (obj->type == OBJ_BLOB) { @@ -181,4 +206,5 @@ void traverse_commit_list(struct rev_info *revs, revs->pending.alloc = 0; revs->pending.objects = NULL; } + strbuf_release(&base); } -- cgit v0.10.2-6-g49f6 From a97a96fc9667cd84dc350db309135ea52adac18d Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 20 Sep 2010 09:24:29 +1000 Subject: Add testcases showing how pathspecs are handled with rev-list --objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh new file mode 100755 index 0000000..b10685a --- /dev/null +++ b/t/t6000-rev-list-misc.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +test_description='miscellaneous rev-list tests' + +. ./test-lib.sh + +test_expect_success setup ' + echo content1 >wanted_file && + echo content2 >unwanted_file && + git add wanted_file unwanted_file && + git commit -m one +' + +test_expect_success 'rev-list --objects heeds pathspecs' ' + git rev-list --objects HEAD -- wanted_file >output && + grep wanted_file output && + ! grep unwanted_file output +' + +test_expect_success 'rev-list --objects with pathspecs and deeper paths' ' + mkdir foo && + >foo/file && + git add foo/file && + git commit -m two && + + git rev-list --objects HEAD -- foo >output && + grep foo/file output && + + git rev-list --objects HEAD -- foo/file >output && + grep foo/file output && + ! grep unwanted_file output +' + +test_expect_success 'rev-list --objects with pathspecs and copied files' ' + git checkout --orphan junio-testcase && + git rm -rf . && + + mkdir two && + echo frotz >one && + cp one two/three && + git add one two/three && + test_tick && + git commit -m that && + + ONE=$(git rev-parse HEAD:one) + git rev-list --objects HEAD two >output && + grep "$ONE two/three" output && + ! grep one output +' + +test_done -- cgit v0.10.2-6-g49f6 From 9e34e62bcbef12d290ecc0854df9117009873a3f Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Sun, 6 Feb 2011 18:01:08 +0100 Subject: git gui: keep selected branch when remote is changed in push dialog The selection of the branch to be pushed would be cleared when the remote was changed. This seems to be dependent on the fact that the selected content in the combobox was exported to the clipboard. It was only apparent when using the new ttk widget. Signed-off-by: Heiko Voigt Signed-off-by: Pat Thoyts diff --git a/lib/transport.tcl b/lib/transport.tcl index 60e3a64..321f595 100644 --- a/lib/transport.tcl +++ b/lib/transport.tcl @@ -135,7 +135,9 @@ proc do_push_anywhere {} { -value remote \ -variable push_urltype if {$use_ttk} { - ttk::combobox $w.dest.remote_m -textvariable push_remote \ + ttk::combobox $w.dest.remote_m -state readonly \ + -exportselection false \ + -textvariable push_remote \ -values $all_remotes } else { eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes -- cgit v0.10.2-6-g49f6 From fb027e148a1e256e12ecfcfac090f4f06f8d4c58 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Sun, 6 Feb 2011 18:04:27 +0100 Subject: git-gui: scroll down to default selection for push dialog If the list of remote/local branches is very long its inconvenient to scroll down and find the selected branch. This patch makes the widget automatically scroll down so its shown on the top. Signed-off-by: Heiko Voigt Signed-off-by: Pat Thoyts diff --git a/lib/transport.tcl b/lib/transport.tcl index 321f595..3067058 100644 --- a/lib/transport.tcl +++ b/lib/transport.tcl @@ -123,6 +123,7 @@ proc do_push_anywhere {} { $w.source.l insert end $h if {$h eq $current_branch} { $w.source.l select set end + $w.source.l yview end } } pack $w.source.l -side left -fill both -expand 1 -- cgit v0.10.2-6-g49f6 From df128139c690233e94ac249cf9d5271ac0d5f13d Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Sun, 6 Feb 2011 18:22:46 +0100 Subject: git-gui: instead of defaulting to home directory use working directory When starting git gui in a non-git directory it presents the user a dialog which asks to create, clone or open a repository. The filedialogs used to choose the path(s) would always default to the home directory of the user. This patch changes this behavior and uses the current working directory in which git gui was started as default. This is useful in various cases. First being that the user starts the gui in some directory and can go search to create, open or clone a repository from there. Another use case is that tools like filemanager context menues can transport a natural default when selected from a folder. Users who like to have their home folder as a default can fall back on starting git gui with its working directory set to the home folder. Signed-off-by: Heiko Voigt Signed-off-by: Pat Thoyts diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index fae1192..657f7d5 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -214,14 +214,6 @@ constructor pick {} { } } -proc _home {} { - if {[catch {set h $::env(HOME)}] - || ![file isdirectory $h]} { - set h . - } - return $h -} - method _center {} { set nx [winfo reqwidth $top] set ny [winfo reqheight $top] @@ -420,7 +412,7 @@ method _new_local_path {} { if {$local_path ne {}} { set p [file dirname $local_path] } else { - set p [_home] + set p [pwd] } set p [tk_chooseDirectory \ @@ -541,7 +533,7 @@ method _open_origin {} { if {$origin_url ne {} && [file isdirectory $origin_url]} { set p $origin_url } else { - set p [_home] + set p [pwd] } set p [tk_chooseDirectory \ @@ -1042,7 +1034,7 @@ method _open_local_path {} { if {$local_path ne {}} { set p $local_path } else { - set p [_home] + set p [pwd] } set p [tk_chooseDirectory \ -- cgit v0.10.2-6-g49f6 From c879daa23729547fb28aa7e8783c5e4e619a9e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 5 Feb 2011 17:52:21 +0700 Subject: Make hash-object more robust against malformed objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commits, trees and tags have structure. Don't let users feed git with malformed ones. Sooner or later git will die() when encountering them. Note that this patch does not check semantics. A tree that points to non-existent objects is perfectly OK (and should be so, users may choose to add commit first, then its associated tree for example). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 080af1a..c90acdd 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -15,7 +15,7 @@ static void hash_fd(int fd, const char *type, int write_object, const char *path struct stat st; unsigned char sha1[20]; if (fstat(fd, &st) < 0 || - index_fd(sha1, fd, &st, write_object, type_from_string(type), path)) + index_fd(sha1, fd, &st, write_object, type_from_string(type), path, 1)) die(write_object ? "Unable to add %s to database" : "Unable to hash %s", path); diff --git a/cache.h b/cache.h index d83d68c..9186a56 100644 --- a/cache.h +++ b/cache.h @@ -501,7 +501,7 @@ extern int ie_match_stat(const struct index_state *, struct cache_entry *, struc extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); -extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); +extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path, int format_check); extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); diff --git a/read-cache.c b/read-cache.c index 4f2e890..fbc12f3 100644 --- a/read-cache.c +++ b/read-cache.c @@ -92,7 +92,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st) if (fd >= 0) { unsigned char sha1[20]; - if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name)) + if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name, 0)) match = hashcmp(sha1, ce->sha1); /* index_fd() closed the file descriptor already */ } diff --git a/sha1_file.c b/sha1_file.c index d86a8db..58ca858 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -13,6 +13,7 @@ #include "commit.h" #include "tag.h" #include "tree.h" +#include "tree-walk.h" #include "refs.h" #include "pack-revindex.h" #include "sha1-lookup.h" @@ -2471,8 +2472,37 @@ int has_sha1_file(const unsigned char *sha1) return has_loose_object(sha1); } +static void check_tree(const void *buf, size_t size) +{ + struct tree_desc desc; + struct name_entry entry; + + init_tree_desc(&desc, buf, size); + while (tree_entry(&desc, &entry)) + /* do nothing + * tree_entry() will die() on malformed entries */ + ; +} + +static void check_commit(const void *buf, size_t size) +{ + struct commit c; + memset(&c, 0, sizeof(c)); + if (parse_commit_buffer(&c, buf, size)) + die("corrupt commit"); +} + +static void check_tag(const void *buf, size_t size) +{ + struct tag t; + memset(&t, 0, sizeof(t)); + if (parse_tag_buffer(&t, buf, size)) + die("corrupt tag"); +} + static int index_mem(unsigned char *sha1, void *buf, size_t size, - int write_object, enum object_type type, const char *path) + int write_object, enum object_type type, + const char *path, int format_check) { int ret, re_allocated = 0; @@ -2490,6 +2520,14 @@ static int index_mem(unsigned char *sha1, void *buf, size_t size, re_allocated = 1; } } + if (format_check) { + if (type == OBJ_TREE) + check_tree(buf, size); + if (type == OBJ_COMMIT) + check_commit(buf, size); + if (type == OBJ_TAG) + check_tag(buf, size); + } if (write_object) ret = write_sha1_file(buf, size, typename(type), sha1); @@ -2503,7 +2541,7 @@ static int index_mem(unsigned char *sha1, void *buf, size_t size, #define SMALL_FILE_SIZE (32*1024) int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, - enum object_type type, const char *path) + enum object_type type, const char *path, int format_check) { int ret; size_t size = xsize_t(st->st_size); @@ -2512,23 +2550,25 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, struct strbuf sbuf = STRBUF_INIT; if (strbuf_read(&sbuf, fd, 4096) >= 0) ret = index_mem(sha1, sbuf.buf, sbuf.len, write_object, - type, path); + type, path, format_check); else ret = -1; strbuf_release(&sbuf); } else if (!size) { - ret = index_mem(sha1, NULL, size, write_object, type, path); + ret = index_mem(sha1, NULL, size, write_object, type, path, + format_check); } else if (size <= SMALL_FILE_SIZE) { char *buf = xmalloc(size); if (size == read_in_full(fd, buf, size)) ret = index_mem(sha1, buf, size, write_object, type, - path); + path, format_check); else ret = error("short read %s", strerror(errno)); free(buf); } else { void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); - ret = index_mem(sha1, buf, size, write_object, type, path); + ret = index_mem(sha1, buf, size, write_object, type, path, + format_check); munmap(buf, size); } close(fd); @@ -2546,7 +2586,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write if (fd < 0) return error("open(\"%s\"): %s", path, strerror(errno)); - if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path) < 0) + if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path, 0) < 0) return error("%s: failed to insert into database", path); break; diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index dd32432..6d52b82 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -188,4 +188,17 @@ for args in "-w --stdin-paths" "--stdin-paths -w"; do pop_repo done +test_expect_success 'corrupt tree' ' + echo abc >malformed-tree + test_must_fail git hash-object -t tree malformed-tree +' + +test_expect_success 'corrupt commit' ' + test_must_fail git hash-object -t commit --stdin Date: Mon, 7 Feb 2011 21:49:33 +0100 Subject: mingw: move unlink wrapper to mingw.c The next patch implements a workaround in case unlink fails on Windows. Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index bee6054..a7e1c6b 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -116,6 +116,14 @@ int err_win_to_posix(DWORD winerr) return error; } +#undef unlink +int mingw_unlink(const char *pathname) +{ + /* read-only files cannot be removed */ + chmod(pathname, 0666); + return unlink(pathname); +} + #undef open int mingw_open (const char *filename, int oflags, ...) { diff --git a/compat/mingw.h b/compat/mingw.h index 2283071..8316938 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -125,14 +125,6 @@ static inline int mingw_mkdir(const char *path, int mode) } #define mkdir mingw_mkdir -static inline int mingw_unlink(const char *pathname) -{ - /* read-only files cannot be removed */ - chmod(pathname, 0666); - return unlink(pathname); -} -#define unlink mingw_unlink - #define WNOHANG 1 pid_t waitpid(pid_t pid, int *status, unsigned options); @@ -180,6 +172,9 @@ int link(const char *oldpath, const char *newpath); * replacements of existing functions */ +int mingw_unlink(const char *pathname); +#define unlink mingw_unlink + int mingw_open (const char *filename, int oflags, ...); #define open mingw_open -- cgit v0.10.2-6-g49f6 From 19e125498bc417e20f0b8c1014b808654e4acfe4 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Mon, 7 Feb 2011 21:50:26 +0100 Subject: mingw: work around irregular failures of unlink on windows If a file is opened by another process (e.g. indexing of an IDE) for reading it is not allowed to be deleted. So in case unlink fails retry after waiting for some time. This extends the workaround from 6ac6f878. Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index a7e1c6b..9421a37 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -3,6 +3,8 @@ #include #include "../strbuf.h" +static const int delay[] = { 0, 1, 10, 20, 40 }; + int err_win_to_posix(DWORD winerr) { int error = ENOSYS; @@ -116,12 +118,38 @@ int err_win_to_posix(DWORD winerr) return error; } +static inline int is_file_in_use_error(DWORD errcode) +{ + switch (errcode) { + case ERROR_SHARING_VIOLATION: + case ERROR_ACCESS_DENIED: + return 1; + } + + return 0; +} + #undef unlink int mingw_unlink(const char *pathname) { + int ret, tries = 0; + /* read-only files cannot be removed */ chmod(pathname, 0666); - return unlink(pathname); + while ((ret = unlink(pathname)) == -1 && tries < ARRAY_SIZE(delay)) { + if (!is_file_in_use_error(GetLastError())) + break; + /* + * We assume that some other process had the source or + * destination file open at the wrong moment and retry. + * In order to give the other process a higher chance to + * complete its operation, we give up our time slice now. + * If we have to retry again, we do sleep a bit. + */ + Sleep(delay[tries]); + tries++; + } + return ret; } #undef open @@ -1257,7 +1285,6 @@ int mingw_rename(const char *pold, const char *pnew) { DWORD attrs, gle; int tries = 0; - static const int delay[] = { 0, 1, 10, 20, 40 }; /* * Try native rename() first to get errno right. -- cgit v0.10.2-6-g49f6 From c9b78400802acb3e02249c44286162edd9ed2b35 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Mon, 7 Feb 2011 21:51:21 +0100 Subject: mingw: make failures to unlink or move raise a question On Windows in case a program is accessing a file unlink or move operations may fail. To give the user a chance to correct this we simply wait until the user asks us to retry or fail. This is useful because of the following use case which seem to happen rarely but when it does it is a mess: After making some changes the user realizes that he was on the incorrect branch. When trying to change the branch some file is still in use by some other process and git stops in the middle of changing branches. Now the user has lots of files with changes mixed with his own. This is especially confusing on repositories that contain lots of files. Although the recent implementation of automatic retry makes this scenario much more unlikely lets provide a fallback as a last resort. Thanks to Albert Dvornik for disabling the question if users can't see it. If the stdout of the command is connected to a terminal but the stderr has been redirected, the odds are good that the user can't see any question we print out to stderr. This will result in a "mysterious hang" while the app is waiting for user input. It seems better to be conservative, and avoid asking for input whenever the stderr is not a terminal, just like we do for stdin. Signed-off-by: Heiko Voigt Signed-off-by: Albert Dvornik Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index 9421a37..e8e2028 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2,6 +2,7 @@ #include "win32.h" #include #include "../strbuf.h" +#include "../run-command.h" static const int delay[] = { 0, 1, 10, 20, 40 }; @@ -129,6 +130,74 @@ static inline int is_file_in_use_error(DWORD errcode) return 0; } +static int read_yes_no_answer(void) +{ + char answer[1024]; + + if (fgets(answer, sizeof(answer), stdin)) { + size_t answer_len = strlen(answer); + int got_full_line = 0, c; + + /* remove the newline */ + if (answer_len >= 2 && answer[answer_len-2] == '\r') { + answer[answer_len-2] = '\0'; + got_full_line = 1; + } else if (answer_len >= 1 && answer[answer_len-1] == '\n') { + answer[answer_len-1] = '\0'; + got_full_line = 1; + } + /* flush the buffer in case we did not get the full line */ + if (!got_full_line) + while ((c = getchar()) != EOF && c != '\n') + ; + } else + /* we could not read, return the + * default answer which is no */ + return 0; + + if (tolower(answer[0]) == 'y' && !answer[1]) + return 1; + if (!strncasecmp(answer, "yes", sizeof(answer))) + return 1; + if (tolower(answer[0]) == 'n' && !answer[1]) + return 0; + if (!strncasecmp(answer, "no", sizeof(answer))) + return 0; + + /* did not find an answer we understand */ + return -1; +} + +static int ask_yes_no_if_possible(const char *format, ...) +{ + char question[4096]; + const char *retry_hook[] = { NULL, NULL, NULL }; + va_list args; + + va_start(args, format); + vsnprintf(question, sizeof(question), format, args); + va_end(args); + + if ((retry_hook[0] = getenv("GIT_ASK_YESNO"))) { + retry_hook[1] = question; + return !run_command_v_opt(retry_hook, 0); + } + + if (!isatty(_fileno(stdin)) || !isatty(_fileno(stderr))) + return 0; + + while (1) { + int answer; + fprintf(stderr, "%s (y/n) ", question); + + if ((answer = read_yes_no_answer()) >= 0) + return answer; + + fprintf(stderr, "Sorry, I did not understand your answer. " + "Please type 'y' or 'n'\n"); + } +} + #undef unlink int mingw_unlink(const char *pathname) { @@ -149,6 +218,10 @@ int mingw_unlink(const char *pathname) Sleep(delay[tries]); tries++; } + while (ret == -1 && is_file_in_use_error(GetLastError()) && + ask_yes_no_if_possible("Unlink of file '%s' failed. " + "Should I try again?", pathname)) + ret = unlink(pathname); return ret; } @@ -1326,6 +1399,11 @@ repeat: tries++; goto repeat; } + if (gle == ERROR_ACCESS_DENIED && + ask_yes_no_if_possible("Rename from '%s' to '%s' failed. " + "Should I try again?", pold, pnew)) + goto repeat; + errno = EACCES; return -1; } -- cgit v0.10.2-6-g49f6 From 4f288100ceed14c65a1e964b2db4aaee4f4199fc Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Mon, 7 Feb 2011 21:52:34 +0100 Subject: mingw: add fallback for rmdir in case directory is in use The same logic as for unlink and rename also applies to rmdir. For example in case you have a shell open in a git controlled folder. This will easily fail. So lets be nice for such cases as well. Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index e8e2028..e55c3ca 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -225,6 +225,31 @@ int mingw_unlink(const char *pathname) return ret; } +#undef rmdir +int mingw_rmdir(const char *pathname) +{ + int ret, tries = 0; + + while ((ret = rmdir(pathname)) == -1 && tries < ARRAY_SIZE(delay)) { + if (!is_file_in_use_error(GetLastError())) + break; + /* + * We assume that some other process had the source or + * destination file open at the wrong moment and retry. + * In order to give the other process a higher chance to + * complete its operation, we give up our time slice now. + * If we have to retry again, we do sleep a bit. + */ + Sleep(delay[tries]); + tries++; + } + while (ret == -1 && is_file_in_use_error(GetLastError()) && + ask_yes_no_if_possible("Deletion of directory '%s' failed. " + "Should I try again?", pathname)) + ret = rmdir(pathname); + return ret; +} + #undef open int mingw_open (const char *filename, int oflags, ...) { diff --git a/compat/mingw.h b/compat/mingw.h index 8316938..8b159c4 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -175,6 +175,9 @@ int link(const char *oldpath, const char *newpath); int mingw_unlink(const char *pathname); #define unlink mingw_unlink +int mingw_rmdir(const char *path); +#define rmdir mingw_rmdir + int mingw_open (const char *filename, int oflags, ...); #define open mingw_open -- cgit v0.10.2-6-g49f6 From ab1a11be7858e1f92ee2e4ee1d70fabe7d5fe0ee Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 7 Feb 2011 21:54:01 +0100 Subject: mingw_rmdir: set errno=ENOTEMPTY when appropriate On Windows, EACCES overrules ENOTEMPTY when calling rmdir(). But if the directory is busy, we only want to retry deleting the directory if it is empty, so test specifically for that case and set ENOTEMPTY rather than EACCES. Noticed by Greg Hazel. Signed-off-by: Johannes Schindelin Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index e55c3ca..878b1de 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -225,6 +225,30 @@ int mingw_unlink(const char *pathname) return ret; } +static int is_dir_empty(const char *path) +{ + struct strbuf buf = STRBUF_INIT; + WIN32_FIND_DATAA findbuf; + HANDLE handle; + + strbuf_addf(&buf, "%s\\*", path); + handle = FindFirstFileA(buf.buf, &findbuf); + if (handle == INVALID_HANDLE_VALUE) { + strbuf_release(&buf); + return GetLastError() == ERROR_NO_MORE_FILES; + } + + while (!strcmp(findbuf.cFileName, ".") || + !strcmp(findbuf.cFileName, "..")) + if (!FindNextFile(handle, &findbuf)) { + strbuf_release(&buf); + return GetLastError() == ERROR_NO_MORE_FILES; + } + FindClose(handle); + strbuf_release(&buf); + return 0; +} + #undef rmdir int mingw_rmdir(const char *pathname) { @@ -233,6 +257,10 @@ int mingw_rmdir(const char *pathname) while ((ret = rmdir(pathname)) == -1 && tries < ARRAY_SIZE(delay)) { if (!is_file_in_use_error(GetLastError())) break; + if (!is_dir_empty(pathname)) { + errno = ENOTEMPTY; + break; + } /* * We assume that some other process had the source or * destination file open at the wrong moment and retry. -- cgit v0.10.2-6-g49f6 From 09ebad6faeec11c3dbad0bdaf95faed57be5dcba Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 8 Feb 2011 04:29:09 -0600 Subject: checkout: split off a function to peel away branchname arg The code to parse and consume the tree name and "--" in commands such as "git checkout @{-1} -- '*.c'" is intimidatingly long. Split it out into a separate function and make it easier to skip on first reading by making the data it uses and produces more explicit. No functional change intended. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano diff --git a/builtin/checkout.c b/builtin/checkout.c index 953abdd..0e7a6a3 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -675,11 +675,123 @@ static const char *unique_tracking_name(const char *name) return NULL; } +static int parse_branchname_arg(int argc, const char **argv, + int dwim_new_local_branch_ok, + struct branch_info *new, + struct tree **source_tree, + unsigned char rev[20], + const char **new_branch) +{ + int argcount = 0; + unsigned char branch_rev[20]; + const char *arg; + int has_dash_dash; + + /* + * case 1: git checkout -- [] + * + * must be a valid tree, everything after the '--' must be + * a path. + * + * case 2: git checkout -- [] + * + * everything after the '--' must be paths. + * + * case 3: git checkout [] + * + * With no paths, if is a commit, that is to + * switch to the branch or detach HEAD at it. As a special case, + * if is A...B (missing A or B means HEAD but you can + * omit at most one side), and if there is a unique merge base + * between A and B, A...B names that merge base. + * + * With no paths, if is _not_ a commit, no -t nor -b + * was given, and there is a tracking branch whose name is + * in one and only one remote, then this is a short-hand + * to fork local from that remote tracking branch. + * + * Otherwise shall not be ambiguous. + * - If it's *only* a reference, treat it like case (1). + * - If it's only a path, treat it like case (2). + * - else: fail. + * + */ + if (!argc) + return 0; + + if (!strcmp(argv[0], "--")) /* case (2) */ + return 1; + + arg = argv[0]; + has_dash_dash = (argc > 1) && !strcmp(argv[1], "--"); + + if (!strcmp(arg, "-")) + arg = "@{-1}"; + + if (get_sha1_mb(arg, rev)) { + if (has_dash_dash) /* case (1) */ + die("invalid reference: %s", arg); + if (dwim_new_local_branch_ok && + !check_filename(NULL, arg) && + argc == 1) { + const char *remote = unique_tracking_name(arg); + if (!remote || get_sha1(remote, rev)) + return argcount; + *new_branch = arg; + arg = remote; + /* DWIMmed to create local branch */ + } else { + return argcount; + } + } + + /* we can't end up being in (2) anymore, eat the argument */ + argcount++; + argv++; + argc--; + + new->name = arg; + setup_branch_path(new); + + if (check_ref_format(new->path) == CHECK_REF_FORMAT_OK && + resolve_ref(new->path, branch_rev, 1, NULL)) + hashcpy(rev, branch_rev); + else + new->path = NULL; /* not an existing branch */ + + new->commit = lookup_commit_reference_gently(rev, 1); + if (!new->commit) { + /* not a commit */ + *source_tree = parse_tree_indirect(rev); + } else { + parse_commit(new->commit); + *source_tree = new->commit->tree; + } + + if (!*source_tree) /* case (1): want a tree */ + die("reference is not a tree: %s", arg); + if (!has_dash_dash) {/* case (3 -> 1) */ + /* + * Do not complain the most common case + * git checkout branch + * even if there happen to be a file called 'branch'; + * it would be extremely annoying. + */ + if (argc) + verify_non_filename(NULL, arg); + } else { + argcount++; + argv++; + argc--; + } + + return argcount; +} + int cmd_checkout(int argc, const char **argv, const char *prefix) { struct checkout_opts opts; - unsigned char rev[20], branch_rev[20]; - const char *arg; + unsigned char rev[20]; struct branch_info new; struct tree *source_tree = NULL; char *conflict_style = NULL; @@ -709,7 +821,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) PARSE_OPT_NOARG | PARSE_OPT_HIDDEN }, OPT_END(), }; - int has_dash_dash; memset(&opts, 0, sizeof(opts)); memset(&new, 0, sizeof(new)); @@ -766,108 +877,30 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) die("git checkout: -f and -m are incompatible"); /* - * case 1: git checkout -- [] - * - * must be a valid tree, everything after the '--' must be - * a path. - * - * case 2: git checkout -- [] - * - * everything after the '--' must be paths. + * Extract branch name from command line arguments, so + * all that is left is pathspecs. * - * case 3: git checkout [] - * - * With no paths, if is a commit, that is to - * switch to the branch or detach HEAD at it. As a special case, - * if is A...B (missing A or B means HEAD but you can - * omit at most one side), and if there is a unique merge base - * between A and B, A...B names that merge base. - * - * With no paths, if is _not_ a commit, no -t nor -b - * was given, and there is a tracking branch whose name is - * in one and only one remote, then this is a short-hand - * to fork local from that remote tracking branch. + * Handle * - * Otherwise shall not be ambiguous. - * - If it's *only* a reference, treat it like case (1). - * - If it's only a path, treat it like case (2). - * - else: fail. + * 1) git checkout -- [] + * 2) git checkout -- [] + * 3) git checkout [] * + * including "last branch" syntax and DWIM-ery for names of + * remote branches, erroring out for invalid or ambiguous cases. */ if (argc) { - if (!strcmp(argv[0], "--")) { /* case (2) */ - argv++; - argc--; - goto no_reference; - } - - arg = argv[0]; - has_dash_dash = (argc > 1) && !strcmp(argv[1], "--"); - - if (!strcmp(arg, "-")) - arg = "@{-1}"; - - if (get_sha1_mb(arg, rev)) { - if (has_dash_dash) /* case (1) */ - die("invalid reference: %s", arg); - if (!patch_mode && - dwim_new_local_branch && - opts.track == BRANCH_TRACK_UNSPECIFIED && - !opts.new_branch && - !check_filename(NULL, arg) && - argc == 1) { - const char *remote = unique_tracking_name(arg); - if (!remote || get_sha1(remote, rev)) - goto no_reference; - opts.new_branch = arg; - arg = remote; - /* DWIMmed to create local branch */ - } - else - goto no_reference; - } - - /* we can't end up being in (2) anymore, eat the argument */ - argv++; - argc--; - - new.name = arg; - setup_branch_path(&new); - - if (check_ref_format(new.path) == CHECK_REF_FORMAT_OK && - resolve_ref(new.path, branch_rev, 1, NULL)) - hashcpy(rev, branch_rev); - else - new.path = NULL; /* not an existing branch */ - - if (!(new.commit = lookup_commit_reference_gently(rev, 1))) { - /* not a commit */ - source_tree = parse_tree_indirect(rev); - } else { - parse_commit(new.commit); - source_tree = new.commit->tree; - } - - if (!source_tree) /* case (1): want a tree */ - die("reference is not a tree: %s", arg); - if (!has_dash_dash) {/* case (3 -> 1) */ - /* - * Do not complain the most common case - * git checkout branch - * even if there happen to be a file called 'branch'; - * it would be extremely annoying. - */ - if (argc) - verify_non_filename(NULL, arg); - } - else { - argv++; - argc--; - } + int dwim_ok = + !patch_mode && + dwim_new_local_branch && + opts.track == BRANCH_TRACK_UNSPECIFIED && + !opts.new_branch; + int n = parse_branchname_arg(argc, argv, dwim_ok, + &new, &source_tree, rev, &opts.new_branch); + argv += n; + argc -= n; } -no_reference: - if (opts.track == BRANCH_TRACK_UNSPECIFIED) opts.track = git_branch_track; -- cgit v0.10.2-6-g49f6 From 32669671c7746888aa1e3832907deb7fc8405061 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 8 Feb 2011 04:32:49 -0600 Subject: checkout: introduce --detach synonym for "git checkout foo^{commit}" For example, one might use this when making a temporary merge to test that two topics work well together. Patch by Junio, with tests from Jeff King. [jn: with some extra checks for bogus commandline usage] Suggested-by: Jeff King Signed-off-by: Junio C Hamano Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 22d3611..d162117 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'git checkout' [-q] [-f] [-m] [] +'git checkout' [-q] [-f] [-m] [--detach] [] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=