diff options
-rw-r--r-- | Documentation/RelNotes-1.5.3.txt | 101 | ||||
-rw-r--r-- | Documentation/git-remote.txt | 7 | ||||
-rw-r--r-- | Documentation/git-repack.txt | 11 | ||||
-rw-r--r-- | Documentation/git-send-email.txt | 23 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | builtin-log.c | 2 | ||||
-rwxr-xr-x | contrib/completion/git-completion.bash | 3 | ||||
-rw-r--r-- | git-compat-util.h | 16 | ||||
-rwxr-xr-x | git-cvsimport.perl | 2 | ||||
-rw-r--r-- | git-gui/Makefile | 52 | ||||
-rwxr-xr-x | git-gui/git-gui.sh | 16 | ||||
-rw-r--r-- | git-gui/lib/blame.tcl | 12 | ||||
-rwxr-xr-x | git-send-email.perl | 43 | ||||
-rwxr-xr-x | git-tag.sh | 45 | ||||
-rwxr-xr-x | git-verify-tag.sh | 7 | ||||
-rw-r--r-- | git.c | 72 | ||||
-rwxr-xr-x | gitk | 4 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 22 |
18 files changed, 330 insertions, 114 deletions
diff --git a/Documentation/RelNotes-1.5.3.txt b/Documentation/RelNotes-1.5.3.txt index d111661a7b..ef2f95b3c5 100644 --- a/Documentation/RelNotes-1.5.3.txt +++ b/Documentation/RelNotes-1.5.3.txt @@ -1,4 +1,4 @@ -GIT v1.5.3 Release Notes (draft) +GIT v1.5.3 Release Notes ======================== Updates since v1.5.2 @@ -10,8 +10,23 @@ Updates since v1.5.2 * Thee are a handful pack-objects changes to help you cope better with repositories with pathologically large blobs in them. +* For people who need to import from Perforce, a front-end for + fast-import is in contrib/fast-import/ now. + +* Comes with git-gui 0.8.0. + +* Comes with updated gitk. + * New commands and options. + - "git log" learned a new option '--follow', to follow + renaming history of a single file. + + - "git-filter-branch" is a reborn cg-admin-rewritehist. + + - "git-cvsserver" learned new options (--base-path, --export-all, + --strict-paths) inspired by git-daemon. + - "git-submodule" command helps you manage the projects from the superproject that contain them. @@ -36,9 +51,45 @@ Updates since v1.5.2 - "git repack" can be told to split resulting packs to avoid exceeding limit specified with "--max-pack-size". + - "git fsck" gained --verbose option. This is really really + verbose but it might help you identify exact commit that is + corrupt in your repository. + + - "git format-patch" learned --numbered-files option. This + may be useful for MH users. + + - "git tag -n -l" shows tag annotations while listing tags. + + - "git cvsimport" can optionally use the separate-remote layout. + + - "git blame" can be told to see through commits that changes + whitespaces and indentation levels with "-w" option. + + - "git send-email" can be told not to thread the messages when + sending out more than one patches. + + - "git config" learned NUL terminated output format via -z to + help scripts. + * Updated behavior of existing commands. - - "git push" pretends that you immediately fetched back from + - "git mergetool" chooses its backend more wisely, taking + notice of its environment such as use of X, Gnome/KDE, etc. + + - "gitweb" shows merge commits a lot nicer than before. The + default view uses more compact --cc format, while the UI + allows to choose normal diff with any parent. + + - snapshot files "gitweb" creates from a repository at + $path/$project/.git are more useful. We use $project part + in the filename, which we used to discard. + + - "git cvsimort" creates lightweight tag; there is not any + interesting information we can record in an annotated tag, + and the handcrafted ones the old code created was not + properly formed anyway. + + - "git-push" pretends that you immediately fetched back from the remote by updating corresponding remote tracking branches if you have any. @@ -48,17 +99,25 @@ Updates since v1.5.2 - "git-apply --whitespace=strip" removes blank lines added at the end of the file. - - fetch over git native protocols with -v shows connection + - "git-fetch" over git native protocols with -v shows connection status, and the IP address of the other end, to help diagnosing problems. - - core.legacyheaders is no more, although we still can read - objects created in a new loose object format. + - We used to have core.legacyheaders configuration, when + set to false, allowed git to write loose objects in a format + that mimicks the format used by objects stored in packs. It + turns out that this was not so useful. Although we will + continue to read objects written in that format, we do not + honor that configuration anymore and create loose objects in + the legacy/traditional format. + + - "--find-copies-harder" option to diff family can now be + spelled as "-C -C" for brevity. - "git-mailsplit" (hence "git-am") can read from Maildir formatted mailboxes. - - "git cvsserver" does not barf upon seeing "cvs login" + - "git-cvsserver" does not barf upon seeing "cvs login" request. - "pack-objects" honors "delta" attribute set in @@ -68,10 +127,25 @@ Updates since v1.5.2 - new-workdir script (in contrib) can now be used with a bare repository. + - "git-mergetool" learned to use gvimdiff. + + - "gitview" (in contrib) has a better blame interface. + + - "git log" and friends did not handle a commit log message + that is larger than 16kB; they do now. + + - "--pretty=oneline" output format for "git log" and friends + deals with "malformed" commit log messages that have more + than one lines in the first paragraph better. We used to + show the first line, cutting the title at mid-sentence; we + concatenate them into a single line and treat the result as + "oneline". * Builds - - + - old-style function definitions (most notably, a function + without parameter defined with "func()", not "func(void)") + have been eradicated. * Performance Tweaks @@ -88,6 +162,10 @@ Updates since v1.5.2 the object requested the last time, which exploits the locality of references. + - verifying pack contents done by "git fsck --full" got boost + by carefully choosing the order to verify objects in them. + + Fixes since v1.5.2 ------------------ @@ -96,14 +174,11 @@ this release, unless otherwise noted. * Bugfixes - - .... This has not - been backported to 1.5.2.x series, as it is rather an - intrusive change. - + - "gitweb" had trouble handling non UTF-8 text with older + Encode.pm Perl module. -- exec >/var/tmp/1 -O=v1.5.2-45-ged82edc -O=v1.5.2-172-g1a8b769 +O=v1.5.2.2-603-g7c85173 echo O=`git describe refs/heads/master` git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt index ab232c2f68..61a6022ce8 100644 --- a/Documentation/git-remote.txt +++ b/Documentation/git-remote.txt @@ -49,6 +49,9 @@ branch the `HEAD` at the remote repository actually points at. 'show':: Gives some information about the remote <name>. ++ +With `-n` option, the remote heads are not queried first with +`git ls-remote <name>`; cached information is used instead. 'prune':: @@ -56,6 +59,10 @@ Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>". ++ +With `-n` option, the remote heads are not confirmed first with `git +ls-remote <name>`; cached information is used instead. Use with +caution. 'update':: diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt index c33a512ffb..28949397ca 100644 --- a/Documentation/git-repack.txt +++ b/Documentation/git-repack.txt @@ -14,7 +14,8 @@ DESCRIPTION ----------- This script is used to combine all objects that do not currently -reside in a "pack", into a pack. +reside in a "pack", into a pack. It can also be used to re-organise +existing packs into a single, more efficient pack. A pack is a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an @@ -28,11 +29,13 @@ OPTIONS -a:: Instead of incrementally packing the unpacked objects, - pack everything available into a single pack. + pack everything referenced into a single pack. Especially useful when packing a repository that is used for private development and there is no need to worry - about people fetching via dumb file transfer protocols - from it. Use with '-d'. + about people fetching via dumb protocols from it. Use + with '-d'. This will clean up the objects that `git prune` + leaves behind, but `git fsck --full` shows as + dangling. -d:: After packing, if the newly created packs make some diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 946bd76afc..293686c31f 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -59,9 +59,11 @@ The --cc option must be repeated for each user you want on the cc list. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---no-signed-off-by-cc:: - Do not add emails found in Signed-off-by: or Cc: lines to 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; + if that is unspecified, default to --signed-off-by-cc. --quiet:: Make git-send-email less verbose. One line per email should be @@ -82,9 +84,18 @@ The --cc option must be repeated for each user you want on the cc list. Only necessary if --compose is also set. If --compose is not set, this will be prompted for. ---suppress-from:: - Do not add the From: address to the cc: list, if it shows up in a From: - line. +--suppress-from, --no-suppress-from:: + 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. + +--thread, --no-thread:: + If this is set, the In-Reply-To header will be set on each email sent. + If disabled with "--no-thread", no emails will have the In-Reply-To + header set. + Default is the value of the 'sendemail.thread' configuration value; + if that is unspecified, default to --thread. --dry-run:: Do everything except actually send the emails. @@ -94,9 +94,9 @@ all:: # Define OLD_ICONV if your library has an old iconv(), where the second # (input buffer pointer) parameter is declared with type (const char **). # -# Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that -# tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib" -# is used instead. +# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib" +# that tells runtime paths to dynamic libraries; +# "-Wl,-rpath=/path/lib" is used instead. # # Define USE_NSEC below if you want git to care about sub-second file mtimes # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and diff --git a/builtin-log.c b/builtin-log.c index 073a2a16a3..a4186eac8e 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -589,7 +589,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) get_patch_ids(&rev, &ids, prefix); if (!use_stdout) - realstdout = fdopen(dup(1), "w"); + realstdout = xfdopen(xdup(1), "w"); prepare_revision_walk(&rev); while ((commit = get_revision(&rev)) != NULL) { diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c7c9963347..f2b10fa5f6 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -682,6 +682,9 @@ _git_push () esac __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}" ;; + +*) + __gitcomp "$(__git_refs)" + "${cur#+}" + ;; *) __gitcomp "$(__git_refs)" ;; diff --git a/git-compat-util.h b/git-compat-util.h index b2ab3f8256..362e040f52 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -287,6 +287,22 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len) } } +static inline int xdup(int fd) +{ + int ret = dup(fd); + if (ret < 0) + die("dup failed: %s", strerror(errno)); + return ret; +} + +static inline FILE *xfdopen(int fd, const char *mode) +{ + FILE *stream = fdopen(fd, mode); + if (stream == NULL) + die("Out of memory? fdopen failed: %s", strerror(errno)); + return stream; +} + static inline size_t xsize_t(off_t len) { return (size_t)len; diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 69ccb88dde..ba23eb8eeb 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -1007,7 +1007,7 @@ if ($orig_branch) { if ($opt_r && $opt_o ne 'HEAD'); system('git-update-ref', 'HEAD', "$orig_branch"); unless ($opt_i) { - system('git checkout'); + system('git checkout -f'); die "checkout failed: $?\n" if $?; } } diff --git a/git-gui/Makefile b/git-gui/Makefile index 3de0de1a23..1bac6fed46 100644 --- a/git-gui/Makefile +++ b/git-gui/Makefile @@ -7,6 +7,8 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE +uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') + SCRIPT_SH = git-gui.sh GITGUI_BUILT_INS = git-citool ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH)) @@ -29,11 +31,35 @@ ifndef INSTALL INSTALL = install endif +INSTALL_D0 = $(INSTALL) -d -m755 # space is required here +INSTALL_D1 = +INSTALL_R0 = $(INSTALL) -m644 # space is required here +INSTALL_R1 = +INSTALL_X0 = $(INSTALL) -m755 # space is required here +INSTALL_X1 = +INSTALL_L0 = rm -f # space is required here +INSTALL_L1 = && ln # space is required here +INSTALL_L2 = +INSTALL_L3 = + ifndef V - QUIET_GEN = @echo ' ' GEN $@; - QUIET_BUILT_IN = @echo ' ' BUILTIN $@; - QUIET_INDEX = @echo ' ' INDEX $(dir $@); + QUIET = @ + QUIET_GEN = $(QUIET)echo ' ' GEN $@ && + QUIET_BUILT_IN = $(QUIET)echo ' ' BUILTIN $@ && + QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) && QUIET_2DEVNULL = 2>/dev/null + + INSTALL_D0 = dir= + INSTALL_D1 = && echo ' ' DEST $$dir && $(INSTALL) -d -m755 "$$dir" + INSTALL_R0 = src= + INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m644 $$src + INSTALL_X0 = src= + INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m755 $$src + + INSTALL_L0 = dst= + INSTALL_L1 = && src= + INSTALL_L2 = && dst= + INSTALL_L3 = && echo ' ' 'LINK ' `basename "$$dst"` '->' `basename "$$src"` && rm -f "$$dst" && ln "$$src" "$$dst" endif TCL_PATH ?= tclsh @@ -58,11 +84,15 @@ exedir_SQ = $(subst ','\'',$(exedir)) $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(QUIET_GEN)rm -f $@ $@+ && \ + GITGUI_RELATIVE= && \ if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \ - GITGUI_RELATIVE=1; \ + if test "$(uname_O)" = Cygwin; \ + then GITGUI_RELATIVE= ; \ + else GITGUI_RELATIVE=1; \ + fi; \ fi && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ + -e 's|^ exec wish "$$0"| exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ -e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \ -e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \ @@ -109,12 +139,12 @@ GIT-GUI-VARS: .FORCE-GIT-GUI-VARS all:: $(ALL_PROGRAMS) lib/tclIndex install: all - $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' - $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)' - $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;) - $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(libdir_SQ)' - $(INSTALL) -m644 lib/tclIndex '$(DESTDIR_SQ)$(libdir_SQ)' - $(foreach p,$(ALL_LIBFILES), $(INSTALL) -m644 $p '$(DESTDIR_SQ)$(libdir_SQ)' ;) + $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1) + $(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)' + $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true + $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1) + $(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' + $(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true dist-version: @mkdir -p $(TARDIR) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 3237f3d596..9df2e47029 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -1,6 +1,12 @@ #!/bin/sh # Tcl ignores the next line -*- tcl -*- \ -exec wish "$0" -- "$@" + if test "z$*" = zversion \ + || test "z$*" = z--version; \ + then \ + echo 'git-gui version @@GITGUI_VERSION@@'; \ + exit; \ + fi; \ + exec wish "$0" -- "$@" set appvers {@@GITGUI_VERSION@@} set copyright { @@ -302,11 +308,6 @@ proc tk_optionMenu {w varName args} { ## ## version check -if {{--version} eq $argv || {version} eq $argv} { - puts "git-gui version $appvers" - exit -} - set req_maj 1 set req_min 5 @@ -1580,8 +1581,7 @@ if {[is_MacOSX]} { # -- Tools Menu # - if {[file exists /usr/local/miga/lib/gui-miga] - && [file exists .pvcsrc]} { + if {[is_Cygwin] && [file exists /usr/local/miga/lib/gui-miga]} { proc do_miga {} { global ui_status_value if {![lock_index update]} return diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl index 139171d39e..b523654815 100644 --- a/git-gui/lib/blame.tcl +++ b/git-gui/lib/blame.tcl @@ -272,6 +272,8 @@ constructor new {i_commit i_path} { set cursorW %W tk_popup $w.ctxm %X %Y " + bind $i <Shift-Tab> "[list focus $w_cviewer];break" + bind $i <Tab> "[list focus $w_cviewer];break" } foreach i [concat $w_columns $w_cviewer] { @@ -287,8 +289,10 @@ constructor new {i_commit i_path} { bind $i <Control-Key-f> {catch {%W yview scroll 1 pages};break} } + bind $w_cviewer <Shift-Tab> "[list focus $w_file];break" + bind $w_cviewer <Tab> "[list focus $w_file];break" bind $w_cviewer <Button-1> [list focus $w_cviewer] - bind $top <Visibility> [list focus $top] + bind $w_file <Visibility> [list focus $w_file] grid configure $w.header -sticky ew grid configure $w.file_pane -sticky nsew @@ -483,7 +487,11 @@ method _read_file {fd jump} { } ifdeleted { catch {close $fd} } method _exec_blame {cur_w cur_d options cur_s} { - set cmd [list nice git blame] + set cmd [list] + if {![is_Windows] || [is_Cygwin]} { + lappend cmd nice + } + lappend cmd git blame set cmd [concat $cmd $options] lappend cmd --incremental if {$commit eq {}} { diff --git a/git-send-email.perl b/git-send-email.perl index 9f75551673..87f59fa313 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -64,15 +64,17 @@ Options: email sent, rather than to the first email sent. Defaults to on. - --no-signed-off-cc Suppress the automatic addition of email addresses - that appear in Signed-off-by: or Cc: lines to the cc: - list. Note: Using this option is not recommended. + --signed-off-cc Automatically add email addresses that appear in + Signed-off-by: or Cc: lines to the cc: list. Defaults to on. --smtp-server If set, specifies the outgoing SMTP server to use. Defaults to localhost. --suppress-from Suppress sending emails to yourself if your address - appears in a From: line. + appears in a From: line. Defaults to off. + + --thread Specify that the "In-Reply-To:" header should be set on all + emails. Defaults to on. --quiet Make git-send-email less verbose. One line per email should be all that is output. @@ -137,9 +139,6 @@ my $compose_filename = ".msg.$$"; my (@to,@cc,@initial_cc,@bcclist,@xh, $initial_reply_to,$initial_subject,@files,$from,$compose,$time); -# Behavior modification variables -my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc, - $dry_run) = (1, 0, 0, 0, 0); my $smtp_server; my $envelope_sender; @@ -154,9 +153,22 @@ if ($@) { $term = new FakeTerm "$@: going non-interactive"; } -my $def_chain = $repo->config_bool('sendemail.chainreplyto'); -if (defined $def_chain and not $def_chain) { - $chain_reply_to = 0; +# Behavior modification variables +my ($quiet, $dry_run) = (0, 0); + +# Variables with corresponding config settings +my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc); + +my %config_settings = ( + "thread" => [\$thread, 1], + "chainreplyto" => [\$chain_reply_to, 1], + "suppressfrom" => [\$suppress_from, 0], + "signedoffcc" => [\$signed_off_cc, 1], +); + +foreach my $setting (keys %config_settings) { + my $config = $repo->config_bool("sendemail.$setting"); + ${$config_settings{$setting}->[0]} = (defined $config) ? $config : $config_settings{$setting}->[1]; } @bcclist = $repo->config('sendemail.bcc'); @@ -177,10 +189,11 @@ my $rc = GetOptions("from=s" => \$from, "smtp-server=s" => \$smtp_server, "compose" => \$compose, "quiet" => \$quiet, - "suppress-from" => \$suppress_from, - "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc, + "suppress-from!" => \$suppress_from, + "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc, "dry-run" => \$dry_run, "envelope-sender=s" => \$envelope_sender, + "thread!" => \$thread, ); unless ($rc) { @@ -287,7 +300,7 @@ if (!defined $initial_subject && $compose) { $prompting++; } -if (!defined $initial_reply_to && $prompting) { +if ($thread && !defined $initial_reply_to && $prompting) { do { $_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ", $initial_reply_to); @@ -484,7 +497,7 @@ Date: $date Message-Id: $message_id X-Mailer: git-send-email $gitversion "; - if ($reply_to) { + if ($thread && $reply_to) { $header .= "In-Reply-To: $reply_to\n"; $header .= "References: $references\n"; @@ -609,7 +622,7 @@ foreach my $t (@files) { } } else { $message .= $_; - if (/^(Signed-off-by|Cc): (.*)$/i && !$no_signed_off_cc) { + if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) { my $c = $2; chomp $c; push @cc, $c; diff --git a/git-tag.sh b/git-tag.sh index c84043902f..1ff5b41e7f 100755 --- a/git-tag.sh +++ b/git-tag.sh @@ -19,28 +19,40 @@ do case "$1" in -a) annotate=1 + shift ;; -s) annotate=1 signed=1 + shift ;; -f) force=1 + shift ;; -n) - case $2 in - -*) LINES=1 # no argument + case "$#,$2" in + 1,* | *,-*) + LINES=1 # no argument ;; *) shift LINES=$(expr "$1" : '\([0-9]*\)') [ -z "$LINES" ] && LINES=1 # 1 line is default when -n is used ;; esac + shift ;; -l) list=1 shift - PATTERN="$1" # select tags by shell pattern, not re + case $# in + 0) PATTERN= + ;; + *) + PATTERN="$1" # select tags by shell pattern, not re + shift + ;; + esac git rev-parse --symbolic --tags | sort | while read TAG do @@ -51,12 +63,16 @@ do [ "$LINES" -le 0 ] && { echo "$TAG"; continue ;} OBJTYPE=$(git cat-file -t "$TAG") case $OBJTYPE in - tag) ANNOTATION=$(git cat-file tag "$TAG" | - sed -e '1,/^$/d' \ - -e '/^-----BEGIN PGP SIGNATURE-----$/Q' ) - printf "%-15s %s\n" "$TAG" "$ANNOTATION" | - sed -e '2,$s/^/ /' \ - -e "${LINES}q" + tag) + ANNOTATION=$(git cat-file tag "$TAG" | + sed -e '1,/^$/d' | + sed -n -e " + /^-----BEGIN PGP SIGNATURE-----\$/q + 2,\$s/^/ / + p + ${LINES}q + ") + printf "%-15s %s\n" "$TAG" "$ANNOTATION" ;; *) echo "$TAG" ;; @@ -70,7 +86,9 @@ do if test "$#" = "0"; then die "error: option -m needs an argument" else + message="$1" message_given=1 + shift fi ;; -F) @@ -81,13 +99,19 @@ do else message="$(cat "$1")" message_given=1 + shift fi ;; -u) annotate=1 signed=1 shift - username="$1" + if test "$#" = "0"; then + die "error: option -u needs an argument" + else + username="$1" + shift + fi ;; -d) shift @@ -122,7 +146,6 @@ do break ;; esac - shift done [ -n "$list" ] && exit 0 diff --git a/git-verify-tag.sh b/git-verify-tag.sh index f2d5597dba..68858b694d 100755 --- a/git-verify-tag.sh +++ b/git-verify-tag.sh @@ -37,8 +37,9 @@ esac trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0 git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1 - -cat "$GIT_DIR/.tmp-vtag" | -sed '/-----BEGIN PGP/Q' | +sed -n -e ' + /^-----BEGIN PGP SIGNATURE-----$/q + p +' <"$GIT_DIR/.tmp-vtag" | gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1 rm -f "$GIT_DIR/.tmp-vtag" @@ -216,14 +216,54 @@ const char git_version_string[] = GIT_VERSION; */ #define NOT_BARE (1<<2) -static void handle_internal_command(int argc, const char **argv, char **envp) +struct cmd_struct { + const char *cmd; + int (*fn)(int, const char **, const char *); + int option; +}; + +static int run_command(struct cmd_struct *p, int argc, const char **argv) +{ + int status; + struct stat st; + const char *prefix; + + prefix = NULL; + if (p->option & RUN_SETUP) + prefix = setup_git_directory(); + if (p->option & USE_PAGER) + setup_pager(); + if (p->option & NOT_BARE) { + if (is_bare_repository() || is_inside_git_dir()) + die("%s must be run in a work tree", p->cmd); + } + trace_argv_printf(argv, argc, "trace: built-in: git"); + + status = p->fn(argc, argv, prefix); + if (status) + return status; + + /* Somebody closed stdout? */ + if (fstat(fileno(stdout), &st)) + return 0; + /* Ignore write errors for pipes and sockets.. */ + if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) + return 0; + + /* Check for ENOSPC and EIO errors.. */ + if (fflush(stdout)) + die("write failure on standard output: %s", strerror(errno)); + if (ferror(stdout)) + die("unknown write failure on standard output"); + if (fclose(stdout)) + die("close failed on standard output: %s", strerror(errno)); + return 0; +} + +static void handle_internal_command(int argc, const char **argv) { const char *cmd = argv[0]; - static struct cmd_struct { - const char *cmd; - int (*fn)(int, const char **, const char *); - int option; - } commands[] = { + static struct cmd_struct commands[] = { { "add", cmd_add, RUN_SETUP | NOT_BARE }, { "annotate", cmd_annotate, RUN_SETUP | USE_PAGER }, { "apply", cmd_apply }, @@ -307,25 +347,13 @@ static void handle_internal_command(int argc, const char **argv, char **envp) for (i = 0; i < ARRAY_SIZE(commands); i++) { struct cmd_struct *p = commands+i; - const char *prefix; if (strcmp(p->cmd, cmd)) continue; - - prefix = NULL; - if (p->option & RUN_SETUP) - prefix = setup_git_directory(); - if (p->option & USE_PAGER) - setup_pager(); - if ((p->option & NOT_BARE) && - (is_bare_repository() || is_inside_git_dir())) - die("%s must be run in a work tree", cmd); - trace_argv_printf(argv, argc, "trace: built-in: git"); - - exit(p->fn(argc, argv, prefix)); + exit(run_command(p, argc, argv)); } } -int main(int argc, const char **argv, char **envp) +int main(int argc, const char **argv) { const char *cmd = argv[0] ? argv[0] : "git-help"; char *slash = strrchr(cmd, '/'); @@ -358,7 +386,7 @@ int main(int argc, const char **argv, char **envp) if (!prefixcmp(cmd, "git-")) { cmd += 4; argv[0] = cmd; - handle_internal_command(argc, argv, envp); + handle_internal_command(argc, argv); die("cannot handle %s internally", cmd); } @@ -390,7 +418,7 @@ int main(int argc, const char **argv, char **envp) while (1) { /* See if it's an internal command */ - handle_internal_command(argc, argv, envp); + handle_internal_command(argc, argv); /* .. then try the external ones */ execv_git_cmd(argv); @@ -6972,7 +6972,7 @@ proc doprefs {} { pack $top.ntag.b $top.ntag.l -side left grid x $top.ntag -sticky w label $top.tabstopl -text "tabstop" -font optionfont - entry $top.tabstop -width 10 -textvariable tabstop + spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop grid x $top.tabstopl $top.tabstop -sticky w label $top.cdisp -text "Colors: press to choose" @@ -7004,7 +7004,7 @@ proc doprefs {} { grid x $top.hunksepbut $top.hunksep -sticky w label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor button $top.selbgbut -text "Select bg" -font optionfont \ - -command [list choosecolor selectbgcolor 0 $top.bg background setselbg] + -command [list choosecolor selectbgcolor 0 $top.selbgsep background setselbg] grid x $top.selbgbut $top.selbgsep -sticky w frame $top.buts diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 7a77bef4c0..27486de4de 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -529,25 +529,23 @@ cat > .git/config <<\EOF EOF cat > expect <<\EOF -Key: section.sub=section.val1 -Value: foo=bar -Key: section.sub=section.val2 -Value: foo -bar -Key: section.sub=section.val3 -Value: +section.sub=section.val1 +foo=barQsection.sub=section.val2 +foo +barQsection.sub=section.val3 -Key: section.sub=section.val4 -Value: -Key: section.sub=section.val5 +Qsection.sub=section.val4 +Qsection.sub=section.val5Q EOF -git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result +git config --null --list | tr '[\000]' 'Q' > result +echo >>result test_expect_success '--null --list' 'cmp result expect' -git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result +git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result +echo >>result test_expect_success '--null --get-regexp' 'cmp result expect' |