diff options
-rw-r--r-- | Documentation/.gitignore | 2 | ||||
-rw-r--r-- | Documentation/RelNotes-1.5.6.txt | 2 | ||||
-rwxr-xr-x | Documentation/cat-texi.perl | 2 | ||||
-rw-r--r-- | Documentation/git-cat-file.txt | 1 | ||||
-rw-r--r-- | Documentation/git-pull.txt | 3 | ||||
-rw-r--r-- | Documentation/gittutorial.txt | 2 | ||||
-rw-r--r-- | Documentation/pretty-formats.txt | 22 | ||||
-rw-r--r-- | Documentation/user-manual.txt | 15 | ||||
-rw-r--r-- | builtin-fast-export.c | 2 | ||||
-rwxr-xr-x | git-cvsimport.perl | 1 | ||||
-rwxr-xr-x | git-submodule.sh | 2 | ||||
-rw-r--r-- | gitk-git/gitk | 50 | ||||
-rw-r--r-- | sha1_file.c | 17 | ||||
-rw-r--r-- | t/.gitattributes | 3 | ||||
-rw-r--r-- | t/test-lib.sh | 2 |
15 files changed, 85 insertions, 41 deletions
diff --git a/Documentation/.gitignore b/Documentation/.gitignore index 2f938f471a..d8edd90406 100644 --- a/Documentation/.gitignore +++ b/Documentation/.gitignore @@ -2,7 +2,9 @@ *.html *.[1-8] *.made +*.texi git.info +gitman.info howto-index.txt doc.dep cmds-*.txt diff --git a/Documentation/RelNotes-1.5.6.txt b/Documentation/RelNotes-1.5.6.txt index a79e4b9393..ac4881e19a 100644 --- a/Documentation/RelNotes-1.5.6.txt +++ b/Documentation/RelNotes-1.5.6.txt @@ -70,7 +70,7 @@ Updates since v1.5.5 * "git init --bare" is a synonym for "git --bare init" now. -* "git gc --auto" honors a new pre-aut-gc hook to temporarily disable it. +* "git gc --auto" honors a new pre-auto-gc hook to temporarily disable it. * "git log --pretty=tformat:<custom format>" gives a LF after each entry, instead of giving a LF between each pair of entries which is how diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl index e3d8e9faa8..dbc133cd3c 100755 --- a/Documentation/cat-texi.perl +++ b/Documentation/cat-texi.perl @@ -11,7 +11,7 @@ while (<STDIN>) { if (s/^\@top (.*)/\@node $1,,,Top/) { push @menu, $1; } - s/\(\@pxref{\[URLS\]}\)//; + s/\(\@pxref{\[(URLS|REMOTES)\]}\)//; print TMP; } close TMP; diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index 3f77dbd107..f58013ca60 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -8,6 +8,7 @@ git-cat-file - Provide content or type/size information for repository objects SYNOPSIS -------- +[verse] 'git-cat-file' [-t | -s | -e | -p | <type>] <object> 'git-cat-file' [--batch | --batch-check] < <list-of-objects> diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 5f55f6494a..d0f1595f7e 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -38,7 +38,8 @@ include::merge-options.txt[] for branch `<name>`, set configuration `branch.<name>.rebase` to `true`. + -*NOTE:* This is a potentially _dangerous_ mode of operation. +[NOTE] +This is a potentially _dangerous_ mode of operation. It rewrites history, which does not bode well when you published that history already. Do *not* use this option unless you have read linkgit:git-rebase[1] carefully. diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt index 9563a632eb..d465aab64e 100644 --- a/Documentation/gittutorial.txt +++ b/Documentation/gittutorial.txt @@ -114,7 +114,7 @@ newly modified content to the index. Finally, commit your changes with: $ git commit ------------------------------------------------ -This will again prompt your for a message describing the change, and then +This will again prompt you for a message describing the change, and then record a new version of the project. Alternatively, instead of running `git add` beforehand, you can use diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index e8bea3e18e..ec37555794 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -124,3 +124,25 @@ The placeholders are: - '%m': left, right or boundary mark - '%n': newline - '%x00': print a byte from a hex code + +* 'tformat:' ++ +The 'tformat:' format works exactly like 'format:', except that it +provides "terminator" semantics instead of "separator" semantics. In +other words, each commit has the message terminator character (usually a +newline) appended, rather than a separator placed between entries. +This means that the final entry of a single-line format will be properly +terminated with a new line, just as the "oneline" format does. +For example: ++ +--------------------- +$ git log -2 --pretty=format:%h 4da45bef \ + | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' +4da45be +7134973 -- NO NEWLINE + +$ git log -2 --pretty=tformat:%h 4da45bef \ + | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' +4da45be +7134973 +--------------------- diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index bfde507e0e..64a820bf60 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1254,16 +1254,15 @@ these three "file stages" represents a different version of the file: ------------------------------------------------- $ git show :1:file.txt # the file in a common ancestor of both branches -$ git show :2:file.txt # the version from HEAD, but including any - # nonconflicting changes from MERGE_HEAD -$ git show :3:file.txt # the version from MERGE_HEAD, but including any - # nonconflicting changes from HEAD. +$ git show :2:file.txt # the version from HEAD. +$ git show :3:file.txt # the version from MERGE_HEAD. ------------------------------------------------- -Since the stage 2 and stage 3 versions have already been updated with -nonconflicting changes, the only remaining differences between them are -the important ones; thus linkgit:git-diff[1] can use the information in -the index to show only those conflicts. +When you ask linkgit:git-diff[1] to show the conflicts, it runs a +three-way diff between the conflicted merge results in the work tree with +stages 2 and 3 to show only hunks whose contents come from both sides, +mixed (in other words, when a hunk's merge results come only from stage 2, +that part is not conflicting and is not shown. Same for stage 3). The diff above shows the differences between the working-tree version of file.txt and the stage 2 and stage 3 versions. So instead of preceding diff --git a/builtin-fast-export.c b/builtin-fast-export.c index 1dfc01e8f0..d0a462ff8b 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -188,6 +188,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev) mark_object(&commit->object); if (!is_encoding_utf8(encoding)) reencoded = reencode_string(message, "UTF-8", encoding); + if (!commit->parents) + printf("reset %s\n", (const char*)commit->util); printf("commit %s\nmark :%d\n%.*s\n%.*s\ndata %u\n%s", (const char *)commit->util, last_idnum, (int)(author_end - author), author, diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 5a0255052c..cacbfc0259 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -227,6 +227,7 @@ sub conn { $proxyport = $1; } } + $repo ||= '/'; # if username is not explicit in CVSROOT, then use current user, as cvs would $user=(getlogin() || $ENV{'LOGNAME'} || $ENV{'USER'} || "anonymous") unless $user; diff --git a/git-submodule.sh b/git-submodule.sh index 100737210d..4032830907 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -73,7 +73,7 @@ resolve_relative_url () module_name() { # Do we have "submodule.<something>.path = $1" defined in .gitmodules file? - re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g') + re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g') name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) test -z "$name" && diff --git a/gitk-git/gitk b/gitk-git/gitk index 22bcd18a46..fddcb45817 100644 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -296,7 +296,7 @@ proc start_rev_list {view} { global startmsecs commitidx viewcomplete curview global commfd leftover tclencoding global viewargs viewargscmd viewfiles vfilelimit - global showlocalchanges commitinterest mainheadid + global showlocalchanges commitinterest global viewactive loginstance viewinstances vmergeonly global pending_select mainheadid global vcanopt vflags vrevs vorigargs @@ -358,7 +358,7 @@ proc start_rev_list {view} { set viewinstances($view) [list $i] set commfd($i) $fd set leftover($i) {} - if {$showlocalchanges} { + if {$showlocalchanges && $mainheadid ne {}} { lappend commitinterest($mainheadid) {dodiffindex} } fconfigure $fd -blocking 0 -translation lf -eofchar {} @@ -406,7 +406,7 @@ proc getcommits {} { proc updatecommits {} { global curview vcanopt vorigargs vfilelimit viewinstances - global viewactive viewcomplete loginstance tclencoding mainheadid + global viewactive viewcomplete loginstance tclencoding global startmsecs commfd showneartags showlocalchanges leftover global mainheadid pending_select global isworktree @@ -1467,7 +1467,6 @@ proc chewcommits {} { if {$viewcomplete($curview)} { global commitidx varctok global numcommits startmsecs - global mainheadid nullid if {[info exists pending_select]} { set row [first_real_row] @@ -1604,12 +1603,10 @@ proc readrefs {} { set mainhead {} set mainheadid {} catch { + set mainheadid [exec git rev-parse HEAD] set thehead [exec git symbolic-ref HEAD] if {[string match "refs/heads/*" $thehead]} { set mainhead [string range $thehead 11 end] - if {[info exists headids($mainhead)]} { - set mainheadid $headids($mainhead) - } } } } @@ -4022,6 +4019,7 @@ proc layoutmore {} { proc doshowlocalchanges {} { global curview mainheadid + if {$mainheadid eq {}} return if {[commitinview $mainheadid $curview]} { dodiffindex } else { @@ -4841,7 +4839,8 @@ proc drawcmittext {id row col} { global cmitlisted commitinfo rowidlist parentlist global rowtextx idpos idtags idheads idotherrefs global linehtag linentag linedtag selectedline - global canvxmax boldrows boldnamerows fgcolor nullid nullid2 + global canvxmax boldrows boldnamerows fgcolor + global mainheadid nullid nullid2 circleitem circlecolors # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right set listed $cmitlisted($curview,$id) @@ -4849,8 +4848,10 @@ proc drawcmittext {id row col} { set ofill red } elseif {$id eq $nullid2} { set ofill green + } elseif {$id eq $mainheadid} { + set ofill yellow } else { - set ofill [expr {$listed != 0 ? $listed == 2 ? "gray" : "blue" : "white"}] + set ofill [lindex $circlecolors $listed] } set x [xc $row $col] set y [yc $row] @@ -4874,6 +4875,7 @@ proc drawcmittext {id row col} { [expr {$x - $orad}] [expr {$y + $orad - 1}] \ -fill $ofill -outline $fgcolor -width 1 -tags circle] } + set circleitem($row) $t $canv raise $t $canv bind $t <1> {selcanvline {} %x %y} set rmx [llength [lindex $rowidlist $row]] @@ -7399,12 +7401,18 @@ proc domktag {} { } proc redrawtags {id} { - global canv linehtag idpos currentid curview - global canvxmax iddrawn + global canv linehtag idpos currentid curview cmitlisted + global canvxmax iddrawn circleitem mainheadid circlecolors if {![commitinview $id $curview]} return if {![info exists iddrawn($id)]} return set row [rowofcommit $id] + if {$id eq $mainheadid} { + set ofill yellow + } else { + set ofill [lindex $circlecolors $cmitlisted($curview,$id)] + } + $canv itemconf $circleitem($row) -fill $ofill $canv delete tag.$id set xt [eval drawtags $id $idpos($id)] $canv coords $linehtag($row) $xt [lindex $idpos($id) 2] @@ -7574,8 +7582,8 @@ proc cherrypick {} { if {$mainhead ne {}} { movehead $newhead $mainhead movedhead $newhead $mainhead - set mainheadid $newhead } + set mainheadid $newhead redrawtags $oldhead redrawtags $newhead selbyid $newhead @@ -7675,7 +7683,7 @@ proc headmenu {x y id head} { } proc cobranch {} { - global headmenuid headmenuhead mainhead headids + global headmenuid headmenuhead headids global showlocalchanges mainheadid # check the tree is clean first?? @@ -7711,12 +7719,10 @@ proc readcheckoutstat {fd newhead newheadid} { if {[catch {close $fd} err]} { error_popup $err } - set oldmainhead $mainhead + set oldmainid $mainheadid set mainhead $newhead set mainheadid $newheadid - if {[info exists headids($oldmainhead)]} { - redrawtags $headids($oldmainhead) - } + redrawtags $oldmainid redrawtags $newheadid selbyid $newheadid if {$showlocalchanges} { @@ -9016,12 +9022,14 @@ proc rereadrefs {} { [array names idheads] [array names idotherrefs]]] foreach id $refids { set v [listrefs $id] - if {![info exists ref($id)] || $ref($id) != $v || - ($id eq $oldmainhead && $id ne $mainheadid) || - ($id eq $mainheadid && $id ne $oldmainhead)} { + if {![info exists ref($id)] || $ref($id) != $v} { redrawtags $id } } + if {$oldmainhead ne $mainheadid} { + redrawtags $oldmainhead + redrawtags $mainheadid + } run refill_reflist } @@ -9761,6 +9769,8 @@ set diffcontext 3 set ignorespace 0 set selectbgcolor gray85 +set circlecolors {white blue gray blue blue} + ## For msgcat loading, first locate the installation location. if { [info exists ::env(GITK_MSGSDIR)] } { ## Msgsdir was manually set in the environment. diff --git a/sha1_file.c b/sha1_file.c index adcf37c3f6..f311c79e50 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2105,6 +2105,15 @@ int hash_sha1_file(const void *buf, unsigned long len, const char *type, return 0; } +/* Finalize a file on disk, and close it. */ +static void close_sha1_file(int fd) +{ + /* For safe-mode, we could fsync_or_die(fd, "sha1 file") here */ + fchmod(fd, 0444); + if (close(fd) != 0) + die("unable to write sha1 file"); +} + static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, void *buf, unsigned long len, time_t mtime) { @@ -2170,9 +2179,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, if (write_buffer(fd, compressed, size) < 0) die("unable to write sha1 file"); - fchmod(fd, 0444); - if (close(fd)) - die("unable to write sha1 file"); + close_sha1_file(fd); free(compressed); if (mtime) { @@ -2350,9 +2357,7 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer, } while (1); inflateEnd(&stream); - fchmod(local, 0444); - if (close(local) != 0) - die("unable to write sha1 file"); + close_sha1_file(local); SHA1_Final(real_sha1, &c); if (ret != Z_STREAM_END) { unlink(tmpfile); diff --git a/t/.gitattributes b/t/.gitattributes index 562b12e16e..ab6edbf19e 100644 --- a/t/.gitattributes +++ b/t/.gitattributes @@ -1 +1,2 @@ -* -whitespace +t[0-9][0-9][0-9][0-9]-*.sh -whitespace +t[0-9][0-9][0-9][0-9]/* -whitespace diff --git a/t/test-lib.sh b/t/test-lib.sh index 7a8bd27abc..e9c9081edf 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -168,7 +168,7 @@ trap 'die' exit # environment variables to work around this. # # In particular, quoting isn't enough, as the path may contain the same quote -# that we're using. +# that we're using. test_set_editor () { FAKE_EDITOR="$1" export FAKE_EDITOR |