From a13ee29b975d3a9a012983309e842d942b2bbd44 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 2 Aug 2007 22:55:22 -0400 Subject: [PATCH 01/95] git-gui: Avoid Tcl error in popup menu on diff viewer If there is no path currently shown in the diff viewer then we were getting Tcl errors anytime the user right-clicked on the diff viewer to bring up its popup menu. The bug here is caused by trying to get the file_state for the empty string; this path is never seen so we never have file_state for it. In such cases we now disable the Stage Hunk For Commit option. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 671b8873f2..2c7eb3c25c 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2407,13 +2407,15 @@ $ctxm add separator $ctxm add command -label {Options...} \ -command do_options proc popup_diff_menu {ctxm x y X Y} { + global current_diff_path set ::cursorX $x set ::cursorY $y if {$::ui_index eq $::current_diff_side} { $ctxm entryconf $::ui_diff_applyhunk \ -state normal \ -label {Unstage Hunk From Commit} - } elseif {{_O} eq [lindex $::file_states($::current_diff_path) 0]} { + } elseif {![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($::current_diff_path) 0]} { $ctxm entryconf $::ui_diff_applyhunk \ -state disabled \ -label {Stage Hunk For Commit} From 51b8c5021a19195e0f138832b081a356a2247bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A4in=C3=B6=20J=C3=A4rvel=C3=A4?= Date: Fri, 3 Aug 2007 12:27:39 +0300 Subject: [PATCH 02/95] git-gui: Added support for OS X right click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OS X sends Button-2 on a "real" right click, such as with a three button mouse, or by using the two-finger trackpad click. Signed-off-by: Väinö Järvelä Signed-off-by: Shawn O. Pearce --- git-gui.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index 2c7eb3c25c..29a790e481 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1348,6 +1348,9 @@ unset i proc bind_button3 {w cmd} { bind $w $cmd if {[is_MacOSX]} { + # Mac OS X sends Button-2 on right click through three-button mouse, + # or through trackpad right-clicking (two-finger touch + click). + bind $w $cmd bind $w $cmd } } From b1054ac985aebc90c0a78202dab8477b74d7818a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 15 Aug 2007 10:09:47 +1000 Subject: [PATCH 03/95] gitk: Fix warning when removing a branch When we had two heads on the same commit, and the user tried to remove one of them, gitk was sometimes incorrectly saying that the commits on that branch weren't on any other branch. This fixes it. Signed-off-by: Paul Mackerras --- gitk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 57617d58b0..6faa7f7ef1 100755 --- a/gitk +++ b/gitk @@ -6168,7 +6168,7 @@ proc cobranch {} { proc rmbranch {} { global headmenuid headmenuhead mainhead - global headids idheads + global idheads set head $headmenuhead set id $headmenuid @@ -6178,7 +6178,7 @@ proc rmbranch {} { return } set dheads [descheads $id] - if {$dheads eq $headids($head)} { + if {$idheads($dheads) eq $head} { # the stuff on this branch isn't on any other branch if {![confirm_popup "The commits on branch $head aren't on any other\ branch.\nReally delete branch $head?"]} return From 890fae7041bb0607f386ac1a996a49530f1cd86f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 12 Aug 2007 12:05:46 +0200 Subject: [PATCH 04/95] [PATCH] gitk: Let user easily specify lines of context in diff view More lines of context sometimes help to better understand a diff. This patch introduces a text field above the box displaying the blobdiffs. You can type in the number of lines of context that you wish to view. The number of lines of context is saved to ~/.gitk. Signed-off-by: Steffen Prohaska Signed-off-by: Paul Mackerras --- gitk | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 6faa7f7ef1..15e4a94ebf 100755 --- a/gitk +++ b/gitk @@ -519,6 +519,7 @@ proc makewindow {} { global textfont mainfont uifont tabstop global findtype findtypemenu findloc findstring fstring geometry global entries sha1entry sha1string sha1but + global diffcontextstring diffcontext global maincursor textcursor curtextcursor global rowctxmenu fakerowmenu mergemax wrapcomment global highlight_files gdttype @@ -733,7 +734,17 @@ proc makewindow {} { -command changediffdisp -variable diffelide -value {0 1} radiobutton .bleft.mid.new -text "New version" \ -command changediffdisp -variable diffelide -value {1 0} + label .bleft.mid.labeldiffcontext -text " Lines of context: " \ + -font $uifont pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left + spinbox .bleft.mid.diffcontext -width 5 -font $textfont \ + -from 1 -increment 1 -to 10000000 \ + -validate all -validatecommand "diffcontextvalidate %P" \ + -textvariable diffcontextstring + .bleft.mid.diffcontext set $diffcontext + trace add variable diffcontextstring write diffcontextchange + lappend entries .bleft.mid.diffcontext + pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left set ctext .bleft.ctext text $ctext -background $bgcolor -foreground $fgcolor \ -tabs "[expr {$tabstop * $charspc}]" \ @@ -1002,7 +1013,7 @@ proc savestuff {w} { global maxwidth showneartags showlocalchanges global viewname viewfiles viewargs viewperm nextviewnum global cmitmode wrapcomment - global colors bgcolor fgcolor diffcolors selectbgcolor + global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor if {$stuffsaved} return if {![winfo viewable .]} return @@ -1023,6 +1034,7 @@ proc savestuff {w} { puts $f [list set fgcolor $fgcolor] puts $f [list set colors $colors] puts $f [list set diffcolors $diffcolors] + puts $f [list set diffcontext $diffcontext] puts $f [list set selectbgcolor $selectbgcolor] puts $f "set geometry(main) [wm geometry .]" @@ -5052,12 +5064,29 @@ proc gettreediffline {gdtf ids} { return 0 } +# empty string or positive integer +proc diffcontextvalidate {v} { + return [regexp {^(|[1-9][0-9]*)$} $v] +} + +proc diffcontextchange {n1 n2 op} { + global diffcontextstring diffcontext + + if {[string is integer -strict $diffcontextstring]} { + if {$diffcontextstring > 0} { + set diffcontext $diffcontextstring + reselectline + } + } +} + proc getblobdiffs {ids} { global diffopts blobdifffd diffids env global diffinhdr treediffs + global diffcontext set env(GIT_DIFF_OPTS) $diffopts - if {[catch {set bdf [open [diffcmd $ids {-p -C --no-commit-id}] r]} err]} { + if {[catch {set bdf [open [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"] r]} err]} { puts "error getting diffs: $err" return } @@ -7631,6 +7660,7 @@ set colors {green red blue magenta darkgrey brown orange} set bgcolor white set fgcolor black set diffcolors {red "#00a000" blue} +set diffcontext 3 set selectbgcolor gray85 catch {source ~/.gitk} From e8b5f4be708a73fd8b6c06a782168d5b04e3e5c1 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Tue, 14 Aug 2007 22:02:04 +0200 Subject: [PATCH 05/95] [PATCH] gitk: Make the date/time display configurable The new 'datetimeformat' configuration variable in ~/.gitk can be set to a Tcl 'clock format' format string to modify the display of dates and times. http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm has a list of allowed fields. Signed-off-by: Arjen Laarhoven Signed-off-by: Paul Mackerras --- gitk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 15e4a94ebf..aa8baf857e 100755 --- a/gitk +++ b/gitk @@ -1012,7 +1012,7 @@ proc savestuff {w} { global stuffsaved findmergefiles maxgraphpct global maxwidth showneartags showlocalchanges global viewname viewfiles viewargs viewperm nextviewnum - global cmitmode wrapcomment + global cmitmode wrapcomment datetimeformat global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor if {$stuffsaved} return @@ -1030,6 +1030,7 @@ proc savestuff {w} { puts $f [list set wrapcomment $wrapcomment] puts $f [list set showneartags $showneartags] puts $f [list set showlocalchanges $showlocalchanges] + puts $f [list set datetimeformat $datetimeformat] puts $f [list set bgcolor $bgcolor] puts $f [list set fgcolor $fgcolor] puts $f [list set colors $colors] @@ -7341,8 +7342,9 @@ proc prefsok {} { } proc formatdate {d} { + global datetimeformat if {$d ne {}} { - set d [clock format $d -format "%Y-%m-%d %H:%M:%S"] + set d [clock format $d -format $datetimeformat] } return $d } @@ -7655,6 +7657,7 @@ set showneartags 1 set maxrefs 20 set maxlinelen 200 set showlocalchanges 1 +set datetimeformat "%Y-%m-%d %H:%M:%S" set colors {green red blue magenta darkgrey brown orange} set bgcolor white From d7b16113a128ff04134cec4a8e241cf9cd0a49a2 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Fri, 17 Aug 2007 17:57:31 +1000 Subject: [PATCH 06/95] gitk: Fix bug in fix for warning when removing a branch My fix in commit b1054ac985aebc90c0a78202dab8477b74d7818a was only half-right, since it ignored the case where the descendent heads of the head being removed correspond to two or more different commits. This fixes it. Reported by Mark Levedahl. Signed-off-by: Paul Mackerras --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index aa8baf857e..0b5cfee0a7 100755 --- a/gitk +++ b/gitk @@ -6208,7 +6208,7 @@ proc rmbranch {} { return } set dheads [descheads $id] - if {$idheads($dheads) eq $head} { + if {[llength $dheads] == 1 && $idheads($dheads) eq $head} { # the stuff on this branch isn't on any other branch if {![confirm_popup "The commits on branch $head aren't on any other\ branch.\nReally delete branch $head?"]} return From d1cb298b0b74972cc27c789e4c9ce6f324f25113 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 16 Aug 2007 14:32:29 +0200 Subject: [PATCH 07/95] [PATCH] gitk: Handle 'copy from' and 'copy to' in diff headers. If a commit contained a copy operation, the file name was not correctly determined, and the corresponding part of the patch could not be navigated to from the list of files. Signed-off-by: Johannes Sixt Signed-off-by: Paul Mackerras --- gitk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gitk b/gitk index 0b5cfee0a7..6b0569a5f4 100755 --- a/gitk +++ b/gitk @@ -5146,8 +5146,8 @@ proc getblobdiffline {bdf ids} { # the middle char will be a space, and the two bits either # side will be a/name and b/name, or "a/name" and "b/name". # If the name has changed we'll get "rename from" and - # "rename to" lines following this, and we'll use them - # to get the filenames. + # "rename to" or "copy from" and "copy to" lines following this, + # and we'll use them to get the filenames. # This complexity is necessary because spaces in the filename(s) # don't get escaped. set l [string length $line] @@ -5171,8 +5171,9 @@ proc getblobdiffline {bdf ids} { set diffinhdr 0 } elseif {$diffinhdr} { - if {![string compare -length 12 "rename from " $line]} { - set fname [string range $line 12 end] + if {![string compare -length 12 "rename from " $line] || + ![string compare -length 10 "copy from " $line]} { + set fname [string range $line [expr 6 + [string first " from " $line] ] end] if {[string index $fname 0] eq "\""} { set fname [lindex $fname 0] } @@ -5180,8 +5181,9 @@ proc getblobdiffline {bdf ids} { if {$i >= 0} { setinlist difffilestart $i $curdiffstart } - } elseif {![string compare -length 10 $line "rename to "]} { - set fname [string range $line 10 end] + } elseif {![string compare -length 10 $line "rename to "] || + ![string compare -length 8 $line "copy to "]} { + set fname [string range $line [expr 4 + [string first " to " $line] ] end] if {[string index $fname 0] eq "\""} { set fname [lindex $fname 0] } From 97a5d8cce913aa1727a026a07422a0c9b5ca0e38 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 4 Aug 2007 16:25:53 +0200 Subject: [PATCH 08/95] git-submodule: re-enable 'status' as the default subcommand This was broken as part of ecda072380. Signed-off-by: Lars Hjemli Acked-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- git-submodule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-submodule.sh b/git-submodule.sh index 2cfeaddbc2..3320998c76 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -313,7 +313,7 @@ case "$add,$init,$update,$status,$cached" in ,,1,,) modules_update "$@" ;; -,,,1,*) +,,,*,*) modules_list "$@" ;; *) From e63b58ba0b67262674c94321693c4f84a58ecf80 Mon Sep 17 00:00:00 2001 From: Sean Estabrooks Date: Fri, 17 Aug 2007 17:38:24 -0400 Subject: [PATCH 09/95] Fix small typo in git send-email man page. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- Documentation/git-send-email.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index d243ed1e3a..08a023ea92 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -62,7 +62,7 @@ The --cc option must be repeated for each user you want on the cc list. --signed-off-by-cc, --no-signed-off-by-cc:: If this is set, add emails found in Signed-off-by: or Cc: lines to the cc list. - Default is the value of 'sendemail.signedoffbycc' configuration value; + Default is the value of 'sendemail.signedoffcc' configuration value; if that is unspecified, default to --signed-off-by-cc. --quiet:: From 5876b8ee3c09553912a4d033051bb25faa52ad94 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Fri, 17 Aug 2007 19:13:04 -0400 Subject: [PATCH 10/95] Minor clarifications to git-filter-branch usage and doc - Remove "DESTBRANCH" from usage, as it rewrites the branches given. - Remove an = from an example usage, as the script doesn't understand it. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Documentation/git-filter-branch.txt | 2 +- git-filter-branch.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index 915258f410..8c43be611a 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -120,7 +120,7 @@ have all of them as parents. tag name is expected on standard output. + The original tags are not deleted, but can be overwritten; -use "--tag-name-filter=cat" to simply update the tags. In this +use "--tag-name-filter cat" to simply update the tags. In this case, be very careful and make sure you have the old tags backed up in case the conversion has run afoul. + diff --git a/git-filter-branch.sh b/git-filter-branch.sh index c42e4512cf..01900602e1 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -8,7 +8,7 @@ # a new branch. You can specify a number of filters to modify the commits, # files and trees. -USAGE="git-filter-branch [-d TEMPDIR] [FILTERS] DESTBRANCH [REV-RANGE]" +USAGE="git-filter-branch [-d TEMPDIR] [FILTERS] [REV-RANGE]" . git-sh-setup warn () { From 0734d2656a3098f66b835b35f9f81079854ebb9f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 17 Aug 2007 22:13:36 +0200 Subject: [PATCH 11/95] Clarify commit-tree documentation As per http://marc.info/?l=git&m=118737219702802&w=2 , clarify git-commit-tree documentation. Signed-off-by: Mike Hommey Signed-off-by: Junio C Hamano --- Documentation/git-commit-tree.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index 5870c2ce47..6a328f497e 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -51,9 +51,9 @@ A commit encapsulates: - author name, email and date - committer name and email and the commit time. -If not provided, "git-commit-tree" uses your name, hostname and domain to -provide author and committer info. This can be overridden by -either `.git/config` file, or using the following environment variables. +While parent object ids are provided on the command line, author and +commiter information is taken from the following environment variables, +if set: GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL @@ -65,12 +65,9 @@ either `.git/config` file, or using the following environment variables. (nb "<", ">" and "\n"s are stripped) -In `.git/config` file, the following items are used for GIT_AUTHOR_NAME and -GIT_AUTHOR_EMAIL: - - [user] - name = "Your Name" - email = "your@email.address.xz" +In case (some of) these environment variables are not set, the information +is taken from the configuration items user.name and user.email, or, if not +present, system user name and fully qualified hostname. A commit comment is read from stdin. If a changelog entry is not provided via "<" redirection, "git-commit-tree" will just wait From 374a58c9fbd4613800d01087c77373e561db90ae Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Sun, 12 Aug 2007 14:46:12 -0400 Subject: [PATCH 12/95] git-completion.bash - add support for git-bundle Signed-off-by: Mark Levedahl Signed-off-by: Shawn O. Pearce --- contrib/completion/git-completion.bash | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 82b9ed40d8..52b2893844 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -459,6 +459,35 @@ _git_branch () __gitcomp "$(__git_refs)" } +_git_bundle () +{ + local mycword="$COMP_CWORD" + case "${COMP_WORDS[0]}" in + git) + local cmd="${COMP_WORDS[2]}" + mycword="$((mycword-1))" + ;; + git-bundle*) + local cmd="${COMP_WORDS[1]}" + ;; + esac + case "$mycword" in + 1) + __gitcomp "create list-heads verify unbundle" + ;; + 2) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + _git_checkout () { __gitcomp "$(__git_refs)" @@ -1009,6 +1038,7 @@ _git () add) _git_add ;; apply) _git_apply ;; bisect) _git_bisect ;; + bundle) _git_bundle ;; branch) _git_branch ;; checkout) _git_checkout ;; cherry) _git_cherry ;; @@ -1057,6 +1087,7 @@ complete -o default -o nospace -F _git_am git-am complete -o default -o nospace -F _git_apply git-apply complete -o default -o nospace -F _git_bisect git-bisect complete -o default -o nospace -F _git_branch git-branch +complete -o default -o nospace -F _git_bundle git-bundle complete -o default -o nospace -F _git_checkout git-checkout complete -o default -o nospace -F _git_cherry git-cherry complete -o default -o nospace -F _git_cherry_pick git-cherry-pick @@ -1092,6 +1123,7 @@ complete -o default -o nospace -F _git_add git-add.exe complete -o default -o nospace -F _git_apply git-apply.exe complete -o default -o nospace -F _git git.exe complete -o default -o nospace -F _git_branch git-branch.exe +complete -o default -o nospace -F _git_bundle git-bundle.exe complete -o default -o nospace -F _git_cherry git-cherry.exe complete -o default -o nospace -F _git_diff git-diff.exe complete -o default -o nospace -F _git_format_patch git-format-patch.exe From c905e09006838c209be842dbe740943b2ad2d25b Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Sun, 15 Jul 2007 10:57:40 +0200 Subject: [PATCH 13/95] Fix whitespace in "Format of STDIN stream" of fast-import Something probably assumed that HT indentation is 4 characters. Signed-off-by: Alex Riesen Signed-off-by: Shawn O. Pearce --- fast-import.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fast-import.c b/fast-import.c index 170cccdceb..b28f90dc22 100644 --- a/fast-import.c +++ b/fast-import.c @@ -11,7 +11,7 @@ Format of STDIN stream: ; new_blob ::= 'blob' lf - mark? + mark? file_content; file_content ::= data; @@ -42,7 +42,7 @@ Format of STDIN stream: new_tag ::= 'tag' sp tag_str lf 'from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf - 'tagger' sp name '<' email '>' when lf + 'tagger' sp name '<' email '>' when lf tag_msg; tag_msg ::= data; @@ -56,9 +56,9 @@ Format of STDIN stream: # note: the first idnum in a stream should be 1 and subsequent # idnums should not have gaps between values as this will cause # the stream parser to reserve space for the gapped values. An - # idnum can be updated in the future to a new object by issuing + # idnum can be updated in the future to a new object by issuing # a new mark directive with the old idnum. - # + # mark ::= 'mark' sp idnum lf; data ::= (delimited_data | exact_data) lf; @@ -68,7 +68,7 @@ Format of STDIN stream: # delim. delimited_data ::= 'data' sp '<<' delim lf (data_line lf)* - delim lf; + delim lf; # note: declen indicates the length of binary_data in bytes. # declen does not include the lf preceeding the binary data. @@ -78,10 +78,10 @@ Format of STDIN stream: # note: quoted strings are C-style quoting supporting \c for # common escapes of 'c' (e..g \n, \t, \\, \") or \nnn where nnn - # is the signed byte value in octal. Note that the only + # is the signed byte value in octal. Note that the only # characters which must actually be escaped to protect the # stream formatting is: \, " and LF. Otherwise these values - # are UTF8. + # are UTF8. # ref_str ::= ref; sha1exp_str ::= sha1exp; @@ -104,9 +104,9 @@ Format of STDIN stream: lf ::= # ASCII newline (LF) character; # note: a colon (':') must precede the numerical value assigned to - # an idnum. This is to distinguish it from a ref or tag name as + # an idnum. This is to distinguish it from a ref or tag name as # GIT does not permit ':' in ref or tag strings. - # + # idnum ::= ':' bigint; path ::= # GIT style file path, e.g. "a/b/c"; ref ::= # GIT ref name, e.g. "refs/heads/MOZ_GECKO_EXPERIMENT"; @@ -115,9 +115,9 @@ Format of STDIN stream: hexsha1 ::= # SHA1 in hexadecimal format; # note: name and email are UTF8 strings, however name must not - # contain '<' or lf and email must not contain any of the + # contain '<' or lf and email must not contain any of the # following: '<', '>', lf. - # + # name ::= # valid GIT author/committer name; email ::= # valid GIT author/committer email; ts ::= # time since the epoch in seconds, ascii base10 notation; From ea08a6fd194991f9d800e4cac5ae55fdb02dd235 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 2 Aug 2007 23:37:21 -0400 Subject: [PATCH 14/95] Actually allow TAG_FIXUP branches in fast-import Michael Haggerty noticed while debugging a Git backend for cvs2svn that fast-import was barfing when he tried to use "TAG_FIXUP" as a branch name for temporary work needed to cleanup the tree prior to creating an annotated tag object. The reason we were rejecting the branch name was check_ref_format() returns -2 when there are less than 2 '/' characters in the input name. TAG_FIXUP has 0 '/' characters, but is technically just as valid of a ref as HEAD and MERGE_HEAD, so we really should permit it (and any other similar looking name) during import. New test cases have been added to make sure we still detect very wrong branch names (e.g. containing [ or starting with .) and yet still permit reasonable names (e.g. TAG_FIXUP). Signed-off-by: Shawn O. Pearce --- fast-import.c | 6 +++++- t/t9300-fast-import.sh | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/fast-import.c b/fast-import.c index b28f90dc22..7e136a616e 100644 --- a/fast-import.c +++ b/fast-import.c @@ -524,8 +524,12 @@ static struct branch *new_branch(const char *name) if (b) die("Invalid attempt to create duplicate branch: %s", name); - if (check_ref_format(name)) + switch (check_ref_format(name)) { + case 0: break; /* its valid */ + case -2: break; /* valid, but too few '/', allow anyway */ + default: die("Branch name doesn't conform to GIT standards: %s", name); + } b = pool_calloc(1, sizeof(struct branch)); b->name = pool_strdup(name); diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 6f95305bf4..dac6135b22 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -170,6 +170,53 @@ test_expect_failure \ 'git-fast-import input < $GIT_COMMITTER_DATE +data <input < $GIT_COMMITTER_DATE +data <input < $GIT_COMMITTER_DATE +data < Date: Wed, 1 Aug 2007 00:32:36 -0400 Subject: [PATCH 15/95] Use handy ALLOC_GROW macro in fast-import when possible Instead of growing our buffer by hand during the inline variant of cmd_data() we can save a few lines of code and just use the nifty new ALLOC_GROW macro already available to us. Signed-off-by: Shawn O. Pearce --- fast-import.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index 7e136a616e..d7fa2b7baa 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1487,12 +1487,7 @@ static void *cmd_data (size_t *size) if (term_len == command_buf.len && !strcmp(term, command_buf.buf)) break; - if (sz < (length + command_buf.len)) { - sz = sz * 3 / 2 + 16; - if (sz < (length + command_buf.len)) - sz = length + command_buf.len; - buffer = xrealloc(buffer, sz); - } + ALLOC_GROW(buffer, length + command_buf.len, sz); memcpy(buffer + length, command_buf.buf, command_buf.len - 1); From 401d53fa35098266e2a4a904a4598b59f1b74663 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 1 Aug 2007 00:05:15 -0400 Subject: [PATCH 16/95] Teach fast-import to ignore lines starting with '#' Several frontend developers have asked that some form of stream comments be permitted within a fast-import data stream. This way they can include information from their own frontend program about where specific data was taken from in the source system, or about a decision that their frontend may have made while creating the fast-import data stream. This change introduces comments in the Bourne-shell/Tcl/Perl style. Lines starting with '#' are ignored, up to and including the LF. Unlike the above mentioned three languages however we do not look for and ignore leading whitespace. This just simplifies the definition of the comment format and the code that parses them. To make comments work we had to stop using read_next_command() within cmd_data() and directly invoke read_line() during the inline variant of the function. This is necessary to retain any lines of the input data that might otherwise look like a comment to fast-import. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 14 +++++++++++ fast-import.c | 17 +++++++++++-- t/t9300-fast-import.sh | 40 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 30ee98d17f..a92ae6d1a3 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -176,6 +176,15 @@ results, such as branch names or file names with leading or trailing spaces in their name, or early termination of fast-import when it encounters unexpected input. +Stream Comments +~~~~~~~~~~~~~~~ +To aid in debugging frontends fast-import ignores any line that +begins with `#` (ASCII pound/hash) up to and including the line +ending `LF`. A comment line may contain any sequence of bytes +that does not contain an LF and therefore may be used to include +any detailed debugging information that might be specific to the +frontend and useful when inspecting a fast-import data stream. + Date Formats ~~~~~~~~~~~~ The following date formats are supported. A frontend should select @@ -689,6 +698,11 @@ intended for production-quality conversions should always use the exact byte count format, as it is more robust and performs better. The delimited format is intended primarily for testing fast-import. +Comment lines appearing within the `` part of `data` commands +are always taken to be part of the body of the data and are therefore +never ignored by fast-import. This makes it safe to import any +file/message content whose lines might start with `#`. + Exact byte count format:: The frontend must specify the number of bytes of data. + diff --git a/fast-import.c b/fast-import.c index d7fa2b7baa..98ebe4770d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -122,6 +122,17 @@ Format of STDIN stream: email ::= # valid GIT author/committer email; ts ::= # time since the epoch in seconds, ascii base10 notation; tz ::= # GIT style timezone; + + # note: comments may appear anywhere in the input, except + # within a data command. Any form of the data command + # always escapes the related input from comment processing. + # + # In case it is not clear, the '#' that starts the comment + # must be the first character on that the line (an lf have + # preceeded it). + # + comment ::= '#' not_lf* lf; + not_lf ::= # Any byte that is not ASCII newline (LF); */ #include "builtin.h" @@ -1454,7 +1465,9 @@ static void dump_marks(void) static void read_next_command(void) { - read_line(&command_buf, stdin, '\n'); + do { + read_line(&command_buf, stdin, '\n'); + } while (!command_buf.eof && command_buf.buf[0] == '#'); } static void cmd_mark(void) @@ -1481,7 +1494,7 @@ static void *cmd_data (size_t *size) length = 0; buffer = xmalloc(sz); for (;;) { - read_next_command(); + read_line(&command_buf, stdin, '\n'); if (command_buf.eof) die("EOF in data (terminator '%s' not found)", term); if (term_len == command_buf.len diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index dac6135b22..1f6426a49e 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -778,4 +778,44 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +# $GIT_COMMITTER_NAME has inserted here for his benefit. +data < Date: Wed, 1 Aug 2007 00:24:25 -0400 Subject: [PATCH 17/95] Make trailing LF following fast-import `data` commands optional A few fast-import frontend developers have found it odd that we require the LF following a `data` command, especially in the exact byte count format. Technically we don't need this LF to parse the stream properly, but having it here does make the stream more readable to humans. We can easily make the LF optional by peeking at the next byte available from the stream and pushing it back into the buffer if its not LF. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 10 +++++++++- fast-import.c | 13 +++++++++---- t/t9300-fast-import.sh | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index a92ae6d1a3..eb0c8c48ee 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -708,13 +708,18 @@ Exact byte count format:: + .... 'data' SP LF - LF + LF? .... + where `` is the exact number of bytes appearing within ``. The value of `` is expressed as an ASCII decimal integer. The `LF` on either side of `` is not included in `` and will not be included in the imported data. ++ +The `LF` after `` is optional (it used to be required) but +recommended. Always including it makes debugging a fast-import +stream easier as the next command always starts in column 0 +of the next line, even if `` did not end with an `LF`. Delimited format:: A delimiter string is used to mark the end of the data. @@ -726,6 +731,7 @@ Delimited format:: 'data' SP '<<' LF LF LF + LF? .... + where `` is the chosen delimiter string. The string `` @@ -734,6 +740,8 @@ fast-import will think the data ends earlier than it really does. The `LF` immediately trailing `` is part of ``. This is one of the limitations of the delimited format, it is impossible to supply a data chunk which does not have an LF as its last byte. ++ +The `LF` after ` LF` is optional (it used to be required). `checkpoint` ~~~~~~~~~~~~ diff --git a/fast-import.c b/fast-import.c index 98ebe4770d..f950cff5ef 100644 --- a/fast-import.c +++ b/fast-import.c @@ -61,7 +61,7 @@ Format of STDIN stream: # mark ::= 'mark' sp idnum lf; data ::= (delimited_data | exact_data) - lf; + lf?; # note: delim may be any string but must not contain lf. # data_line may contain any data but must not be exactly @@ -1470,6 +1470,13 @@ static void read_next_command(void) } while (!command_buf.eof && command_buf.buf[0] == '#'); } +static void skip_optional_lf() +{ + int term_char = fgetc(stdin); + if (term_char != '\n' && term_char != EOF) + ungetc(term_char, stdin); +} + static void cmd_mark(void) { if (!prefixcmp(command_buf.buf, "mark :")) { @@ -1522,9 +1529,7 @@ static void *cmd_data (size_t *size) } } - if (fgetc(stdin) != '\n') - die("An lf did not trail the binary data as expected."); - + skip_optional_lf(); *size = length; return buffer; } diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 1f6426a49e..5be6f196bd 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -818,4 +818,25 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +data < Date: Wed, 1 Aug 2007 02:22:53 -0400 Subject: [PATCH 18/95] Make trailing LF optional for all fast-import commands For the same reasons as the prior change we want to allow frontends to omit the trailing LF that usually delimits commands. In some cases these just make the input stream more verbose looking than it needs to be, and its just simpler for the frontend developer to get started if our parser is slightly more lenient about where an LF is required and where it isn't. To make this optional LF feature work we now have to buffer up to one line of input in command_buf. This buffering can happen if we look at the current input command but don't recognize it at this point in the code. In such a case we need to "unget" the entire line, but we cannot depend upon the stdio library to let us do ungetc() for that many characters at once. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 11 ++++++-- fast-import.c | 34 +++++++++++++---------- t/t9300-fast-import.sh | 46 +++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index eb0c8c48ee..1644b90cea 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -312,7 +312,7 @@ change to the project. ('from' SP LF)? ('merge' SP LF)? (filemodify | filedelete | filecopy | filerename | filedeleteall)* - LF + LF? .... where `` is the name of the branch to make the commit on. @@ -343,6 +343,8 @@ all `filemodify`, `filecopy` and `filerename` commands in the same commit, as `filedeleteall` wipes the branch clean (see below). +The `LF` after the command is optional (it used to be required). + `author` ^^^^^^^^ An `author` command may optionally appear, if the author information @@ -654,12 +656,14 @@ branch from an existing commit without creating a new commit. .... 'reset' SP LF ('from' SP LF)? - LF + LF? .... For a detailed description of `` and `` see above under `commit` and `from`. +The `LF` after the command is optional (it used to be required). + The `reset` command can also be used to create lightweight (non-annotated) tags. For example: @@ -750,7 +754,7 @@ save out all current branch refs, tags and marks. .... 'checkpoint' LF - LF + LF? .... Note that fast-import automatically switches packfiles when the current @@ -769,6 +773,7 @@ process access to a branch. However given that a 30 GiB Subversion repository can be loaded into Git through fast-import in about 3 hours, explicit checkpointing may not be necessary. +The `LF` after the command is optional (it used to be required). Tips and Tricks --------------- diff --git a/fast-import.c b/fast-import.c index f950cff5ef..4bc7f81bcb 100644 --- a/fast-import.c +++ b/fast-import.c @@ -23,7 +23,7 @@ Format of STDIN stream: ('from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)? ('merge' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)* file_change* - lf; + lf?; commit_msg ::= data; file_change ::= file_clr @@ -48,10 +48,10 @@ Format of STDIN stream: reset_branch ::= 'reset' sp ref_str lf ('from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)? - lf; + lf?; checkpoint ::= 'checkpoint' lf - lf; + lf?; # note: the first idnum in a stream should be 1 and subsequent # idnums should not have gaps between values as this will cause @@ -330,6 +330,7 @@ static struct tag *last_tag; /* Input stream parsing */ static whenspec_type whenspec = WHENSPEC_RAW; static struct strbuf command_buf; +static int unread_command_buf; static uintmax_t next_mark; static struct dbuf new_data; @@ -1466,7 +1467,10 @@ static void dump_marks(void) static void read_next_command(void) { do { - read_line(&command_buf, stdin, '\n'); + if (unread_command_buf) + unread_command_buf = 0; + else + read_line(&command_buf, stdin, '\n'); } while (!command_buf.eof && command_buf.buf[0] == '#'); } @@ -1825,13 +1829,13 @@ static void cmd_from_existing(struct branch *b) } } -static void cmd_from(struct branch *b) +static int cmd_from(struct branch *b) { const char *from; struct branch *s; if (prefixcmp(command_buf.buf, "from ")) - return; + return 0; if (b->branch_tree.tree) { release_tree_content_recursive(b->branch_tree.tree); @@ -1866,6 +1870,7 @@ static void cmd_from(struct branch *b) die("Invalid ref name or SHA1 expression: %s", from); read_next_command(); + return 1; } static struct hash_list *cmd_merge(unsigned int *count) @@ -1950,10 +1955,8 @@ static void cmd_new_commit(void) } /* file_change* */ - for (;;) { - if (1 == command_buf.len) - break; - else if (!prefixcmp(command_buf.buf, "M ")) + while (!command_buf.eof && command_buf.len > 1) { + if (!prefixcmp(command_buf.buf, "M ")) file_change_m(b); else if (!prefixcmp(command_buf.buf, "D ")) file_change_d(b); @@ -1963,8 +1966,10 @@ static void cmd_new_commit(void) file_change_cr(b, 0); else if (!strcmp("deleteall", command_buf.buf)) file_change_deleteall(b); - else - die("Unsupported file_change: %s", command_buf.buf); + else { + unread_command_buf = 1; + break; + } read_next_command(); } @@ -2105,7 +2110,8 @@ static void cmd_reset_branch(void) else b = new_branch(sp); read_next_command(); - cmd_from(b); + if (!cmd_from(b) && command_buf.len > 1) + unread_command_buf = 1; } static void cmd_checkpoint(void) @@ -2116,7 +2122,7 @@ static void cmd_checkpoint(void) dump_tags(); dump_marks(); } - read_next_command(); + skip_optional_lf(); } static void import_marks(const char *input_file) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 5be6f196bd..5d82b0f1ce 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -839,4 +839,50 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <expect <actual && + git diff expect actual' + test_done From ac053c02029d88c7ed4d7e92949a1586eb3f7704 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 1 Aug 2007 10:23:08 -0400 Subject: [PATCH 19/95] Allow frontends to bidirectionally communicate with fast-import The existing checkpoint command is very useful to force fast-import to dump the branches out to disk so that standard Git tools can access them and the objects they refer to. However there was not a way to know when fast-import had finished executing the checkpoint and it was safe to read those refs. The progress command can be used to make fast-import output any message of the frontend's choosing to standard out. The frontend can scan for these messages using select() or poll() to monitor a pipe connected to the standard output of fast-import. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 39 +++++++++++++++++++++++++++++++ fast-import.c | 14 +++++++++++ t/t9300-fast-import.sh | 31 ++++++++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 1644b90cea..0a019dd2e5 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -298,6 +298,11 @@ and control the current import process. More detailed discussion This command is optional and is not needed to perform an import. +`progress`:: + Causes fast-import to echo the entire line to its own + standard output. This command is optional and is not needed + to perform an import. + `commit` ~~~~~~~~ Create or update a branch with a new commit, recording one logical @@ -775,6 +780,31 @@ explicit checkpointing may not be necessary. The `LF` after the command is optional (it used to be required). +`progress` +~~~~~~~~~~ +Causes fast-import to print the entire `progress` line unmodified to +its standard output channel (file descriptor 1) when the command is +processed from the input stream. The command otherwise has no impact +on the current import, or on any of fast-import's internal state. + +.... + 'progress' SP LF + LF? +.... + +The `` part of the command may contain any sequence of bytes +that does not contain `LF`. The `LF` after the command is optional. +Callers may wish to process the output through a tool such as sed to +remove the leading part of the line, for example: + +==== + frontend | git-fast-import | sed 's/^progress //' +==== + +Placing a `progress` command immediately after a `checkpoint` will +inform the reader when the `checkpoint` has been completed and it +can safely access the refs that fast-import updated. + Tips and Tricks --------------- The following tips and tricks have been collected from various @@ -867,6 +897,15 @@ This will take longer, but will also produce a smaller packfile. You only need to expend the effort once, and everyone using your project will benefit from the smaller repository. +Include Some Progress Messages +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Every once in a while have your frontend emit a `progress` message +to fast-import. The contents of the messages are entirely free-form, +so one suggestion would be to output the current month and year +each time the current commit date moves into the next month. +Your users will feel better knowing how much of the data stream +has been processed. + Packfile Optimization --------------------- diff --git a/fast-import.c b/fast-import.c index 4bc7f81bcb..429ab491bd 100644 --- a/fast-import.c +++ b/fast-import.c @@ -8,6 +8,7 @@ Format of STDIN stream: | new_tag | reset_branch | checkpoint + | progress ; new_blob ::= 'blob' lf @@ -53,6 +54,9 @@ Format of STDIN stream: checkpoint ::= 'checkpoint' lf lf?; + progress ::= 'progress' sp not_lf* lf + lf?; + # note: the first idnum in a stream should be 1 and subsequent # idnums should not have gaps between values as this will cause # the stream parser to reserve space for the gapped values. An @@ -2125,6 +2129,14 @@ static void cmd_checkpoint(void) skip_optional_lf(); } +static void cmd_progress(void) +{ + fwrite(command_buf.buf, 1, command_buf.len - 1, stdout); + fputc('\n', stdout); + fflush(stdout); + skip_optional_lf(); +} + static void import_marks(const char *input_file) { char line[512]; @@ -2235,6 +2247,8 @@ int main(int argc, const char **argv) cmd_reset_branch(); else if (!strcmp("checkpoint", command_buf.buf)) cmd_checkpoint(); + else if (!prefixcmp(command_buf.buf, "progress ")) + cmd_progress(); else die("Unsupported command: %s", command_buf.buf); } diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 5d82b0f1ce..0595041af5 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -885,4 +885,35 @@ test_expect_success \ git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual && git diff expect actual' +cat >input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <actual && + grep "progress " expect && + git diff expect actual' + test_done From 8acb3297f34fd04bb8f3a35ace3667b59236286e Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 3 Aug 2007 02:00:37 -0400 Subject: [PATCH 20/95] Generate crash reports on die in fast-import As fast-import is quite strict about its input and die()'s anytime something goes wrong it can be difficult for a frontend developer to troubleshoot why fast-import rejected their input, or to even determine what input command it rejected. This change introduces a custom handler for Git's die() routine. When we receive a die() for any reason (fast-import or a lower level core Git routine we called) the error is first dumped onto stderr and then a more extensive crash report file is prepared in GIT_DIR. Finally we exit the process with status 128, just like the stock builtin die handler. An internal flag is set to prevent any further die()'s that may be invoked during the crash report generator from causing us to enter into an infinite loop. We shouldn't die() from our crash report handler, but just in case someone makes a future code change we are prepared to gaurd against small mistakes turning into huge problems for the end-user. Signed-off-by: Shawn O. Pearce --- fast-import.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/fast-import.c b/fast-import.c index 429ab491bd..71b89e2036 100644 --- a/fast-import.c +++ b/fast-import.c @@ -338,6 +338,98 @@ static int unread_command_buf; static uintmax_t next_mark; static struct dbuf new_data; +static void write_branch_report(FILE *rpt, struct branch *b) +{ + fprintf(rpt, "%s:\n", b->name); + + fprintf(rpt, " status :"); + if (b->active) + fputs(" active", rpt); + if (b->branch_tree.tree) + fputs(" loaded", rpt); + if (is_null_sha1(b->branch_tree.versions[1].sha1)) + fputs(" dirty", rpt); + fputc('\n', rpt); + + fprintf(rpt, " tip commit : %s\n", sha1_to_hex(b->sha1)); + fprintf(rpt, " old tree : %s\n", sha1_to_hex(b->branch_tree.versions[0].sha1)); + fprintf(rpt, " cur tree : %s\n", sha1_to_hex(b->branch_tree.versions[1].sha1)); + fprintf(rpt, " commit clock: %" PRIuMAX "\n", b->last_commit); + + fputs(" last pack : ", rpt); + if (b->pack_id < MAX_PACK_ID) + fprintf(rpt, "%u", b->pack_id); + fputc('\n', rpt); + + fputc('\n', rpt); +} + +static void write_crash_report(const char *err, va_list params) +{ + char *loc = git_path("fast_import_crash_%d", getpid()); + FILE *rpt = fopen(loc, "w"); + struct branch *b; + unsigned long lu; + + if (!rpt) { + error("can't write crash report %s: %s", loc, strerror(errno)); + return; + } + + fprintf(stderr, "fast-import: dumping crash report to %s\n", loc); + + fprintf(rpt, "fast-import crash report:\n"); + fprintf(rpt, " fast-import process: %d\n", getpid()); + fprintf(rpt, " parent process : %d\n", getppid()); + fprintf(rpt, " at %s\n", show_date(time(NULL), 0, DATE_LOCAL)); + fputc('\n', rpt); + + fputs("fatal: ", rpt); + vfprintf(rpt, err, params); + fputc('\n', rpt); + + fputc('\n', rpt); + fputs("Active Branch LRU\n", rpt); + fputs("-----------------\n", rpt); + fprintf(rpt, " active_branches = %lu cur, %lu max\n", + cur_active_branches, + max_active_branches); + fputc('\n', rpt); + fputs(" pos clock name\n", rpt); + fputs(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", rpt); + for (b = active_branches, lu = 0; b; b = b->active_next_branch) + fprintf(rpt, " %2lu) %6" PRIuMAX" %s\n", + ++lu, b->last_commit, b->name); + + fputc('\n', rpt); + fputs("Inactive Branches\n", rpt); + fputs("-----------------\n", rpt); + for (lu = 0; lu < branch_table_sz; lu++) { + for (b = branch_table[lu]; b; b = b->table_next_branch) + write_branch_report(rpt, b); + } + + fputc('\n', rpt); + fputs("-------------------\n", rpt); + fputs("END OF CRASH REPORT\n", rpt); + fclose(rpt); +} + +static NORETURN void die_nicely(const char *err, va_list params) +{ + static int zombie; + + fputs("fatal: ", stderr); + vfprintf(stderr, err, params); + fputc('\n', stderr); + + if (!zombie) { + zombie = 1; + write_crash_report(err, params); + } + + exit(128); +} static void alloc_objects(unsigned int cnt) { @@ -2233,6 +2325,7 @@ int main(int argc, const char **argv) prepare_packed_git(); start_packfile(); + set_die_routine(die_nicely); for (;;) { read_next_command(); if (command_buf.eof) From 904b1941514e78543bd636b4db71fbcf57898388 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 3 Aug 2007 04:47:04 -0400 Subject: [PATCH 21/95] Include recent command history in fast-import crash reports When we crash the frontend developer (or end-user) may need to know roughly around what part of the input stream we had a problem with and aborted on. Because line numbers aren't very useful in this sort of application we instead just keep the last 100 commands in a FIFO queue and print them as part of the crash report. Currently one problem with this design is a commit that has more than 100 modified files in it will flood the FIFO and any context regarding branch/from/committer/mark/comments will be lost. We really should save only the last few (10?) file changes for the current commit, ensuring we have some prior higher level commands in the FIFO when we crash on a file M/D/C/R command. Another issue with this approach is the FIFO only includes the commands, it does not include the commit messages. Yet having a commit message may be useful to help locate the relevant change in the source material. In practice I don't think this is going to be a major concern as the frontend can always embed its own source change set identifier as a comment (which will appear in the crash report) and the commit message(s) for the most recent commits of any given branch should be obtainable from the (packed) commit objects. Signed-off-by: Shawn O. Pearce --- fast-import.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/fast-import.c b/fast-import.c index 71b89e2036..5085fbf116 100644 --- a/fast-import.c +++ b/fast-import.c @@ -269,6 +269,13 @@ typedef enum { WHENSPEC_NOW, } whenspec_type; +struct recent_command +{ + struct recent_command *prev; + struct recent_command *next; + char *buf; +}; + /* Configured limits on output */ static unsigned long max_depth = 10; static off_t max_packsize = (1LL << 32) - 1; @@ -335,6 +342,10 @@ static struct tag *last_tag; static whenspec_type whenspec = WHENSPEC_RAW; static struct strbuf command_buf; static int unread_command_buf; +static struct recent_command cmd_hist = {&cmd_hist, &cmd_hist, NULL}; +static struct recent_command *cmd_tail = &cmd_hist; +static struct recent_command *rc_free; +static unsigned int cmd_save = 100; static uintmax_t next_mark; static struct dbuf new_data; @@ -370,6 +381,7 @@ static void write_crash_report(const char *err, va_list params) FILE *rpt = fopen(loc, "w"); struct branch *b; unsigned long lu; + struct recent_command *rc; if (!rpt) { error("can't write crash report %s: %s", loc, strerror(errno)); @@ -388,6 +400,18 @@ static void write_crash_report(const char *err, va_list params) vfprintf(rpt, err, params); fputc('\n', rpt); + fputc('\n', rpt); + fputs("Most Recent Commands Before Crash\n", rpt); + fputs("---------------------------------\n", rpt); + for (rc = cmd_hist.next; rc != &cmd_hist; rc = rc->next) { + if (rc->next == &cmd_hist) + fputs("* ", rpt); + else + fputs(" ", rpt); + fputs(rc->buf, rpt); + fputc('\n', rpt); + } + fputc('\n', rpt); fputs("Active Branch LRU\n", rpt); fputs("-----------------\n", rpt); @@ -1563,11 +1587,35 @@ static void dump_marks(void) static void read_next_command(void) { do { - if (unread_command_buf) + if (unread_command_buf) { unread_command_buf = 0; - else + if (command_buf.eof) + return; + } else { + struct recent_command *rc; + + command_buf.buf = NULL; read_line(&command_buf, stdin, '\n'); - } while (!command_buf.eof && command_buf.buf[0] == '#'); + if (command_buf.eof) + return; + + rc = rc_free; + if (rc) + rc_free = rc->next; + else { + rc = cmd_hist.next; + cmd_hist.next = rc->next; + cmd_hist.next->prev = &cmd_hist; + free(rc->buf); + } + + rc->buf = command_buf.buf; + rc->prev = cmd_tail; + rc->next = cmd_hist.prev; + rc->prev->next = rc; + cmd_tail = rc; + } + } while (command_buf.buf[0] == '#'); } static void skip_optional_lf() @@ -1600,6 +1648,7 @@ static void *cmd_data (size_t *size) size_t sz = 8192, term_len = command_buf.len - 5 - 2; length = 0; buffer = xmalloc(sz); + command_buf.buf = NULL; for (;;) { read_line(&command_buf, stdin, '\n'); if (command_buf.eof) @@ -2269,7 +2318,7 @@ static const char fast_import_usage[] = int main(int argc, const char **argv) { - int i, show_stats = 1; + unsigned int i, show_stats = 1; git_config(git_default_config); alloc_objects(object_entry_alloc); @@ -2323,6 +2372,11 @@ int main(int argc, const char **argv) if (i != argc) usage(fast_import_usage); + rc_free = pool_alloc(cmd_save * sizeof(*rc_free)); + for (i = 0; i < (cmd_save - 1); i++) + rc_free[i].next = &rc_free[i + 1]; + rc_free[cmd_save - 1].next = NULL; + prepare_packed_git(); start_packfile(); set_die_routine(die_nicely); From 7e5dcea8311472156ed0fea164e689777353f931 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 19 Aug 2007 02:50:18 -0700 Subject: [PATCH 22/95] fast-import pull request * skip_optional_lf() decl is old-style -- please say static skip_optional_lf(void) { ... } * t9300 #14 fails, like this: * expecting failure: git-fast-import 8 -- Subject: [PATCH] fastimport: Fix re-use of va_list The va_list is designed to be used only once. The current code reuses va_list argument may cause segmentation fault. Copy and release the arguments to avoid this problem. While we are at it, fix old-style function declaration of skip_optional_lf(). Signed-off-by: Junio C Hamano Signed-off-by: Shawn O. Pearce --- fast-import.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fast-import.c b/fast-import.c index 5085fbf116..2d5224c186 100644 --- a/fast-import.c +++ b/fast-import.c @@ -442,16 +442,18 @@ static void write_crash_report(const char *err, va_list params) static NORETURN void die_nicely(const char *err, va_list params) { static int zombie; + va_list x_params; + va_copy(x_params, params); fputs("fatal: ", stderr); vfprintf(stderr, err, params); fputc('\n', stderr); if (!zombie) { zombie = 1; - write_crash_report(err, params); + write_crash_report(err, x_params); } - + va_end(x_params); exit(128); } @@ -1618,7 +1620,7 @@ static void read_next_command(void) } while (command_buf.buf[0] == '#'); } -static void skip_optional_lf() +static void skip_optional_lf(void) { int term_char = fgetc(stdin); if (term_char != '\n' && term_char != EOF) From 95064cbcc8a51fb9e3c16350e8c567a84d131ad7 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 19 Aug 2007 04:18:47 -0400 Subject: [PATCH 23/95] Correct documentation of 'reflog show' to explain it shows HEAD By default 'git reflog show' will show the reflog of 'HEAD' and not the reflog of the current branch. This is most likely due to the work done a while ago as part of the detached HEAD series to allow HEAD to have its own reflog independent of each branch's reflog. Since 'git reflog show' is really just an obscure alias for 'git log -g --abbrev-commit --pretty=oneline' it should behave the same way and its documentation should match. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-reflog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt index 89bc9c51ea..29b7d9f5f8 100644 --- a/Documentation/git-reflog.txt +++ b/Documentation/git-reflog.txt @@ -32,7 +32,8 @@ directly by the end users -- instead, see gitlink:git-gc[1]. The subcommand "show" (which is also the default, in the absense of any subcommands) will take all the normal log options, and show the log of -the current branch. It is basically an alias for 'git log -g --abbrev-commit +`HEAD`, which will cover all recent actions, including branch switches. +It is basically an alias for 'git log -g --abbrev-commit --pretty=oneline', see gitlink:git-log[1]. From 1211be6bed1146dcef953c7c2ab332ee995f7152 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 17 Aug 2007 09:56:54 -0700 Subject: [PATCH 24/95] Make thin-pack generation subproject aware. When a thin pack wants to send a tree object at "sub/dir", and the commit that is common between the sender and the receiver that is used as the base object has a subproject at that path, we should not try to use the data at "sub/dir" of the base tree as a tree object. It is not a tree to begin with, and more importantly, the commit object there does not have to even exist. Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 2 ++ t/t3050-subprojects-fetch.sh | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 t/t3050-subprojects-fetch.sh diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 24926db27a..77481df5d6 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -979,6 +979,8 @@ static void add_pbase_object(struct tree_desc *tree, int cmp; while (tree_entry(tree,&entry)) { + if (S_ISGITLINK(entry.mode)) + continue; cmp = tree_entry_len(entry.path, entry.sha1) != cmplen ? 1 : memcmp(name, entry.path, cmplen); if (cmp > 0) diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh new file mode 100755 index 0000000000..34f26a8d9e --- /dev/null +++ b/t/t3050-subprojects-fetch.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +test_description='fetching and pushing project with subproject' + +. ./test-lib.sh + +test_expect_success setup ' + test_tick && + mkdir -p sub && ( + cd sub && + git init && + >subfile && + git add subfile + git commit -m "subproject commit #1" + ) && + >mainfile + git add sub mainfile && + test_tick && + git commit -m "superproject commit #1" +' + +test_expect_success clone ' + git clone file://`pwd`/.git cloned && + (git rev-parse HEAD; git ls-files -s) >expected && + ( + cd cloned && + (git rev-parse HEAD; git ls-files -s) >../actual + ) && + diff -u expected actual +' + +test_expect_success advance ' + echo more >mainfile && + git update-index --force-remove sub && + mv sub/.git sub/.git-disabled && + git add sub/subfile mainfile && + mv sub/.git-disabled sub/.git && + test_tick && + git commit -m "superproject commit #2" +' + +test_expect_success fetch ' + (git rev-parse HEAD; git ls-files -s) >expected && + ( + cd cloned && + git pull && + (git rev-parse HEAD; git ls-files -s) >../actual + ) && + diff -u expected actual +' + +test_done From 2f82f760e1b2630073a05c44fe70bdce9706d9e5 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 18 Aug 2007 15:52:55 -0700 Subject: [PATCH 25/95] Take binary diffs into account for "git rebase" We used to not generate a patch ID for binary diffs, but that means that some commits may be skipped as being identical to already-applied diffs when doing a rebase. So just delete the code that skips the binary diff. At the very least, we'd want the filenames to be part of the patch ID, but we might also want to generate some hash for the binary diff itself too. This fixes an issue noticed by Torgil Svensson. Tested-by: Torgil Svensson Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- diff.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/diff.c b/diff.c index 97cc5bc085..a7e76719d1 100644 --- a/diff.c +++ b/diff.c @@ -2919,10 +2919,6 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1) fill_mmfile(&mf2, p->two) < 0) return error("unable to read files to diff"); - /* Maybe hash p->two? into the patch id? */ - if (diff_filespec_is_binary(p->two)) - continue; - len1 = remove_space(p->one->path, strlen(p->one->path)); len2 = remove_space(p->two->path, strlen(p->two->path)); if (p->one->mode == 0) From 463a849d004b2a3f3c8254b1e7985d4e986b9f1a Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sun, 19 Aug 2007 19:24:36 +0200 Subject: [PATCH 26/95] Add and document a global --no-pager option for git. To keep the change small, this is done by setting GIT_PAGER to "cat". Signed-off-by: Matthieu Moy Acked-by: Linus Torvalds Acked-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Documentation/git.txt | 6 +++++- git.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index 8017997fb9..3b0d530257 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -9,7 +9,8 @@ git - the stupid content tracker SYNOPSIS -------- [verse] -'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] +'git' [--version] [--exec-path[=GIT_EXEC_PATH]] + [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS] @@ -103,6 +104,9 @@ OPTIONS -p|--paginate:: Pipe all output into 'less' (or if set, $PAGER). +--no-pager:: + Do not pipe git output into a pager. + --git-dir=:: Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. diff --git a/git.c b/git.c index cab0e7227d..c46691e976 100644 --- a/git.c +++ b/git.c @@ -4,7 +4,7 @@ #include "quote.h" const char git_usage_string[] = - "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]"; + "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]"; static void prepend_to_path(const char *dir, int len) { @@ -58,6 +58,10 @@ static int handle_options(const char*** argv, int* argc, int* envchanged) } } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { setup_pager(); + } else if (!strcmp(cmd, "--no-pager")) { + setenv("GIT_PAGER", "cat", 1); + if (envchanged) + *envchanged = 1; } else if (!strcmp(cmd, "--git-dir")) { if (*argc < 2) { fprintf(stderr, "No directory given for --git-dir.\n" ); From 14cd56071520c3bb37252c8d0abe81c841465378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Sandstr=C3=B6m?= Date: Sun, 19 Aug 2007 23:38:57 +0200 Subject: [PATCH 27/95] Add the word reflog to Documentation/config.txt:core.logAllRefUpdates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it easier to find out how to enable the reflog for a bare repository by searching the documentation for "reflog". Signed-off-by: Lukas Sandström Signed-off-by: Junio C Hamano --- Documentation/config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index de9e72b562..46f40ad4c2 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -192,7 +192,7 @@ core.worktree:: variable and the '--work-tree' command line option. core.logAllRefUpdates:: - Updates to a ref is logged to the file + Enable the reflog. Updates to a ref is logged to the file "$GIT_DIR/logs/", by appending the new and old SHA1, the date/time and the reason of the update, but only when the file exists. If this configuration From c6951ddb522a7d8ee0fc371cf9c37e727e676989 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 20 Aug 2007 00:53:04 -0400 Subject: [PATCH 28/95] git-gui: Fix window manager problems on ion3 cehteh on #git noticed that secondary windows such as console windows from push/fetch/merge or the blame browser failed on ion when we tried to open them a second time. The issue turned out to be the fact that on ion [winfo ismapped .] returns false if . is not visible right now because it has been obscured by another window in the same panel. So we need to keep track of whether or not the root window has been displayed for this application, and once it has been we cannot ever assume that ismapped is going to return true. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 6 ++++++ lib/class.tcl | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 29a790e481..2686c1b8f0 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1936,6 +1936,12 @@ if {$browser ne {}} { } unset browser doc_path doc_url +set root_exists 0 +bind . { + bind . {} + set root_exists 1 +} + # -- Standard bindings # wm protocol . WM_DELETE_WINDOW do_quit diff --git a/lib/class.tcl b/lib/class.tcl index 24e8cecea4..dc2141192a 100644 --- a/lib/class.tcl +++ b/lib/class.tcl @@ -148,11 +148,12 @@ proc make_toplevel {t w args} { } } - if {[winfo ismapped .]} { + if {$::root_exists || [winfo ismapped .]} { regsub -all {::} $this {__} w set top .$w set pfx $top toplevel $top + set ::root_exists 1 } else { set top . set pfx {} From d56651c0ef1c81c1d0509ea4464451d5724e4036 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 19 Aug 2007 22:33:43 -0400 Subject: [PATCH 29/95] Don't allow combination of -g and --reverse as it doesn't work The --walk-reflogs logic and the --reverse logic are completely incompatible with one another. Attempting to use both at the same time leads to confusing results that sometimes violates the user's formatting options or ignores the user's request to see the reflog message and timestamp. Unfortunately the implementation of both of these features is glued onto the side of the revision walking machinary in such a way that they are probably not going to be easy to make them compatible with each other. Rather than offering the user confusing results we are better off bailing out with an error message until such a time as the implementations can be refactored to be compatible. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-log.txt | 1 + Documentation/git-rev-list.txt | 3 +++ revision.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 5a90f65b5e..1e6dbd93b1 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -49,6 +49,7 @@ include::pretty-options.txt[] -g, \--walk-reflogs:: Show commits as they were recorded in the reflog. The log contains a record about how the tip of a reference was changed. + Cannot be combined with --reverse. See also gitlink:git-reflog[1]. --decorate:: diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index 1c1978140f..cbbc234549 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -298,6 +298,8 @@ used in the output. When the starting commit is specified as 'commit@{now}', output also uses 'commit@\{timestamp}' notation instead. Under '\--pretty=oneline', the commit message is prefixed with this information on the same line. ++ +Cannot be combined with --reverse. --merge:: @@ -373,6 +375,7 @@ By default, the commits are shown in reverse chronological order. --reverse:: Output the commits in reverse order. + Cannot be combined with --walk-reflogs. Object Traversal ~~~~~~~~~~~~~~~~ diff --git a/revision.c b/revision.c index 7d32a89b0e..51fff0ec50 100644 --- a/revision.c +++ b/revision.c @@ -1277,6 +1277,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch compile_grep_patterns(revs->grep_filter); } + if (revs->reverse && revs->reflog_info) + die("cannot combine --reverse with --walk-reflogs"); + return left; } From 257a84d9d02e90447b149af58b271c19405edb6a Mon Sep 17 00:00:00 2001 From: Steven Grimm Date: Mon, 20 Aug 2007 11:36:38 +0800 Subject: [PATCH 30/95] Document what the stage numbers in the :$n:path syntax mean. The git-rev-parse manpage talks about the :$n:path notation (buried deep in a list of other syntax) but it just says $n is a "stage number" -- someone who is not familiar with the internals of git's merge implementation is never going to be able to figure out that "1", "2", and "3" means. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 4b4d229e60..4758c33dee 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -215,7 +215,10 @@ blobs contained in a commit. * A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path; this names a blob object in the index at the given path. Missing stage number (and the colon - that follows it) names an stage 0 entry. + that follows it) names an stage 0 entry. During a merge, stage + 1 is the common ancestor, stage 2 is the target branch's version + (typically the current branch), and stage 3 is the version from + the branch being merged. Here is an illustration, by Jon Loeliger. Both node B and C are a commit parents of commit node A. Parent commits are ordered From 18a01a0da428c9e1034247e2b40c62e506b73580 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 20 Aug 2007 02:17:05 -0400 Subject: [PATCH 31/95] git-gui: Allow git-merge to use branch names in conflict markers Earlier when I rewrote the merge implementation for git-gui I broke it such that the conflict markers for the "theirs" side of the hunk was using a full SHA-1 ID in hex, rather than the name of the branch the user had merged. This was because I got paranoid and passed off the full SHA-1 to git-merge, instead of giving it the reference name the user saw in the merge dialog. I'd still like to resolve the SHA-1 upfront in git-gui and always use that value throughout the merge, but I can't do that until we have a full implementation of git-merge written in Tcl. Until then its more important that the conflict markers be useful to the end-user, so we need to pass off the ref name and not the SHA-1 ID. Signed-off-by: Shawn O. Pearce --- lib/merge.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/merge.tcl b/lib/merge.tcl index 5de0d82b14..0e50919d4c 100644 --- a/lib/merge.tcl +++ b/lib/merge.tcl @@ -114,7 +114,7 @@ method _start {} { lappend cmd --strategy=recursive lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]] lappend cmd HEAD - lappend cmd $cmit + lappend cmd $name set msg "Merging $current_branch and $stitle" ui_status "$msg..." From 2be7fcb4764f2dbcee52635b91fedb1b3dcf7ab4 Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Sun, 19 Aug 2007 22:27:52 -0400 Subject: [PATCH 32/95] Fix misspelling of 'suppress' in docs Signed-off-by: Junio C Hamano --- Documentation/git-checkout.txt | 2 +- Documentation/git-send-email.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 818b720b91..734928bf96 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -35,7 +35,7 @@ working tree. OPTIONS ------- -q:: - Quiet, supress feedback messages. + Quiet, suppress feedback messages. -f:: Proceed even if the index or the working tree differs diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 08a023ea92..8231286e09 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -88,7 +88,7 @@ The --cc option must be repeated for each user you want on the cc list. If this is set, do not add the From: address to the cc: list, if it shows up in a From: line. Default is the value of 'sendemail.suppressfrom' configuration value; - if that is unspecified, default to --no-supress-from. + if that is unspecified, default to --no-suppress-from. --thread, --no-thread:: If this is set, the In-Reply-To header will be set on each email sent. From 887c996e4698dcb7ee95c48a98f7da2c3bae158b Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 20 Aug 2007 19:36:20 +1000 Subject: [PATCH 33/95] gitk: Add a window to list branches, tags and other references This adds an entry to the File menu labelled "List references" which pops up a window showing a sorted list of branches, tags, and other references, with a little icon beside each to indicate what sort it is. The list only shows refs that point to a commit that is included in the graph, and if you click on a ref, the corresponding commit is selected in the main window. The list of refs gets updated dynamically. Signed-off-by: Paul Mackerras --- gitk | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 6b0569a5f4..b7730ae202 100755 --- a/gitk +++ b/gitk @@ -533,6 +533,7 @@ proc makewindow {} { menu .bar.file .bar.file add command -label "Update" -command updatecommits .bar.file add command -label "Reread references" -command rereadrefs + .bar.file add command -label "List references" -command showrefs .bar.file add command -label "Quit" -command doquit .bar.file configure -font $uifont menu .bar.edit @@ -1466,6 +1467,38 @@ image create bitmap tri-dn -background black -foreground blue -data { 0x00, 0x00}; } +image create bitmap reficon-T -background black -foreground yellow -data { + #define tagicon_width 13 + #define tagicon_height 9 + static unsigned char tagicon_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07, + 0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00}; +} -maskdata { + #define tagicon-mask_width 13 + #define tagicon-mask_height 9 + static unsigned char tagicon-mask_bits[] = { + 0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x0f, 0xfc, 0x0f, + 0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf0, 0x0f, 0x00, 0x00}; +} +set rectdata { + #define headicon_width 13 + #define headicon_height 9 + static unsigned char headicon_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xf8, 0x07, + 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00}; +} +set rectmask { + #define headicon-mask_width 13 + #define headicon-mask_height 9 + static unsigned char headicon-mask_bits[] = { + 0x00, 0x00, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, + 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0x00, 0x00}; +} +image create bitmap reficon-H -background black -foreground green \ + -data $rectdata -maskdata $rectmask +image create bitmap reficon-o -background black -foreground "#ddddff" \ + -data $rectdata -maskdata $rectmask + proc init_flist {first} { global cflist cflist_top selectedline difffilestart @@ -1988,6 +2021,7 @@ proc showview {n} { } elseif {$numcommits == 0} { show_status "No commits selected" } + run refill_reflist } # Stuff relating to the highlighting facility @@ -2751,13 +2785,22 @@ proc layoutmore {tmax allread} { proc showstuff {canshow last} { global numcommits commitrow pending_select selectedline curview global lookingforhead mainheadid displayorder selectfirst - global lastscrollset + global lastscrollset commitinterest if {$numcommits == 0} { global phase set phase "incrdraw" allcanvs delete all } + for {set l $numcommits} {$l < $canshow} {incr l} { + set id [lindex $displayorder $l] + if {[info exists commitinterest($id)]} { + foreach script $commitinterest($id) { + eval [string map [list "%I" $id] $script] + } + unset commitinterest($id) + } + } set r0 $numcommits set prev $numcommits set numcommits $canshow @@ -4484,6 +4527,7 @@ proc selectline {l isnew} { $canv delete hover normalline cancel_next_highlight + unsel_reflist if {$l < 0 || $l >= $numcommits} return set y [expr {$canvy0 + $l * $linespc}] set ymax [lindex [$canv cget -scrollregion] 3] @@ -5414,7 +5458,7 @@ proc redisplay {} { } proc incrfont {inc} { - global mainfont textfont ctext canv phase cflist + global mainfont textfont ctext canv phase cflist showrefstop global charspc tabstop global stopped entries unmarkmatches @@ -5430,6 +5474,9 @@ proc incrfont {inc} { if {$phase eq "getcommits"} { $canv itemconf textitems -font $mainfont } + if {[info exists showrefstop] && [winfo exists $showrefstop]} { + $showrefstop.list conf -font $mainfont + } redisplay } @@ -5888,6 +5935,8 @@ proc domktag {} { lappend idtags($id) $tag redrawtags $id addedtag $id + dispneartags 0 + run refill_reflist } proc redrawtags {id} { @@ -6029,6 +6078,7 @@ proc mkbrgo {top} { notbusy newbranch redrawtags $id dispneartags 0 + run refill_reflist } } @@ -6227,6 +6277,163 @@ proc rmbranch {} { redrawtags $id notbusy rmbranch dispneartags 0 + run refill_reflist +} + +# Display a list of tags and heads +proc showrefs {} { + global showrefstop bgcolor fgcolor selectbgcolor mainfont + global bglist fglist uifont reflistfilter reflist maincursor + + set top .showrefs + set showrefstop $top + if {[winfo exists $top]} { + raise $top + refill_reflist + return + } + toplevel $top + wm title $top "Tags and heads: [file tail [pwd]]" + text $top.list -background $bgcolor -foreground $fgcolor \ + -selectbackground $selectbgcolor -font $mainfont \ + -xscrollcommand "$top.xsb set" -yscrollcommand "$top.ysb set" \ + -width 30 -height 20 -cursor $maincursor \ + -spacing1 1 -spacing3 1 -state disabled + $top.list tag configure highlight -background $selectbgcolor + lappend bglist $top.list + lappend fglist $top.list + scrollbar $top.ysb -command "$top.list yview" -orient vertical + scrollbar $top.xsb -command "$top.list xview" -orient horizontal + grid $top.list $top.ysb -sticky nsew + grid $top.xsb x -sticky ew + frame $top.f + label $top.f.l -text "Filter: " -font $uifont + entry $top.f.e -width 20 -textvariable reflistfilter -font $uifont + set reflistfilter "*" + trace add variable reflistfilter write reflistfilter_change + pack $top.f.e -side right -fill x -expand 1 + pack $top.f.l -side left + grid $top.f - -sticky ew -pady 2 + button $top.close -command [list destroy $top] -text "Close" \ + -font $uifont + grid $top.close - + grid columnconfigure $top 0 -weight 1 + grid rowconfigure $top 0 -weight 1 + bind $top.list <1> {break} + bind $top.list {break} + bind $top.list {sel_reflist %W %x %y; break} + set reflist {} + refill_reflist +} + +proc sel_reflist {w x y} { + global showrefstop reflist headids tagids otherrefids + + if {![winfo exists $showrefstop]} return + set l [lindex [split [$w index "@$x,$y"] "."] 0] + set ref [lindex $reflist [expr {$l-1}]] + set n [lindex $ref 0] + switch -- [lindex $ref 1] { + "H" {selbyid $headids($n)} + "T" {selbyid $tagids($n)} + "o" {selbyid $otherrefids($n)} + } + $showrefstop.list tag add highlight $l.0 "$l.0 lineend" +} + +proc unsel_reflist {} { + global showrefstop + + if {![info exists showrefstop] || ![winfo exists $showrefstop]} return + $showrefstop.list tag remove highlight 0.0 end +} + +proc reflistfilter_change {n1 n2 op} { + global reflistfilter + + after cancel refill_reflist + after 200 refill_reflist +} + +proc refill_reflist {} { + global reflist reflistfilter showrefstop headids tagids otherrefids + global commitrow curview commitinterest + + if {![info exists showrefstop] || ![winfo exists $showrefstop]} return + set refs {} + foreach n [array names headids] { + if {[string match $reflistfilter $n]} { + if {[info exists commitrow($curview,$headids($n))]} { + lappend refs [list $n H] + } else { + set commitinterest($headids($n)) {run refill_reflist} + } + } + } + foreach n [array names tagids] { + if {[string match $reflistfilter $n]} { + if {[info exists commitrow($curview,$tagids($n))]} { + lappend refs [list $n T] + } else { + set commitinterest($tagids($n)) {run refill_reflist} + } + } + } + foreach n [array names otherrefids] { + if {[string match $reflistfilter $n]} { + if {[info exists commitrow($curview,$otherrefids($n))]} { + lappend refs [list $n o] + } else { + set commitinterest($otherrefids($n)) {run refill_reflist} + } + } + } + set refs [lsort -index 0 $refs] + if {$refs eq $reflist} return + + # Update the contents of $showrefstop.list according to the + # differences between $reflist (old) and $refs (new) + $showrefstop.list conf -state normal + $showrefstop.list insert end "\n" + set i 0 + set j 0 + while {$i < [llength $reflist] || $j < [llength $refs]} { + if {$i < [llength $reflist]} { + if {$j < [llength $refs]} { + set cmp [string compare [lindex $reflist $i 0] \ + [lindex $refs $j 0]] + if {$cmp == 0} { + set cmp [string compare [lindex $reflist $i 1] \ + [lindex $refs $j 1]] + } + } else { + set cmp -1 + } + } else { + set cmp 1 + } + switch -- $cmp { + -1 { + $showrefstop.list delete "[expr {$j+1}].0" "[expr {$j+2}].0" + incr i + } + 0 { + incr i + incr j + } + 1 { + set l [expr {$j + 1}] + $showrefstop.list image create $l.0 -align baseline \ + -image reficon-[lindex $refs $j 1] -padx 2 + $showrefstop.list insert $l.1 "[lindex $refs $j 0]\n" + incr j + } + } + } + set reflist $refs + # delete last newline + $showrefstop.list delete end-2c end-1c + $showrefstop.list conf -state disabled } # Stuff for finding nearby tags @@ -7124,6 +7331,7 @@ proc rereadrefs {} { redrawtags $id } } + run refill_reflist } proc listrefs {id} { From 23d53358be51bb256699f4d237619a3ee8addf39 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 20 Aug 2007 15:35:15 -0700 Subject: [PATCH 34/95] git clone: do not issue warning while cloning locally across filesystems Unless the user explicitly asked hardlinking with the '-l' option, we should not say "oops we cannot hardlink as you asked so we are copying". Signed-off-by: Junio C Hamano --- git-clone.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git-clone.sh b/git-clone.sh index e4a9ac4bab..18003ab4b3 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -99,6 +99,7 @@ origin_override= use_separate_remote=t depth= no_progress= +local_explicitly_asked_for= test -t 1 || no_progress=--no-progress while case "$#,$1" in @@ -109,6 +110,7 @@ while *,--na|*,--nak|*,--nake|*,--naked|\ *,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;; *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) + local_explicitly_asked_for=yes use_local_hardlink=yes ;; *,--no-h|*,--no-ha|*,--no-har|*,--no-hard|*,--no-hardl|\ *,--no-hardli|*,--no-hardlin|*,--no-hardlink|*,--no-hardlinks) @@ -281,7 +283,8 @@ yes) then rm -f "$GIT_DIR/objects/sample" l=l - else + elif test -n "$local_explicitly_asked_for" + then echo >&2 "Warning: -l asked but cannot hardlink to $repo" fi fi && From 4bf53833dbca666f61b5177977e96d453527db20 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Mon, 20 Aug 2007 23:38:14 -0400 Subject: [PATCH 35/95] Avoid using va_copy in fast-import: it seems to be unportable. [sp: minor change to use fputs, thus reducing the patch size] Signed-off-by: Alex Riesen Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- fast-import.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fast-import.c b/fast-import.c index 2d5224c186..078079d404 100644 --- a/fast-import.c +++ b/fast-import.c @@ -375,7 +375,7 @@ static void write_branch_report(FILE *rpt, struct branch *b) fputc('\n', rpt); } -static void write_crash_report(const char *err, va_list params) +static void write_crash_report(const char *err) { char *loc = git_path("fast_import_crash_%d", getpid()); FILE *rpt = fopen(loc, "w"); @@ -397,7 +397,7 @@ static void write_crash_report(const char *err, va_list params) fputc('\n', rpt); fputs("fatal: ", rpt); - vfprintf(rpt, err, params); + fputs(err, rpt); fputc('\n', rpt); fputc('\n', rpt); @@ -442,18 +442,17 @@ static void write_crash_report(const char *err, va_list params) static NORETURN void die_nicely(const char *err, va_list params) { static int zombie; - va_list x_params; + char message[2 * PATH_MAX]; - va_copy(x_params, params); + vsnprintf(message, sizeof(message), err, params); fputs("fatal: ", stderr); - vfprintf(stderr, err, params); + fputs(message, stderr); fputc('\n', stderr); if (!zombie) { zombie = 1; - write_crash_report(err, x_params); + write_crash_report(message); } - va_end(x_params); exit(128); } From a475e8095aeb898c1ca60673b82df97d2300cc95 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 20 Aug 2007 22:48:29 -0700 Subject: [PATCH 36/95] GIT 1.5.3-rc6 Hopefully last rc of 1.5.3 cycle, except a few documentation and message wording changes, and git-gui 0.8.2. Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.5.3.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/RelNotes-1.5.3.txt b/Documentation/RelNotes-1.5.3.txt index 9c36e8baeb..e529e11cb2 100644 --- a/Documentation/RelNotes-1.5.3.txt +++ b/Documentation/RelNotes-1.5.3.txt @@ -28,7 +28,7 @@ Updates since v1.5.2 * For people who need to import from Perforce, a front-end for fast-import is in contrib/fast-import/. -* Comes with git-gui 0.8.0. +* Comes with git-gui 0.8.1. * Comes with updated gitk. @@ -130,6 +130,9 @@ Updates since v1.5.2 - "git init -q" makes the command quieter. + - "git -p command" now has a cousin of opposite sex, "git --no-pager + command". + * Updated behavior of existing commands. - "gitweb" can offer multiple snapshot formats. @@ -317,6 +320,6 @@ this release, unless otherwise noted. -- exec >/var/tmp/1 -O=v1.5.3-rc4 +O=v1.5.3-rc6 echo O=`git describe refs/heads/master` git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint From ce015c213fbef39140b6192db28110bc666dc6c8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 21 Aug 2007 02:22:53 -0400 Subject: [PATCH 37/95] git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu In a13ee29b975d3a9a012983309e842d942b2bbd44 I totally broke the "Stage Hunk For Commit" feature by making this menu item always appear in a disabled state, so it was never invokable. A "teaser feature", just sitting there taunting the poor user who has become used to having it available. The issue caused by a13ee was I added a test to look at the data in $file_states, but I didn't do that test correctly as it was always looking at a procedure local $file_states array, which is not defined, so the test was always true and we always disabled the menu entry. Instead we only want to disable the menu entry if the current file we are looking at has no file state information (git-gui is just a very confused little process) or it is an untracked file (and we cannot stage individual hunks). Signed-off-by: Shawn O. Pearce --- git-gui.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 2686c1b8f0..d5517b921d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2416,15 +2416,16 @@ $ctxm add separator $ctxm add command -label {Options...} \ -command do_options proc popup_diff_menu {ctxm x y X Y} { - global current_diff_path + global current_diff_path file_states set ::cursorX $x set ::cursorY $y if {$::ui_index eq $::current_diff_side} { $ctxm entryconf $::ui_diff_applyhunk \ -state normal \ -label {Unstage Hunk From Commit} - } elseif {![info exists file_states($current_diff_path)] - || {_O} eq [lindex $file_states($::current_diff_path) 0]} { + } elseif {$current_diff_path eq {} + || ![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($current_diff_path) 0]} { $ctxm entryconf $::ui_diff_applyhunk \ -state disabled \ -label {Stage Hunk For Commit} From 875b7c93686d16e083dcea8b544e4f204113d8de Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 22 Aug 2007 02:41:00 -0400 Subject: [PATCH 38/95] git-gui: Fix "unoptimized loading" to not cause git-gui to crash If the tclsh command was not available to us at the time we were "built" our lib/tclIndex just lists all of our library files and we source all of them at once during startup, rather than trying to lazily load only the procedures we need. This is a problem as some of our library code now depends upon the git-version proc, and that proc is not defined until after the library was fully loaded. I'm moving the library loading until after we have determined the version of git we are talking to, as this ensures that the required git-reversion procedure is defined before any library code can be loaded. Since error_popup is defined in the library we instead use tk_messageBox directly for errors found during the version detection. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 114 +++++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 51 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index d5517b921d..b25b52fd11 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -60,54 +60,6 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { } } -###################################################################### -## -## configure our library - -set oguilib {@@GITGUI_LIBDIR@@} -set oguirel {@@GITGUI_RELATIVE@@} -if {$oguirel eq {1}} { - set oguilib [file dirname [file dirname [file normalize $argv0]]] - set oguilib [file join $oguilib share git-gui lib] -} elseif {[string match @@* $oguirel]} { - set oguilib [file join [file dirname [file normalize $argv0]] lib] -} - -set idx [file join $oguilib tclIndex] -if {[catch {set fd [open $idx r]} err]} { - catch {wm withdraw .} - tk_messageBox \ - -icon error \ - -type ok \ - -title "git-gui: fatal error" \ - -message $err - exit 1 -} -if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} { - set idx [list] - while {[gets $fd n] >= 0} { - if {$n ne {} && ![string match #* $n]} { - lappend idx $n - } - } -} else { - set idx {} -} -close $fd - -if {$idx ne {}} { - set loaded [list] - foreach p $idx { - if {[lsearch -exact $loaded $p] >= 0} continue - source [file join $oguilib $p] - lappend loaded $p - } - unset loaded p -} else { - set auto_path [concat [list $oguilib] $auto_path] -} -unset -nocomplain oguirel idx fd - ###################################################################### ## ## read only globals @@ -532,7 +484,11 @@ if {$_git eq {}} { if {[catch {set _git_version [git --version]} err]} { catch {wm withdraw .} - error_popup "Cannot determine Git version: + tk_messageBox \ + -icon error \ + -type ok \ + -title "git-gui: fatal error" \ + -message "Cannot determine Git version: $err @@ -541,7 +497,11 @@ $err } if {![regsub {^git version } $_git_version {} _git_version]} { catch {wm withdraw .} - error_popup "Cannot parse Git version string:\n\n$_git_version" + tk_messageBox \ + -icon error \ + -type ok \ + -title "git-gui: fatal error" \ + -message "Cannot parse Git version string:\n\n$_git_version" exit 1 } @@ -619,7 +579,11 @@ proc git-version {args} { if {[git-version < 1.5]} { catch {wm withdraw .} - error_popup "[appname] requires Git 1.5.0 or later. + tk_messageBox \ + -icon error \ + -type ok \ + -title "git-gui: fatal error" \ + -message "[appname] requires Git 1.5.0 or later. You are using [git-version]: @@ -627,6 +591,54 @@ You are using [git-version]: exit 1 } +###################################################################### +## +## configure our library + +set oguilib {@@GITGUI_LIBDIR@@} +set oguirel {@@GITGUI_RELATIVE@@} +if {$oguirel eq {1}} { + set oguilib [file dirname [file dirname [file normalize $argv0]]] + set oguilib [file join $oguilib share git-gui lib] +} elseif {[string match @@* $oguirel]} { + set oguilib [file join [file dirname [file normalize $argv0]] lib] +} + +set idx [file join $oguilib tclIndex] +if {[catch {set fd [open $idx r]} err]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title "git-gui: fatal error" \ + -message $err + exit 1 +} +if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} { + set idx [list] + while {[gets $fd n] >= 0} { + if {$n ne {} && ![string match #* $n]} { + lappend idx $n + } + } +} else { + set idx {} +} +close $fd + +if {$idx ne {}} { + set loaded [list] + foreach p $idx { + if {[lsearch -exact $loaded $p] >= 0} continue + source [file join $oguilib $p] + lappend loaded $p + } + unset loaded p +} else { + set auto_path [concat [list $oguilib] $auto_path] +} +unset -nocomplain oguirel idx fd + ###################################################################### ## ## feature option selection From e301bfeea19e284344868840793c58d2e7529c74 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 21 Aug 2007 21:50:12 -0400 Subject: [PATCH 39/95] Fix new-workdir (again) to work on bare repositories My day-job workflow involves using multiple workdirs attached to a bunch of bare repositories. Such repositories are stored inside of a directory called "foo.git", which means `git rev-parse --git-dir` will return "." and not ".git". Under such conditions new-workdir was getting confused about where the Git repository it was supplied is actually located. If we get "." for the result of --git-dir query it means we should use the user supplied path as-is, and not attempt to perform any magic on it, as the path is directly to the repository. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/workdir/git-new-workdir | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir index 3ff6bd166a..119cff9859 100755 --- a/contrib/workdir/git-new-workdir +++ b/contrib/workdir/git-new-workdir @@ -24,10 +24,14 @@ git_dir=$(cd "$orig_git" 2>/dev/null && git rev-parse --git-dir 2>/dev/null) || die "\"$orig_git\" is not a git repository!" -if test "$git_dir" = ".git" -then +case "$git_dir" in +.git) git_dir="$orig_git/.git" -fi + ;; +.) + git_dir=$orig_git + ;; +esac # don't link to a workdir if test -L "$git_dir/config" From 8fa0ee3b50736eb869a3e13375bb041c1bf5aa12 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 22 Aug 2007 01:33:49 -0400 Subject: [PATCH 40/95] Suggest unsetting core.bare when using new-workdir on a bare repository If core.bare is set to true in the config file of a repository that the user is trying to create a working directory from we should abort and suggest to the user that they remove the option first. If we leave the core.bare=true setting in the config file then working tree operations will get confused when they attempt to execute in the new workdir, as it shares its config file with the bare repository. The working tree operations will assume that the workdir is bare and abort, which is not what the user wants. If we changed core.bare to be false then working tree operations will function in the workdir but other operations may fail in the bare repository, as it claims to not be bare. If we remove core.bare from the config then Git can fallback on the legacy guessing behavior. This allows operations in the bare repository to work as though it were bare, while operations in the workdirs to act as though they are not bare. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/workdir/git-new-workdir | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir index 119cff9859..c6e154a84f 100755 --- a/contrib/workdir/git-new-workdir +++ b/contrib/workdir/git-new-workdir @@ -33,6 +33,14 @@ case "$git_dir" in ;; esac +# don't link to a configured bare repository +isbare=$(git --git-dir="$git_dir" config --bool --get core.bare) +if test ztrue = z$isbare +then + die "\"$git_dir\" has core.bare set to true," \ + " remove from \"$git_dir/config\" to use $0" +fi + # don't link to a workdir if test -L "$git_dir/config" then From 687157c736d7a1aac152866cbe20030aaa25513f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 21 Aug 2007 20:01:16 +0200 Subject: [PATCH 41/95] Documentation: update tar.umask default As noted by Mike Hommey, the documentation for the config setting tar.umask is not up-to-date. Commit f08b3b0e2e9ad87767d80ff03b013c686e08ba4b changed the default from 0 to 2; this patch finally documents it. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/config.txt | 14 +++++--------- Documentation/git-archive.txt | 15 ++++++--------- Documentation/git-tar-tree.txt | 15 ++++++--------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 46f40ad4c2..462595cf8f 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -675,15 +675,11 @@ showbranch.default:: See gitlink:git-show-branch[1]. tar.umask:: - By default, gitlink:git-tar-tree[1] sets file and directories modes - to 0666 or 0777. While this is both useful and acceptable for projects - such as the Linux Kernel, it might be excessive for other projects. - With this variable, it becomes possible to tell - gitlink:git-tar-tree[1] to apply a specific umask to the modes above. - The special value "user" indicates that the user's current umask will - be used. This should be enough for most projects, as it will lead to - the same permissions as gitlink:git-checkout[1] would use. The default - value remains 0, which means world read-write. + This variable can be used to restrict the permission bits of + tar archive entries. The default is 0002, which turns off the + world write bit. The special value "user" indicates that the + archiving user's umask will be used instead. See umask(2) and + gitlink:git-archive[1]. user.email:: Your email address to be recorded in any newly created commits. diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index 4da07c1580..f2080eb6ad 100644 --- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -72,16 +72,13 @@ zip CONFIGURATION ------------- -By default, file and directories modes are set to 0666 or 0777 in tar -archives. It is possible to change this by setting the "umask" variable -in the repository configuration as follows : -[tar] - umask = 002 ;# group friendly - -The special umask value "user" indicates that the user's current umask -will be used instead. The default value remains 0, which means world -readable/writable files and directories. +tar.umask:: + This variable can be used to restrict the permission bits of + tar archive entries. The default is 0002, which turns off the + world write bit. The special value "user" indicates that the + archiving user's umask will be used instead. See umask(2) for + details. EXAMPLES -------- diff --git a/Documentation/git-tar-tree.txt b/Documentation/git-tar-tree.txt index 2d01d9666f..434607bfb5 100644 --- a/Documentation/git-tar-tree.txt +++ b/Documentation/git-tar-tree.txt @@ -42,16 +42,13 @@ OPTIONS CONFIGURATION ------------- -By default, file and directories modes are set to 0666 or 0777. It is -possible to change this by setting the "umask" variable in the -repository configuration as follows : -[tar] - umask = 002 ;# group friendly - -The special umask value "user" indicates that the user's current umask -will be used instead. The default value is 002, which means group -readable/writable files and directories. +tar.umask:: + This variable can be used to restrict the permission bits of + tar archive entries. The default is 0002, which turns off the + world write bit. The special value "user" indicates that the + archiving user's umask will be used instead. See umask(2) for + details. EXAMPLES -------- From 2f5b3980617bd618ebb4314cadaff4e71ce2a390 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 22 Aug 2007 18:13:07 +0200 Subject: [PATCH 42/95] Fix git-remote for ActiveState Perl For reason unknown a package in ActiveState Perl 5.8.7 must implement READLINE method differently for scalar and array context. The code tested to work for more sane and recent version of perl (5.8.8 shipped with Ubuntu), so maybe it was always a requirement. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- perl/Git.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/perl/Git.pm b/perl/Git.pm index 8fd3611753..3f4080cbf8 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -860,7 +860,13 @@ sub READLINE { if ($self->{i} >= scalar @{$self->{data}}) { return undef; } - return $self->{'data'}->[ $self->{i}++ ]; + my $i = $self->{i}; + if (wantarray) { + $self->{i} = $#{$self->{'data'}} + 1; + return splice(@{$self->{'data'}}, $i); + } + $self->{i} = $i + 1; + return $self->{'data'}->[ $i ]; } sub CLOSE { From ef08c14993a8d2881941667c0264c97c6874ccee Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 22 Aug 2007 12:21:38 +0200 Subject: [PATCH 43/95] git.el: Avoid a lisp error when there's no current branch (detached HEAD). Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- contrib/emacs/git.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index be44e06c45..abc799a287 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -664,9 +664,11 @@ Return the list of files that haven't been handled." (ewoc-set-hf status (format "Directory: %s\nBranch: %s\nHead: %s%s\n" default-directory - (if (string-match "^refs/heads/" branch) - (substring branch (match-end 0)) - branch) + (if branch + (if (string-match "^refs/heads/" branch) + (substring branch (match-end 0)) + branch) + "none (detached HEAD)") head (if merge-heads (concat "\nMerging: " From 620e729dd3625f3329e9cb50a1175648b5672653 Mon Sep 17 00:00:00 2001 From: Quy Tonthat Date: Wed, 22 Aug 2007 18:18:03 +1000 Subject: [PATCH 44/95] Fix breakage in git-rev-list.txt Also fix some innocent missing of quotes. Signed-off-by: Quy Tonthat Signed-off-by: Junio C Hamano --- Documentation/git-rev-list.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index cbbc234549..a0c611e744 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -298,8 +298,8 @@ used in the output. When the starting commit is specified as 'commit@{now}', output also uses 'commit@\{timestamp}' notation instead. Under '\--pretty=oneline', the commit message is prefixed with this information on the same line. -+ -Cannot be combined with --reverse. + +Cannot be combined with '\--reverse'. --merge:: @@ -375,7 +375,7 @@ By default, the commits are shown in reverse chronological order. --reverse:: Output the commits in reverse order. - Cannot be combined with --walk-reflogs. + Cannot be combined with '\--walk-reflogs'. Object Traversal ~~~~~~~~~~~~~~~~ From 63c2bd25d685faeed2c1e486cd957daaaaac7052 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Tue, 21 Aug 2007 19:15:09 +0200 Subject: [PATCH 45/95] Document -u option in git-svnimport man page Signed-off-by: Junio C Hamano --- Documentation/git-svnimport.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt index e97d15e8f2..71aad8b45b 100644 --- a/Documentation/git-svnimport.txt +++ b/Documentation/git-svnimport.txt @@ -68,6 +68,9 @@ When importing incrementally, you might need to edit the .git/svn2git file. Prepend 'rX: ' to commit messages, where X is the imported subversion revision. +-u:: + Replace underscores in tag names with periods. + -I :: Import the svn:ignore directory property to files with this name in each directory. (The Subversion and GIT ignore From 412876dcbb7ca10e64ed8118bc1995788d397782 Mon Sep 17 00:00:00 2001 From: Sean Estabrooks Date: Fri, 17 Aug 2007 17:38:25 -0400 Subject: [PATCH 46/95] Reset terminal attributes when terminating git send-email If you break out of the prompts presented to you by git send-email your terminal can be left in an inconsistent state. Here we trap the interrupt signal and reset the terminal before exiting. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- git-send-email.perl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 69559b289a..f1a8855682 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -21,8 +21,11 @@ use warnings; use Term::ReadLine; use Getopt::Long; use Data::Dumper; +use Term::ANSIColor; use Git; +$SIG{INT} = sub { print color("reset"), "\n"; exit }; + package FakeTerm; sub new { my ($class, $reason) = @_; From aabb2e515c334cbca9d9ae9873a188cef2c9b3ba Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 16 Aug 2007 01:56:45 -0700 Subject: [PATCH 47/95] git-svn: update documentation with CAVEATS section Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- Documentation/git-svn.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 816340b944..fbc58871f5 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -479,6 +479,38 @@ the user on the git side. git-svn does however follow copy history of the directory that it is tracking, however (much like how 'svn log' works). +CAVEATS +------- + +For the sake of simplicity and interoperating with a less-capable system +(SVN), it is recommended that all git-svn users clone, fetch and dcommit +directly from the SVN server, and avoid all git-clone/pull/merge/push +operations between git repositories and branches. The recommended +method of exchanging code between git branches and users is +git-format-patch and git-am, or just dcommiting to the SVN repository. + +Running 'git-merge' or 'git-pull' is NOT recommended on a branch you +plan to dcommit from. Subversion does not represent merges in any +reasonable or useful fashion; so users using Subversion cannot see any +merges you've made. Furthermore, if you merge or pull from a git branch +that is a mirror of an SVN branch, dcommit may commit to the wrong +branch. + +'git-clone' does not clone branches under the refs/remotes/ hierarchy or +any git-svn metadata, or config. So repositories created and managed with +using git-svn should use rsync(1) for cloning, if cloning is to be done +at all. + +Since 'dcommit' uses rebase internally, any git branches you git-push to +before dcommit on will require forcing an overwrite of the existing ref +on the remote repository. This is generally considered bad practice, +see the git-push(1) documentation for details. + +Do not use the --amend option of git-commit(1) on a change you've +already dcommitted. It is considered bad practice to --amend commits +you've already pushed to a remote repository for other users, and +dcommit with SVN is analogous to that. + BUGS ---- From 47e98eecf3721dca64e3d453fc96e3a02debe54f Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Aug 2007 01:39:22 -0400 Subject: [PATCH 48/95] Update bash completion with new 1.5.3 command line options A number of commands have learned new tricks as part of git 1.5.3. If these are long options (--foo) we tend to support them in the bash completion, as it makes the user's task of using the option slightly easier. Signed-off-by: Shawn O. Pearce --- contrib/completion/git-completion.bash | 32 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 52b2893844..8f27aa9a13 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -419,7 +419,7 @@ _git_add () local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) - __gitcomp "--interactive" + __gitcomp "--interactive --refresh" return esac COMPREPLY=() @@ -573,6 +573,7 @@ _git_format_patch () --stdout --attach --thread --output-directory --numbered --start-number + --numbered-files --keep-subject --signoff --in-reply-to= @@ -590,7 +591,7 @@ _git_gc () local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) - __gitcomp "--prune" + __gitcomp "--prune --aggressive" return ;; esac @@ -617,14 +618,20 @@ _git_log () " "" "${cur##--pretty=}" return ;; + --date=*) + __gitcomp " + relative iso8601 rfc2822 short local default + " "" "${cur##--date=}" + return + ;; --*) __gitcomp " --max-count= --max-age= --since= --after= --min-age= --before= --until= --root --topo-order --date-order --reverse - --no-merges + --no-merges --follow --abbrev-commit --abbrev= - --relative-date + --relative-date --date= --author= --committer= --grep= --all-match --pretty= --name-status --name-only --raw @@ -796,7 +803,7 @@ _git_config () case "$cur" in --*) __gitcomp " - --global --system + --global --system --file= --list --replace-all --get --get-all --get-regexp --add --unset --unset-all @@ -839,6 +846,7 @@ _git_config () core.ignoreStat core.preferSymlinkRefs core.logAllRefUpdates + core.loosecompression core.repositoryFormatVersion core.sharedRepository core.warnAmbiguousRefs @@ -870,6 +878,7 @@ _git_config () diff.renames fetch.unpackLimit format.headers + format.subjectprefix gitcvs.enabled gitcvs.logfile gitcvs.allbinary @@ -896,6 +905,10 @@ _git_config () merge.verbosity pack.window pack.depth + pack.windowMemory + pack.compression + pack.deltaCacheSize + pack.deltaCacheLimit pull.octopus pull.twohead repack.useDeltaBaseOffset @@ -1024,7 +1037,14 @@ _git () if [ $c -eq $COMP_CWORD -a -z "$command" ]; then case "${COMP_WORDS[COMP_CWORD]}" in --*=*) COMPREPLY=() ;; - --*) __gitcomp "--git-dir= --bare --version --exec-path" ;; + --*) __gitcomp " + --no-pager + --git-dir= + --bare + --version + --exec-path + " + ;; *) __gitcomp "$(__git_commands) $(__git_aliases)" ;; esac return From 217926c08cb634e3b5394ea15b3fe4520069260b Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Aug 2007 01:42:11 -0400 Subject: [PATCH 49/95] Teach bash to complete ref arguments to git-describe I'm often finding that I need to run git-describe on very long remote tracking branch names, to find out what tagged revision the remote tracking branch is now at (or not at). Typing out the ref names is painful, so bash completion on them is a very useful feature. Signed-off-by: Shawn O. Pearce --- contrib/completion/git-completion.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8f27aa9a13..6ed6a51dc6 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -525,6 +525,11 @@ _git_commit () COMPREPLY=() } +_git_describe () +{ + __gitcomp "$(__git_refs)" +} + _git_diff () { __git_complete_file @@ -1065,6 +1070,7 @@ _git () cherry-pick) _git_cherry_pick ;; commit) _git_commit ;; config) _git_config ;; + describe) _git_describe ;; diff) _git_diff ;; fetch) _git_fetch ;; format-patch) _git_format_patch ;; @@ -1112,6 +1118,7 @@ complete -o default -o nospace -F _git_checkout git-checkout complete -o default -o nospace -F _git_cherry git-cherry complete -o default -o nospace -F _git_cherry_pick git-cherry-pick complete -o default -o nospace -F _git_commit git-commit +complete -o default -o nospace -F _git_describe git-describe complete -o default -o nospace -F _git_diff git-diff complete -o default -o nospace -F _git_fetch git-fetch complete -o default -o nospace -F _git_format_patch git-format-patch @@ -1145,6 +1152,7 @@ complete -o default -o nospace -F _git git.exe complete -o default -o nospace -F _git_branch git-branch.exe complete -o default -o nospace -F _git_bundle git-bundle.exe complete -o default -o nospace -F _git_cherry git-cherry.exe +complete -o default -o nospace -F _git_describe git-describe.exe complete -o default -o nospace -F _git_diff git-diff.exe complete -o default -o nospace -F _git_format_patch git-format-patch.exe complete -o default -o nospace -F _git_log git-log.exe From be86f7a0dfa05dacb2ef512e99d1de576e77a633 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Aug 2007 01:50:49 -0400 Subject: [PATCH 50/95] Teach bash about git-submodule and its subcommands The git-submodule command is new in 1.5.3 and contains a number of useful subcommands for working on submodules. We usually try to offer the subcommands of a git command in the bash completion, so here they are for git-submodule. Signed-off-by: Shawn O. Pearce --- contrib/completion/git-completion.bash | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6ed6a51dc6..a652c88b27 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1024,6 +1024,31 @@ _git_stash () __gitcomp 'list show apply clear' } +_git_submodule () +{ + local i c=1 command + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + add|status|init|update) command="$i"; break ;; + esac + c=$((++c)) + done + + if [ $c -eq $COMP_CWORD -a -z "$command" ]; then + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--quiet --cached" + ;; + *) + __gitcomp "add status init update" + ;; + esac + return + fi +} + _git () { local i c=1 command __git_dir @@ -1090,6 +1115,7 @@ _git () show) _git_show ;; show-branch) _git_log ;; stash) _git_stash ;; + submodule) _git_submodule ;; whatchanged) _git_log ;; *) COMPREPLY=() ;; esac @@ -1138,6 +1164,7 @@ complete -o default -o nospace -F _git_reset git-reset complete -o default -o nospace -F _git_shortlog git-shortlog complete -o default -o nospace -F _git_show git-show complete -o default -o nospace -F _git_stash git-stash +complete -o default -o nospace -F _git_submodule git-submodule complete -o default -o nospace -F _git_log git-show-branch complete -o default -o nospace -F _git_log git-whatchanged From 9f4119eb7651c7898f385198409be4ca051bc7ef Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Aug 2007 02:39:45 -0400 Subject: [PATCH 51/95] git-gui: Refactor diff pane popup support for future improvements The current popup_diff_menu procedure is somewhat messy as it has a few duplications of the same logic in each of the different legs of the routine. We can simplify these by setting a few state variables in the different legs. No functional change, just a cleanup to make it easier to implement future functional changes within this block. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index b25b52fd11..559b62be03 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2432,20 +2432,19 @@ proc popup_diff_menu {ctxm x y X Y} { set ::cursorX $x set ::cursorY $y if {$::ui_index eq $::current_diff_side} { - $ctxm entryconf $::ui_diff_applyhunk \ - -state normal \ - -label {Unstage Hunk From Commit} - } elseif {$current_diff_path eq {} - || ![info exists file_states($current_diff_path)] - || {_O} eq [lindex $file_states($current_diff_path) 0]} { - $ctxm entryconf $::ui_diff_applyhunk \ - -state disabled \ - -label {Stage Hunk For Commit} + set s normal + set l "Unstage Hunk From Commit" } else { - $ctxm entryconf $::ui_diff_applyhunk \ - -state normal \ - -label {Stage Hunk For Commit} + if {$current_diff_path eq {} + || ![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($current_diff_path) 0]} { + set s disabled + } else { + set s normal + } + set l "Stage Hunk For Commit" } + $ctxm entryconf $::ui_diff_applyhunk -state $s -label $l tk_popup $ctxm $X $Y } bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y] From 15d54753bb59917db93e27ddfbb3b52d1f4f8c31 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Aug 2007 22:14:31 -0700 Subject: [PATCH 52/95] git-svn: dcommit prints out the URL to be committed to This will print out the URL that dcommit will operate on. If used with --dry-run this will print out the URL without making changes to the repository. Signed-off-by: Eric Wong --- git-svn.perl | 1 + 1 file changed, 1 insertion(+) diff --git a/git-svn.perl b/git-svn.perl index d162114e26..7a8ffd5227 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -370,6 +370,7 @@ sub cmd_dcommit { $head ||= 'HEAD'; my @refs; my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs); + print "Committing to $url ...\n"; unless ($gs) { die "Unable to determine upstream SVN information from ", "$head history\n"; From 9c9f5fa97fe078b59be14a6bcabb851745ddd48c Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Aug 2007 02:44:13 -0400 Subject: [PATCH 53/95] git-gui: Do not offer to stage three-way diff hunks into the index git-apply does not accept a patch that was generated as a three-way combined diff format such as we see during merge conflicts. If we get such a diff in our diff viewer and try to send it to git-apply it just errors out and the user is left confused wondering why they cannot stage that hunk. Instead of feeding a known to be unacceptable hunk to git-apply we now just disable the stage/unstage context menu option if the hunk came from a three way diff. The user may still be confused about why they cannot work with a combined diff, but at least they are only confused as to why git-gui is not offering them the action. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index 559b62be03..743b7d4196 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -738,6 +738,7 @@ set empty_tree {} set current_branch {} set is_detached 0 set current_diff_path {} +set is_3way_diff 0 set selected_commit_type new ###################################################################### @@ -2444,6 +2445,9 @@ proc popup_diff_menu {ctxm x y X Y} { } set l "Stage Hunk For Commit" } + if {$::is_3way_diff} { + set s disabled + } $ctxm entryconf $::ui_diff_applyhunk -state $s -label $l tk_popup $ctxm $X $Y } From b1d884a9e3968db1fff91c2d066d871a3b8b013c Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 23 Aug 2007 07:51:45 +0200 Subject: [PATCH 54/95] diff-delta.c: Fix broken skip calculation. A particularly bad case was HASH_LIMIT <= hash_count[i] < 2*HASH_LIMIT: in that case, only a single hash survived. For larger cases, 2*HASH_LIMIT was the actual limiting value after pruning. Signed-off-by: David Kastrup Acked-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- diff-delta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-delta.c b/diff-delta.c index 3af583536f..0dde2f2dc0 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -213,7 +213,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) entry = hash[i]; do { struct index_entry *keep = entry; - int skip = hash_count[i] / HASH_LIMIT / 2; + int skip = hash_count[i] / HASH_LIMIT; do { entry = entry->next; } while(--skip && entry); From 8f728fb96f00860cae58f4f2c5c9c96651e6a626 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 14 Jul 2007 11:25:28 +0200 Subject: [PATCH 55/95] git-svn init/clone --stdlayout option to default-init trunk/tags/branches The --stdlayout option to git-svn init/clone initialises the default Subversion values of trunk,tags,branches: -T trunk -b branches -t tags. If any of the -T/-t/-b options are given in addition, they are given preference. [ew: fixed whitespace and added "-s" shortcut] Signed-off-by: martin f. krafft Signed-off-by: Eric Wong --- Documentation/git-svn.txt | 7 ++++++- git-svn.perl | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index fbc58871f5..3e2a63b746 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -44,10 +44,15 @@ COMMANDS --tags=;; -b;; --branches=;; +-s;; +--stdlayout;; These are optional command-line options for init. Each of these flags can point to a relative repository path (--tags=project/tags') or a full url - (--tags=https://foo.org/project/tags) + (--tags=https://foo.org/project/tags). The option --stdlayout is + a shorthand way of setting trunk,tags,branches as the relative paths, + which is the Subversion default. If any of the other options are given + as well, they take precedence. --no-metadata;; Set the 'noMetadata' option in the [svn-remote] config. --use-svm-props;; diff --git a/git-svn.perl b/git-svn.perl index 7a8ffd5227..4e325b771b 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent, \$Git::SVN::_repack_flags, %remote_opts ); -my ($_trunk, $_tags, $_branches); +my ($_trunk, $_tags, $_branches, $_stdlayout); my %icv; my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared, 'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags, 'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix, + 'stdlayout|s' => \$_stdlayout, 'minimize-url|m' => \$Git::SVN::_minimize_url, 'no-metadata' => sub { $icv{noMetadata} = 1 }, 'use-svm-props' => sub { $icv{useSvmProps} = 1 }, @@ -292,7 +293,8 @@ sub init_subdir { sub cmd_clone { my ($url, $path) = @_; if (!defined $path && - (defined $_trunk || defined $_branches || defined $_tags) && + (defined $_trunk || defined $_branches || defined $_tags || + defined $_stdlayout) && $url !~ m#^[a-z\+]+://#) { $path = $url; } @@ -302,6 +304,11 @@ sub cmd_clone { } sub cmd_init { + if (defined $_stdlayout) { + $_trunk = 'trunk' if (!defined $_trunk); + $_tags = 'tags' if (!defined $_tags); + $_branches = 'branches' if (!defined $_branches); + } if (defined $_trunk || defined $_branches || defined $_tags) { return cmd_multi_init(@_); } From 191131e538dd4188dbada7ce871f80af80556292 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 20 Aug 2007 09:23:15 +0200 Subject: [PATCH 56/95] Install man3 manpages to $PREFIX/share/man/man3 even for site installs MakeMaker supports three installation modes: perl, site, and vendor. The first and third install manpages to $PREFIX/share/man, only site installs to $PREFIX/man. For consistency with the rest of git, which does not make the distinction and writes all manpages to $PREFIX/share/man, this change makes sure that perl does too, even when it's installed in site mode. Signed-off-by: martin f. krafft Signed-off-by: Junio C Hamano --- perl/Makefile.PL | 1 + 1 file changed, 1 insertion(+) diff --git a/perl/Makefile.PL b/perl/Makefile.PL index 437516142c..6aecd897f8 100644 --- a/perl/Makefile.PL +++ b/perl/Makefile.PL @@ -29,5 +29,6 @@ WriteMakefile( VERSION_FROM => 'Git.pm', PM => \%pm, MAKEFILE => 'perl.mak', + INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3', %extra ); From 1d25c8cf82eead72e11287d574ef72d3ebec0db1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 23 Aug 2007 09:55:41 +0100 Subject: [PATCH 57/95] rebase -i: fix squashing corner case When squashing, rebase -i did not prevent fast forwards. This could happen when picking some other commit than the first one, and then squashing the first commit. So do not allow fast forwards when squashing. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 5 +++-- t/t3404-rebase-interactive.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index bdec462609..ec798a16e9 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -96,13 +96,14 @@ die_abort () { } pick_one () { - case "$1" in -n) sha1=$2 ;; *) sha1=$1 ;; esac + no_ff= + case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1" test -d "$REWRITTEN" && pick_one_preserving_merges "$@" && return parent_sha1=$(git rev-parse --verify $sha1^ 2>/dev/null) current_sha1=$(git rev-parse --verify HEAD) - if test $current_sha1 = $parent_sha1; then + if test $no_ff$current_sha1 = $parent_sha1; then output git reset --hard $sha1 test "a$1" = a-n && output git reset --soft $current_sha1 sha1=$(git rev-parse --short $sha1) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 40d6799ed6..718c9c1fa3 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -264,6 +264,27 @@ test_expect_success 'interrupted squash works as expected' ' test $one = $(git rev-parse HEAD~2) ' +test_expect_success 'interrupted squash works as expected (case 2)' ' + for n in one two three four + do + echo $n >> conflict && + git add conflict && + git commit -m $n + done && + one=$(git rev-parse HEAD~3) && + ! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 && + (echo one; echo four) > conflict && + git add conflict && + ! git rebase --continue && + (echo one; echo two; echo four) > conflict && + git add conflict && + ! git rebase --continue && + echo resolved > conflict && + git add conflict && + git rebase --continue && + test $one = $(git rev-parse HEAD~2) +' + test_expect_success 'ignore patch if in upstream' ' HEAD=$(git rev-parse HEAD) && git checkout -b has-cherry-picked HEAD^ && From 9ec398d200cb07534a92045104862d681c7a7da2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 23 Aug 2007 10:18:54 -0700 Subject: [PATCH 58/95] Fix racy-git handling in git-write-tree. After git-write-tree finishes computing the tree, it updates the index so that later operations can take advantage of fully populated cache tree. However, anybody writing the index file has to mark the entries that are racily clean. For each entry whose cached lstat(3) data in the index exactly matches what is obtained from the filesystem, if the timestamp on the index file was the same or older than the modification timestamp of the file, the blob contents and the work tree file, after convert_to_git(), need to be compared, and if they are different, its index entry needs to be marked not to match the lstat(3) data from the filesystem. In order for this to work, convert_to_git() needs to work correctly, which in turn means you need to read the config file to get the settings of core.crlf and friends. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- builtin-write-tree.c | 1 + t/t0023-crlf-am.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 t/t0023-crlf-am.sh diff --git a/builtin-write-tree.c b/builtin-write-tree.c index 88f34ba7d6..b89d02efec 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -72,6 +72,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) const char *prefix = NULL; unsigned char sha1[20]; + git_config(git_default_config); while (1 < argc) { const char *arg = argv[1]; if (!strcmp(arg, "--missing-ok")) diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh new file mode 100755 index 0000000000..6f8a4347d5 --- /dev/null +++ b/t/t0023-crlf-am.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +test_description='Test am with auto.crlf' + +. ./test-lib.sh + +cat >patchfile <<\EOF +From 38be10072e45dd6b08ce40851e3fca60a31a340b Mon Sep 17 00:00:00 2001 +From: Marius Storm-Olsen +Date: Thu, 23 Aug 2007 13:00:00 +0200 +Subject: test1 + +--- + foo | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + create mode 100644 foo + +diff --git a/foo b/foo +new file mode 100644 +index 0000000000000000000000000000000000000000..5716ca5987cbf97d6bb54920bea6adde242d87e6 +--- /dev/null ++++ b/foo +@@ -0,0 +1 @@ ++bar +EOF + +test_expect_success 'setup' ' + + git config core.autocrlf true && + echo foo >bar && + git add bar && + test_tick && + git commit -m initial + +' + +test_expect_success 'am' ' + + git am --binary -3 Date: Thu, 23 Aug 2007 20:40:08 -0400 Subject: [PATCH 59/95] Documentation: For consistency, use CVS instead of cvs. When not referring to the cvs command, CVS makes more sense. Signed-off-by: Brian Hetro Signed-off-by: Junio C Hamano --- Documentation/config.txt | 4 ++-- Documentation/git-cvsexportcommit.txt | 2 +- Documentation/git-cvsserver.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 462595cf8f..a9fb221c05 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -465,11 +465,11 @@ rerere.enabled:: be encountered again. See gitlink:git-rerere[1]. gitcvs.enabled:: - Whether the cvs server interface is enabled for this repository. + Whether the CVS server interface is enabled for this repository. See gitlink:git-cvsserver[1]. gitcvs.logfile:: - Path to a log file where the cvs server interface well... logs + Path to a log file where the CVS server interface well... logs various stuff. See gitlink:git-cvsserver[1]. gitcvs.allbinary:: diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt index 6c423e3a2f..4c8d1e6386 100644 --- a/Documentation/git-cvsexportcommit.txt +++ b/Documentation/git-cvsexportcommit.txt @@ -59,7 +59,7 @@ OPTIONS Useful for patch series and the like. -u:: - Update affected files from cvs repository before attempting export. + Update affected files from CVS repository before attempting export. -v:: Verbose. diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index 60d0bcf0f3..258a62f7e9 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -102,7 +102,7 @@ No special setup is needed for SSH access, other than having GIT tools in the PATH. If you have clients that do not accept the CVS_SERVER environment variable, you can rename git-cvsserver to cvs. -Note: Newer cvs versions (>= 1.12.11) also support specifying +Note: Newer CVS versions (>= 1.12.11) also support specifying CVS_SERVER directly in CVSROOT like ------ From 027830755d2972ab2201c53922ce402862a2bd80 Mon Sep 17 00:00:00 2001 From: Brian Hetro Date: Thu, 23 Aug 2007 20:44:13 -0400 Subject: [PATCH 60/95] Documentation: Correct various misspellings and typos. Fix minor typos throughout the documentation. Signed-off-by: Brian Hetro Signed-off-by: Junio C Hamano --- Documentation/config.txt | 12 ++++++------ Documentation/git-commit-tree.txt | 2 +- Documentation/git-config.txt | 2 +- Documentation/git-fast-import.txt | 18 +++++++++--------- Documentation/git-fmt-merge-msg.txt | 2 +- Documentation/git-format-patch.txt | 2 +- Documentation/git-gui.txt | 2 +- Documentation/git-http-fetch.txt | 2 +- Documentation/git-local-fetch.txt | 2 +- Documentation/git-name-rev.txt | 2 +- Documentation/git-receive-pack.txt | 2 +- Documentation/git-reflog.txt | 2 +- Documentation/git-repack.txt | 2 +- Documentation/git-rev-list.txt | 2 +- Documentation/git-svn.txt | 4 ++-- Documentation/gitattributes.txt | 6 +++--- Documentation/hooks.txt | 2 +- Documentation/tutorial.txt | 2 +- Documentation/user-manual.txt | 12 ++++++------ 19 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index a9fb221c05..903610fecf 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -283,7 +283,7 @@ core.excludesfile:: core.editor:: Commands such as `commit` and `tag` that lets you edit - messages by lauching an editor uses the value of this + messages by launching an editor uses the value of this variable when it is set, and the environment variable `GIT_EDITOR` is not set. The order of preference is `GIT_EDITOR` environment, `core.editor`, `VISUAL` and @@ -500,10 +500,10 @@ gitcvs.dbuser, gitcvs.dbpass:: 'gitcvs.dbuser' supports variable substitution (see gitlink:git-cvsserver[1] for details). -All gitcvs variables except for 'gitcvs.allbinary' can also specifed -as 'gitcvs..' (where 'access_method' is one -of "ext" and "pserver") to make them apply only for the given access -method. +All gitcvs variables except for 'gitcvs.allbinary' can also be +specified as 'gitcvs..' (where 'access_method' +is one of "ext" and "pserver") to make them apply only for the given +access method. http.sslVerify:: Whether to verify the SSL certificate when fetching or pushing @@ -615,7 +615,7 @@ pack.compression:: not set, defaults to -1. pack.deltaCacheSize:: - The maxium memory in bytes used for caching deltas in + The maximum memory in bytes used for caching deltas in gitlink:git-pack-objects[1]. A value of 0 means no limit. Defaults to 0. diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index 6a328f497e..a2537e179a 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -52,7 +52,7 @@ A commit encapsulates: - committer name and email and the commit time. While parent object ids are provided on the command line, author and -commiter information is taken from the following environment variables, +committer information is taken from the following environment variables, if set: GIT_AUTHOR_NAME diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index c3dffffe32..5b794f4399 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -139,7 +139,7 @@ See also <>. FILES ----- -If not set explicitely with '--file', there are three files where +If not set explicitly with '--file', there are three files where git-config will search for configuration options: .git/config:: diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 0a019dd2e5..d5119678b5 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -241,7 +241,7 @@ been well tested in the wild. + Frontends should prefer the `raw` format if the source material already uses UNIX-epoch format, can be coaxed to give dates in that -format, or its format is easiliy convertible to it, as there is no +format, or its format is easily convertible to it, as there is no ambiguity in parsing. `now`:: @@ -343,7 +343,7 @@ Zero or more `filemodify`, `filedelete`, `filecopy`, `filerename` and `filedeleteall` commands may be included to update the contents of the branch prior to creating the commit. These commands may be supplied in any order. -However it is recommended that a `filedeleteall` command preceed +However it is recommended that a `filedeleteall` command precede all `filemodify`, `filecopy` and `filerename` commands in the same commit, as `filedeleteall` wipes the branch clean (see below). @@ -402,7 +402,7 @@ Here `` is any of the following: + The reason fast-import uses `:` to denote a mark reference is this character is not legal in a Git branch name. The leading `:` makes it easy -to distingush between the mark 42 (`:42`) and the branch 42 (`42` +to distinguish between the mark 42 (`:42`) and the branch 42 (`42` or `refs/heads/42`), or an abbreviated SHA-1 which happened to consist only of base-10 digits. + @@ -487,7 +487,7 @@ start with double quote (`"`). If an `LF` or double quote must be encoded into `` shell-style quoting should be used, e.g. `"path/with\n and \" in it"`. -The value of `` must be in canoncial form. That is it must not: +The value of `` must be in canonical form. That is it must not: * contain an empty directory component (e.g. `foo//bar` is invalid), * end with a directory separator (e.g. `foo/` is invalid), @@ -733,7 +733,7 @@ of the next line, even if `` did not end with an `LF`. Delimited format:: A delimiter string is used to mark the end of the data. fast-import will compute the length by searching for the delimiter. - This format is primarly useful for testing and is not + This format is primarily useful for testing and is not recommended for real data. + .... @@ -873,7 +873,7 @@ to remove the dummy branch. Import Now, Repack Later ~~~~~~~~~~~~~~~~~~~~~~~~ As soon as fast-import completes the Git repository is completely valid -and ready for use. Typicallly this takes only a very short time, +and ready for use. Typically this takes only a very short time, even for considerably large projects (100,000+ commits). However repacking the repository is necessary to improve data @@ -942,8 +942,8 @@ Memory Utilization ------------------ There are a number of factors which affect how much memory fast-import requires to perform an import. Like critical sections of core -Git, fast-import uses its own memory allocators to ammortize any overheads -associated with malloc. In practice fast-import tends to ammoritize any +Git, fast-import uses its own memory allocators to amortize any overheads +associated with malloc. In practice fast-import tends to amortize any malloc overheads to 0, due to its use of large block allocations. per object @@ -1000,7 +1000,7 @@ per active tree ~~~~~~~~~~~~~~~ Trees (aka directories) use just 12 bytes of memory on top of the memory required for their entries (see ``per active file'' below). -The cost of a tree is virtually 0, as its overhead ammortizes out +The cost of a tree is virtually 0, as its overhead amortizes out over the individual file entries. per active file entry diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt index 6affc5bb4d..7088ed4095 100644 --- a/Documentation/git-fmt-merge-msg.txt +++ b/Documentation/git-fmt-merge-msg.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] git-fmt-merge-msg [--summary | --no-summary] <$GIT_DIR/FETCH_HEAD -git-fmt-merge-msg [--summary | --no-summray] -F +git-fmt-merge-msg [--summary | --no-summary] -F DESCRIPTION ----------- diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index 6cbcf937bc..c514fdd93f 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -118,7 +118,7 @@ include::diff-options.txt[] --suffix=.:: Instead of using `.patch` as the suffix for generated - filenames, use specifed suffix. A common alternative is + filenames, use specified suffix. A common alternative is `--suffix=.txt`. + Note that you would need to include the leading dot `.` if you diff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt index bd613b2fcf..13252a1aa6 100644 --- a/Documentation/git-gui.txt +++ b/Documentation/git-gui.txt @@ -89,7 +89,7 @@ See Also Other ----- git-gui is actually maintained as an independent project, but stable -versions are distributed as part of the Git suite for the convience +versions are distributed as part of the Git suite for the convenience of end users. A git-gui development repository can be obtained from: diff --git a/Documentation/git-http-fetch.txt b/Documentation/git-http-fetch.txt index 45e48453a1..389c6edfb8 100644 --- a/Documentation/git-http-fetch.txt +++ b/Documentation/git-http-fetch.txt @@ -34,7 +34,7 @@ commit-id:: the local end after the transfer is complete. --stdin:: - Instead of a commit id on the commandline (which is not expected in this + Instead of a commit id on the command line (which is not expected in this case), 'git-http-fetch' expects lines on stdin in the format ['\t'] diff --git a/Documentation/git-local-fetch.txt b/Documentation/git-local-fetch.txt index 141b76768c..e830deeff3 100644 --- a/Documentation/git-local-fetch.txt +++ b/Documentation/git-local-fetch.txt @@ -44,7 +44,7 @@ OPTIONS the local end after the transfer is complete. --stdin:: - Instead of a commit id on the commandline (which is not expected in this + Instead of a commit id on the command line (which is not expected in this case), 'git-local-fetch' expects lines on stdin in the format ['\t'] diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt index 91eede120e..306e1a4956 100644 --- a/Documentation/git-name-rev.txt +++ b/Documentation/git-name-rev.txt @@ -37,7 +37,7 @@ OPTIONS --name-only:: Instead of printing both the SHA-1 and the name, print only the name. If given with --tags the usual tag prefix of - "tags/" is also ommitted from the name, matching the output + "tags/" is also omitted from the name, matching the output of gitlink::git-describe[1] more closely. This option cannot be combined with --stdin. diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt index 4ef1840472..2633d94c59 100644 --- a/Documentation/git-receive-pack.txt +++ b/Documentation/git-receive-pack.txt @@ -78,7 +78,7 @@ The hook should exit with non-zero status if it wants to disallow updating the named ref. Otherwise it should exit with zero. Successful execution (a zero exit status) of this hook does not -ensure the ref will actully be updated, it is only a prerequisite. +ensure the ref will actually be updated, it is only a prerequisite. As such it is not a good idea to send notices (e.g. email) from this hook. Consider using the post-receive hook instead. diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt index 29b7d9f5f8..5180f6810d 100644 --- a/Documentation/git-reflog.txt +++ b/Documentation/git-reflog.txt @@ -30,7 +30,7 @@ Entries older than `expire` time, or entries older than tip, are removed from the reflog. This is typically not used directly by the end users -- instead, see gitlink:git-gc[1]. -The subcommand "show" (which is also the default, in the absense of any +The subcommand "show" (which is also the default, in the absence of any subcommands) will take all the normal log options, and show the log of `HEAD`, which will cover all recent actions, including branch switches. It is basically an alias for 'git log -g --abbrev-commit diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt index 5283ef84a9..12e2079a7c 100644 --- a/Documentation/git-repack.txt +++ b/Documentation/git-repack.txt @@ -14,7 +14,7 @@ DESCRIPTION ----------- This script is used to combine all objects that do not currently -reside in a "pack", into a pack. It can also be used to re-organise +reside in a "pack", into a pack. It can also be used to re-organize existing packs into a single, more efficient pack. A pack is a collection of objects, individually compressed, with diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index a0c611e744..7cd0e8913e 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -113,7 +113,7 @@ e.g. "2 hours ago". `--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822 format, often found in E-mail messages. + -`--date=short` shows only date but not time, in `YYYY-MM-DD` fomat. +`--date=short` shows only date but not time, in `YYYY-MM-DD` format. + `--date=default` shows timestamps in the original timezone (either committer's or author's). diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 3e2a63b746..3420c5c958 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -99,7 +99,7 @@ COMMANDS This works similarly to 'svn update' or 'git-pull' except that it preserves linear history with 'git-rebase' instead of -'git-merge' for ease of dcommit-ing with git-svn. +'git-merge' for ease of dcommiting with git-svn. This accepts all options that 'git-svn fetch' and 'git-rebase' accepts. However '--fetch-all' only fetches from the current @@ -551,7 +551,7 @@ listed below are allowed: Keep in mind that the '*' (asterisk) wildcard of the local ref (left of the ':') *must* be the farthest right path component; however the remote wildcard may be anywhere as long as it's own -independent path componet (surrounded by '/' or EOL). This +independent path component (surrounded by '/' or EOL). This type of configuration is not automatically created by 'init' and should be manually entered with a text-editor or using gitlink:git-config[1] diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 8b90a5b980..46f9d591aa 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -285,7 +285,7 @@ want to appear as the hunk header, like this: Note. A single level of backslashes are eaten by the configuration file parser, so you would need to double the backslashes; the pattern above picks a line that begins with a -backslash, and zero or more occurences of `sub` followed by +backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. There are a few built-in patterns to make this easier, and `tex` @@ -394,7 +394,7 @@ abc -foo -bar the attributes given to path `t/abc` are computed as follows: 1. By examining `t/.gitattributes` (which is in the same - diretory as the path in question), git finds that the first + directory as the path in question), git finds that the first line matches. `merge` attribute is set. It also finds that the second line matches, and attributes `foo` and `bar` are unset. @@ -410,7 +410,7 @@ the attributes given to path `t/abc` are computed as follows: a match, and `foo` is set, `bar` is reverted to unspecified state, and `baz` is unset. -As the result, the attributes assignement to `t/abc` becomes: +As the result, the attributes assignment to `t/abc` becomes: ---------------------------------------------------------------- foo set to true diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt index 6836477ca8..c39edc57c4 100644 --- a/Documentation/hooks.txt +++ b/Documentation/hooks.txt @@ -176,7 +176,7 @@ hook does on its standard input. This hook does not affect the outcome of `git-receive-pack`, as it is called after the real work is done. -This supersedes the <> hook in that it get's +This supersedes the <> hook in that it gets both old and new values of all the refs in addition to their names. diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index bd9fbee99a..fff1068c54 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -339,7 +339,7 @@ $ git pull . remotes/bob/master ------------------------------------- Note that git pull always merges into the current branch, -regardless of what else is given on the commandline. +regardless of what else is given on the command line. Later, Bob can update his repo with Alice's latest changes using diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index f89952ad84..3d02198cc7 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -4,7 +4,7 @@ ______________________________________________ Git is a fast distributed revision control system. -This manual is designed to be readable by someone with basic unix +This manual is designed to be readable by someone with basic UNIX command-line skills, but no previous knowledge of git. <> and <> explain how @@ -217,7 +217,7 @@ commits will help understand how the git organizes history. In the following, we say that commit X is "reachable" from commit Y if commit X is an ancestor of commit Y. Equivalently, you could say -that Y is a descendent of X, or that there is a chain of parents +that Y is a descendant of X, or that there is a chain of parents leading from commit Y to commit X. [[history-diagrams]] @@ -1911,7 +1911,7 @@ gitlink:git-update-server-info[1], and the documentation link:hooks.html[Hooks used by git].) Advertise the url of proj.git. Anybody else should then be able to -clone or pull from that url, for example with a commandline like: +clone or pull from that url, for example with a command line like: ------------------------------------------------- $ git clone http://yourserver.com/~you/proj.git @@ -2531,7 +2531,7 @@ them again with gitlink:git-am[1]. Other tools ----------- -There are numerous other tools, such as stgit, which exist for the +There are numerous other tools, such as StGIT, which exist for the purpose of maintaining a patch series. These are outside of the scope of this manual. @@ -3961,8 +3961,8 @@ This is a work in progress. The basic requirements: - It must be readable in order, from beginning to end, by - someone intelligent with a basic grasp of the unix - commandline, but without any special knowledge of git. If + someone intelligent with a basic grasp of the UNIX + command line, but without any special knowledge of git. If necessary, any other prerequisites should be specifically mentioned as they arise. - Whenever possible, section headings should clearly describe From 5ca4461728adadf22b5b8833693702ab09e556db Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Aug 2007 17:44:16 +0200 Subject: [PATCH 61/95] git-p4: Make 'git-p4 branches' work after an initial clone with git clone from an origin-updated repository. After a clone with "git clone" of a repository the p4 branches are only in remotes/origin/p4/* and not in remotes/p4/*. Separate the code for detection and creation out of the P4Sync command class into standalone methods and use them from the P4Branches command. Signed-off-by: Simon Hausmann Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4 | 104 ++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 6d0106237a..b571e30473 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -231,6 +231,56 @@ def findUpstreamBranchPoint(head = "HEAD"): return ["", settings] +def createOrUpdateBranchesFromOrigin(localRefPrefix = "refs/remotes/p4/", silent=True): + if not silent: + print ("Creating/updating branch(es) in %s based on origin branch(es)" + % localRefPrefix) + + originPrefix = "origin/p4/" + + for line in read_pipe_lines("git rev-parse --symbolic --remotes"): + line = line.strip() + if (not line.startswith(originPrefix)) or line.endswith("HEAD"): + continue + + headName = line[len(originPrefix):] + remoteHead = localRefPrefix + headName + originHead = line + + original = extractSettingsGitLog(extractLogMessageFromGitCommit(originHead)) + if (not original.has_key('depot-paths') + or not original.has_key('change')): + continue + + update = False + if not gitBranchExists(remoteHead): + if verbose: + print "creating %s" % remoteHead + update = True + else: + settings = extractSettingsGitLog(extractLogMessageFromGitCommit(remoteHead)) + if settings.has_key('change') > 0: + if settings['depot-paths'] == original['depot-paths']: + originP4Change = int(original['change']) + p4Change = int(settings['change']) + if originP4Change > p4Change: + print ("%s (%s) is newer than %s (%s). " + "Updating p4 branch from origin." + % (originHead, originP4Change, + remoteHead, p4Change)) + update = True + else: + print ("Ignoring: %s was imported from %s while " + "%s was imported from %s" + % (originHead, ','.join(original['depot-paths']), + remoteHead, ','.join(settings['depot-paths']))) + + if update: + system("git update-ref %s %s" % (remoteHead, originHead)) + +def originP4BranchesExist(): + return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") + class Command: def __init__(self): self.usage = "usage: %prog [options]" @@ -1041,53 +1091,6 @@ class P4Sync(Command): for branch in branches.keys(): self.initialParents[self.refPrefix + branch] = branches[branch] - def createOrUpdateBranchesFromOrigin(self): - if not self.silent: - print ("Creating/updating branch(es) in %s based on origin branch(es)" - % self.refPrefix) - - originPrefix = "origin/p4/" - - for line in read_pipe_lines("git rev-parse --symbolic --remotes"): - line = line.strip() - if (not line.startswith(originPrefix)) or line.endswith("HEAD"): - continue - - headName = line[len(originPrefix):] - remoteHead = self.refPrefix + headName - originHead = line - - original = extractSettingsGitLog(extractLogMessageFromGitCommit(originHead)) - if (not original.has_key('depot-paths') - or not original.has_key('change')): - continue - - update = False - if not gitBranchExists(remoteHead): - if self.verbose: - print "creating %s" % remoteHead - update = True - else: - settings = extractSettingsGitLog(extractLogMessageFromGitCommit(remoteHead)) - if settings.has_key('change') > 0: - if settings['depot-paths'] == original['depot-paths']: - originP4Change = int(original['change']) - p4Change = int(settings['change']) - if originP4Change > p4Change: - print ("%s (%s) is newer than %s (%s). " - "Updating p4 branch from origin." - % (originHead, originP4Change, - remoteHead, p4Change)) - update = True - else: - print ("Ignoring: %s was imported from %s while " - "%s was imported from %s" - % (originHead, ','.join(original['depot-paths']), - remoteHead, ','.join(settings['depot-paths']))) - - if update: - system("git update-ref %s %s" % (remoteHead, originHead)) - def updateOptionDict(self, d): option_keys = {} if self.keepRepoPath: @@ -1108,7 +1111,7 @@ class P4Sync(Command): # map from branch depot path to parent branch self.knownBranches = {} self.initialParents = {} - self.hasOrigin = gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") + self.hasOrigin = originP4BranchesExist() if not self.syncWithOrigin: self.hasOrigin = False @@ -1135,7 +1138,7 @@ class P4Sync(Command): # merge with previous imports, if possible. if args == []: if self.hasOrigin: - self.createOrUpdateBranchesFromOrigin() + createOrUpdateBranchesFromOrigin(self.refPrefix, self.silent) self.listExistingP4GitBranches() if len(self.p4BranchesInGit) > 1: @@ -1518,6 +1521,9 @@ class P4Branches(Command): self.verbose = False def run(self, args): + if originP4BranchesExist(): + createOrUpdateBranchesFromOrigin() + cmdline = "git rev-parse --symbolic " cmdline += " --remotes" From 0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Aug 2007 17:46:16 +0200 Subject: [PATCH 62/95] git-p4: Fix warnings about non-existant refs/remotes/p4/HEAD ref when running git-p4 sync the first time after a git clone. Don't create the p4/HEAD symbolic ref if p4/master doesn't exist yet. Signed-off-by: Simon Hausmann Signed-off-by: Junio C Hamano --- contrib/fast-import/git-p4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index b571e30473..55778c5775 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -1131,7 +1131,7 @@ class P4Sync(Command): system("git update-ref %s refs/heads/p4" % self.branch) system("git branch -D p4"); # create it /after/ importing, when master exists - if not gitBranchExists(self.refPrefix + "HEAD") and self.importIntoRemotes: + if not gitBranchExists(self.refPrefix + "HEAD") and self.importIntoRemotes and gitBranchExists(self.branch): system("git symbolic-ref %sHEAD %s" % (self.refPrefix, self.branch)) # TODO: should always look at previous commits, From c80d25dbce759a8483ffc1f085fdf4cd63cf9f05 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 24 Aug 2007 23:15:50 -0400 Subject: [PATCH 63/95] git-gui: Correct 'git gui blame' in a subdirectory David Kastrup pointed out that the following sequence was not working as we had intended: $ cd lib $ git gui blame console.tcl fatal: cannot stat path lib/console.tcl: No such file or directory The problem here was we disabled the chdir to the root of the working tree when we are running with a "bare allowed" feature such as blame or browser, but we still kept the prefix we found via `git rev-parse --show-prefix`. This caused us to try and look for the file "console.tcl" within the subdirectory but also include the subdirectory's own path from the root of the working tree. This is unlikely to succeed, unless the user just happened to have a "lib/lib/console.tcl" file in the repository, in which case we would produce the wrong result. In the case of a bare repository we shouldn't get back a value from `rev-parse --show-prefix`, so really $_prefix should only be set to the non-empty string if we are in a working tree and we are in a subdirectory of that working tree. If this is true we really want to always be at the top level of the working tree, as all paths are accessed as though they were relative to the top of the working tree. Converting $_prefix to a ../ sequence is a fairly simple approach to moving up the requisite levels. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 743b7d4196..fa30ccc5d6 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -703,7 +703,15 @@ if {![file isdirectory $_gitdir]} { error_popup "Git directory not found:\n\n$_gitdir" exit 1 } -if {![is_enabled bare]} { +if {$_prefix ne {}} { + regsub -all {[^/]+/} $_prefix ../ cdup + if {[catch {cd $cdup} err]} { + catch {wm withdraw .} + error_popup "Cannot move to top of working directory:\n\n$err" + exit 1 + } + unset cdup +} elseif {![is_enabled bare]} { if {[lindex [file split $_gitdir] end] ne {.git}} { catch {wm withdraw .} error_popup "Cannot use funny .git directory:\n\n$_gitdir" From ab43e495dd095547c3ada9ae13b72f9741a7f0d2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 25 Aug 2007 01:26:20 -0700 Subject: [PATCH 64/95] blame: check return value from read_sha1_file() Signed-off-by: Junio C Hamano --- builtin-blame.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/builtin-blame.c b/builtin-blame.c index 0519339098..dc88a953a5 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -98,6 +98,10 @@ static char *fill_origin_blob(struct origin *o, mmfile_t *file) num_read_blob++; file->ptr = read_sha1_file(o->blob_sha1, &type, (unsigned long *)(&(file->size))); + if (!file->ptr) + die("Cannot read blob %s for path %s", + sha1_to_hex(o->blob_sha1), + o->path); o->file = *file; } else @@ -1384,6 +1388,9 @@ static void get_commit_info(struct commit *commit, unsigned long size; commit->buffer = read_sha1_file(commit->object.sha1, &type, &size); + if (!commit->buffer) + die("Cannot read commit %s", + sha1_to_hex(commit->object.sha1)); } ret->author = author_buf; get_ac_line(commit->buffer, "\nauthor ", @@ -2382,6 +2389,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix) sb.final_buf = read_sha1_file(o->blob_sha1, &type, &sb.final_buf_size); + if (!sb.final_buf) + die("Cannot read blob %s for path %s", + sha1_to_hex(o->blob_sha1), + path); } num_read_blob++; lno = prepare_lines(&sb); From 2e3404c3245e1e0031ef0a6574f25e8c35d5aac3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 25 Aug 2007 01:26:47 -0700 Subject: [PATCH 65/95] pack-objects: check return value from read_sha1_file() Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 77481df5d6..9b3ef94c4c 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1356,6 +1356,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, /* Load data if not already done */ if (!trg->data) { trg->data = read_sha1_file(trg_entry->idx.sha1, &type, &sz); + if (!trg->data) + die("object %s cannot be read", + sha1_to_hex(trg_entry->idx.sha1)); if (sz != trg_size) die("object %s inconsistent object length (%lu vs %lu)", sha1_to_hex(trg_entry->idx.sha1), sz, trg_size); @@ -1363,6 +1366,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, } if (!src->data) { src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz); + if (!src->data) + die("object %s cannot be read", + sha1_to_hex(src_entry->idx.sha1)); if (sz != src_size) die("object %s inconsistent object length (%lu vs %lu)", sha1_to_hex(src_entry->idx.sha1), sz, src_size); From 9064d87b06f3d0b4ca0aabb45770eefb84fc3ca2 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 25 Aug 2007 03:26:04 -0400 Subject: [PATCH 66/95] Don't segfault if we failed to inflate a packed delta Under some types of packfile corruption the zlib stream holding the data for a delta within a packfile may fail to inflate, due to say a CRC failure within the compressed data itself. When this occurs the unpack_compressed_entry function will return NULL as a signal to the caller that the data is not available. Unfortunately we then tried to use that NULL as though it referenced a memory location where a delta was stored and tried to apply it to the delta base. Loading a byte from the NULL address typically causes a SIGSEGV. cate on #git noticed this failure in `git fsck --full` where the call to verify_pack() first noticed that the packfile was corrupt by finding that the packfile's SHA-1 did not match the raw data of the file. After finding this fsck went ahead and tried to verify every object within the packfile, even though the packfile was already known to be bad. If we are going to shovel bad data at the delta unpacking code, we better handle it correctly. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- sha1_file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index b219d4d5f2..9978a58da6 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1570,6 +1570,10 @@ static void *unpack_delta_entry(struct packed_git *p, (uintmax_t)base_offset, p->pack_name); delta_data = unpack_compressed_entry(p, w_curs, curpos, delta_size); + if (!delta_data) + die("failed to unpack compressed delta" + " at %"PRIuMAX" from %s", + (uintmax_t)curpos, p->pack_name); result = patch_delta(base, base_size, delta_data, delta_size, sizep); From 1560be16b94a85df166ae26bcfff11bcd57c2fed Mon Sep 17 00:00:00 2001 From: Brian Hetro Date: Sat, 25 Aug 2007 23:19:38 -0400 Subject: [PATCH 67/95] Make usage documentation for git-am consistent. The usage information in git-am.sh now matches that of the documentation. Signed-off-by: Brian Hetro Signed-off-by: Junio C Hamano --- git-am.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-am.sh b/git-am.sh index b5ed8ca15c..6809aa07f6 100755 --- a/git-am.sh +++ b/git-am.sh @@ -2,8 +2,10 @@ # # Copyright (c) 2005, 2006 Junio C Hamano -USAGE='[--signoff] [--dotest=] [--utf8 | --no-utf8] [--binary] [--3way] - [--interactive] [--whitespace=