Merge branch 'maint' of git://repo.or.cz/alt-git

This commit is contained in:
Johannes Sixt
2007-06-25 15:35:36 +02:00
46 changed files with 1173 additions and 306 deletions

2
.gitignore vendored
View File

@@ -156,7 +156,7 @@ common-cmds.h
*.tar.gz
*.dsc
*.deb
git-core.spec
git.spec
*.exe
*.[ao]
*.py[co]

View File

@@ -37,6 +37,9 @@ man7dir=$(mandir)/man7
ASCIIDOC=asciidoc
ASCIIDOC_EXTRA =
ifdef ASCIIDOC8
ASCIIDOC_EXTRA += -a asciidoc7compatible
endif
INSTALL?=install
DOC_REF = origin/man

View File

@@ -0,0 +1,61 @@
GIT v1.5.2.2 Release Notes
==========================
Fixes since v1.5.2.1
--------------------
* Usability fix
- git-gui is shipped with its updated blame interface. It is
rumored that the older one was not just unusable but was
active health hazard, but this one is actually pretty.
Please see for yourself.
* Bugfixes
- "git checkout fubar" was utterly confused when there is a
branch fubar and a tag fubar at the same time. It correctly
checks out the branch fubar now.
- "git clone /path/foo" to clone a local /path/foo.git
repository left an incorrect configuration.
- "git send-email" correctly unquotes RFC 2047 quoted names in
the patch-email before using their values.
- We did not accept number of seconds since epoch older than
year 2000 as a valid timestamp. We now interpret positive
integers more than 8 digits as such, which allows us to
express timestamps more recent than March 1973.
- git-cvsimport did not work when you have GIT_DIR to point
your repository at a nonstandard location.
- Some systems (notably, Solaris) lack hstrerror() to make
h_errno human readable; prepare a replacement
implementation.
- .gitignore file listed git-core.spec but what we generate is
git.spec, and nobody noticed for a long time.
- "git-merge-recursive" does not try to run file level merge
on binary files.
- "git-branch --track" did not create tracking configuration
correctly when the branch name had slash in it.
- The email address of the user specified with user.email
configuration was overriden by EMAIL environment variable.
- The tree parser did not warn about tree entries with
nonsense file modes, and assumed they must be blobs.
- "git log -z" without any other request to generate diff still
invoked the diff machinery, wasting cycles.
* Documentation
- Many updates to fix stale or missing documentation.
- Although our documentation was primarily meant to be formatted
with AsciiDoc7, formatting with AsciiDoc8 is supported better.

View File

@@ -8,7 +8,8 @@
# the command.
[attributes]
caret=^
plus=+
caret=^
startsb=[
endsb=]
tilde=~

View File

@@ -3,7 +3,7 @@ git-archive(1)
NAME
----
git-archive - Creates an archive of files from a named tree
git-archive - Create an archive of files from a named tree
SYNOPSIS

View File

@@ -53,6 +53,9 @@ OPTIONS
<head>::
Working branch; defaults to HEAD.
<limit>::
Do not report commits up to (and including) limit.
Author
------
Written by Junio C Hamano <junkio@cox.net>

View File

@@ -3,7 +3,7 @@ git-clone(1)
NAME
----
git-clone - Clones a repository into a new directory
git-clone - Clone a repository into a new directory
SYNOPSIS

View File

@@ -73,7 +73,7 @@ $ git-cvsexportcommit -v <commit-sha1>
$ cvs commit -F .mgs <files>
------------
Merge pending patches into CVS automatically -- only if you really know what you are doing ::
Merge pending patches into CVS automatically -- only if you really know what you are doing::
+
------------
$ export GIT_DIR=~/project/.git

View File

@@ -3,7 +3,7 @@ git-prune(1)
NAME
----
git-prune - Prunes all unreachable objects from the object database
git-prune - Prune all unreachable objects from the object database
SYNOPSIS

View File

@@ -27,8 +27,8 @@ new packs and replace existing ones.
OPTIONS
-------
-n::
Only list the objects that would be unpacked, don't actually unpack
them.
Dry run. Check the pack file without actually unpacking
the objects.
-q::
The command usually shows percentage progress. This

View File

@@ -132,8 +132,8 @@ and newly modified files, and in both cases it takes a snapshot of the
given files and stages that content in the index, ready for inclusion in
the next commit.
Viewing the changelog
---------------------
Viewing project history
-----------------------
At any point you can view the history of your changes using

View File

@@ -27,7 +27,7 @@ $ man git-clone
See also <<git-quick-start>> for a brief overview of git commands,
without any explanation.
Also, see <<todo>> for ways that you can help make this manual more
Finally, see <<todo>> for ways that you can help make this manual more
complete.
@@ -921,6 +921,7 @@ echo "git diff --stat --summary -M v$last v$new > ../diffstat-$new"
and then he just cut-and-pastes the output commands after verifying that
they look OK.
[[Finding-comments-with-given-content]]
Finding commits referencing a file with given content
-----------------------------------------------------
@@ -1682,7 +1683,7 @@ automatically set the default remote branch to pull from at the time
that a branch is created:
-------------------------------------------------
$ git checkout --track -b origin/maint maint
$ git checkout --track -b maint origin/maint
-------------------------------------------------
In addition to saving you keystrokes, "git pull" also helps you by
@@ -2756,8 +2757,8 @@ As a result, the general consistency of an object can always be tested
independently of the contents or the type of the object: all objects can
be validated by verifying that (a) their hashes match the content of the
file and (b) the object successfully inflates to a stream of bytes that
forms a sequence of <ascii type without space> + <space> + <ascii decimal
size> + <byte\0> + <binary object data>.
forms a sequence of <ascii type without space> {plus} <space> {plus} <ascii decimal
size> {plus} <byte\0> {plus} <binary object data>.
The structured objects can further have their structure and
connectivity to other objects verified. This is generally done with
@@ -3669,11 +3670,11 @@ itself!
include::glossary.txt[]
[[git-quick-start]]
Appendix A: Git Quick Start
===========================
Appendix A: Git Quick Reference
===============================
This is a quick summary of the major commands; the following chapters
will explain how these work in more detail.
This is a quick summary of the major commands; the previous chapters
explain how these work in more detail.
[[quick-creating-a-new-repository]]
Creating a new repository
@@ -3951,3 +3952,7 @@ CVS, Subversion, and just imports of series of release tarballs.
More details on gitweb?
Write a chapter on using plumbing and writing scripts.
Alternates, clone -reference, etc.
git unpack-objects -r for recovery

View File

@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v1.5.2.1.GIT
DEF_VER=v1.5.2.2.GIT
LF='
'

View File

@@ -107,6 +107,8 @@ all:
# Define USE_STDEV below if you want git to care about the underlying device
# change being considered an inode change from the update-cache perspective.
#
# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
#
# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
# MakeMaker (e.g. using ActiveState under Cygwin).
#
@@ -410,6 +412,7 @@ ifeq ($(uname_S),SunOS)
NEEDS_NSL = YesPlease
SHELL_PATH = /bin/bash
NO_STRCASESTR = YesPlease
NO_HSTRERROR = YesPlease
ifeq ($(uname_R),5.8)
NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease
@@ -683,6 +686,10 @@ endif
ifdef NO_PERL_MAKEMAKER
export NO_PERL_MAKEMAKER
endif
ifdef NO_HSTRERROR
COMPAT_CFLAGS += -DNO_HSTRERROR
COMPAT_OBJS += compat/hstrerror.o
endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
@@ -713,6 +720,10 @@ ifndef V
endif
endif
ifdef ASCIIDOC8
export ASCIIDOC8
endif
# Shell quote (do not use $(call) to accommodate ancient setups);
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))

View File

@@ -1 +1 @@
Documentation/RelNotes-1.5.2.1.txt
Documentation/RelNotes-1.5.2.2.txt

View File

@@ -317,8 +317,6 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev)
static char *config_repo;
static char *config_remote;
static const char *start_ref;
static int start_len;
static int base_len;
static int get_remote_branch_name(const char *value)
{
@@ -334,26 +332,41 @@ static int get_remote_branch_name(const char *value)
end = value + strlen(value);
/* Try an exact match first. */
/*
* Try an exact match first. I.e. handle the case where the
* value is "$anything:refs/foo/bar/baz" and start_ref is exactly
* "refs/foo/bar/baz". Then the name at the remote is $anything.
*/
if (!strcmp(colon + 1, start_ref)) {
/* Truncate the value before the colon. */
/* Truncate the value before the colon. */
nfasprintf(&config_repo, "%.*s", colon - value, value);
return 1;
}
/* Try with a wildcard match now. */
if (end - value > 2 && end[-2] == '/' && end[-1] == '*' &&
colon - value > 2 && colon[-2] == '/' && colon[-1] == '*' &&
(end - 2) - (colon + 1) == base_len &&
!strncmp(colon + 1, start_ref, base_len)) {
/* Replace the star with the remote branch name. */
nfasprintf(&config_repo, "%.*s%s",
(colon - 2) - value, value,
start_ref + base_len);
return 1;
}
/*
* Is this a wildcard match?
*/
if ((end - 2 <= value) || end[-2] != '/' || end[-1] != '*' ||
(colon - 2 <= value) || colon[-2] != '/' || colon[-1] != '*')
return 0;
return 0;
/*
* Value is "refs/foo/bar/<asterisk>:refs/baz/boa/<asterisk>"
* and start_ref begins with "refs/baz/boa/"; the name at the
* remote is refs/foo/bar/ with the remaining part of the
* start_ref. The length of the prefix on the RHS is (end -
* colon - 2), including the slash immediately before the
* asterisk.
*/
if ((strlen(start_ref) < end - colon - 2) ||
memcmp(start_ref, colon + 1, end - colon - 2))
return 0; /* does not match prefix */
/* Replace the asterisk with the remote branch name. */
nfasprintf(&config_repo, "%.*s%s",
(colon - 1) - value, value,
start_ref + (end - colon - 2));
return 1;
}
static int get_remote_config(const char *key, const char *value)
@@ -363,10 +376,12 @@ static int get_remote_config(const char *key, const char *value)
return 0;
var = strrchr(key, '.');
if (var == key + 6)
if (var == key + 6 || strcmp(var, ".fetch"))
return 0;
if (!strcmp(var, ".fetch") && get_remote_branch_name(value))
/*
* Ok, we are looking at key == "remote.$foo.fetch";
*/
if (get_remote_branch_name(value))
nfasprintf(&config_remote, "%.*s", var - (key + 7), key + 7);
return 0;
@@ -392,14 +407,14 @@ static void set_branch_merge(const char *name, const char *config_remote,
static void set_branch_defaults(const char *name, const char *real_ref)
{
const char *slash = strrchr(real_ref, '/');
if (!slash)
return;
/*
* name is the name of new branch under refs/heads;
* real_ref is typically refs/remotes/$foo/$bar, where
* $foo is the remote name (there typically are no slashes)
* and $bar is the branch name we map from the remote
* (it could have slashes).
*/
start_ref = real_ref;
start_len = strlen(real_ref);
base_len = slash - real_ref;
git_config(get_remote_config);
if (!config_repo && !config_remote &&
!prefixcmp(real_ref, "refs/heads/")) {

21
compat/hstrerror.c Normal file
View File

@@ -0,0 +1,21 @@
#include <string.h>
#include <stdio.h>
#include <netdb.h>
const char *githstrerror(int err)
{
static char buffer[48];
switch (err)
{
case HOST_NOT_FOUND:
return "Authoritative answer: host not found";
case NO_DATA:
return "Valid name, no data record of requested type";
case NO_RECOVERY:
return "Non recoverable errors, FORMERR, REFUSED, NOTIMP";
case TRY_AGAIN:
return "Non-authoritative \"host not found\", or SERVERFAIL";
}
sprintf(buffer, "Name resolution error %d", err);
return buffer;
}

6
date.c
View File

@@ -414,9 +414,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
num = strtoul(date, &end, 10);
/*
* Seconds since 1970? We trigger on that for anything after Jan 1, 2000
* Seconds since 1970? We trigger on that for any numbers with
* more than 8 digits. This is because we don't want to rule out
* numbers like 20070606 as a YYYYMMDD date.
*/
if (num > 946684800) {
if (num >= 100000000) {
time_t time = num;
if (gmtime_r(&time, tm)) {
*tm_gmt = 1;

7
diff.c
View File

@@ -1108,10 +1108,8 @@ static void setup_diff_attr_check(struct git_attr_check *check)
check->attr = attr_diff;
}
#define FIRST_FEW_BYTES 8000
static int file_is_binary(struct diff_filespec *one)
{
unsigned long sz;
struct git_attr_check attr_diff_check;
setup_diff_attr_check(&attr_diff_check);
@@ -1128,10 +1126,7 @@ static int file_is_binary(struct diff_filespec *one)
return 0;
diff_populate_filespec(one, 0);
}
sz = one->size;
if (FIRST_FEW_BYTES < sz)
sz = FIRST_FEW_BYTES;
return !!memchr(one->data, 0, sz);
return buffer_is_binary(one->data, one->size);
}
static void builtin_diff(const char *name_a,

View File

@@ -63,12 +63,13 @@ while [ "$#" != "0" ]; do
echo "unknown flag $arg"
exit 1
fi
new="$rev"
new_name="$arg"
if git-show-ref --verify --quiet -- "refs/heads/$arg"
then
rev=$(git-rev-parse --verify "refs/heads/$arg^0")
branch="$arg"
fi
new="$rev"
elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)
then
# checking out selected paths from a tree-ish.

2
git-clone.sh Executable file → Normal file
View File

@@ -20,7 +20,7 @@ usage() {
get_repo_base() {
(
cd "`/bin/pwd -W`" &&
cd "$1" &&
cd "$1" || cd "$1.git" &&
{
cd .git
pwd -W

View File

@@ -178,6 +178,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
extern uintmax_t gitstrtoumax(const char *, char **, int);
#endif
#ifdef NO_HSTRERROR
#define hstrerror githstrerror
extern const char *githstrerror(int herror);
#endif
extern void release_pack_memory(size_t, int);
static inline char* xstrdup(const char *str)

View File

@@ -692,8 +692,8 @@ sub commit {
if ($branch eq $opt_o && !$index{branch} && !get_headref($branch, $git_dir)) {
# looks like an initial commit
# use the index primed by git-init
$ENV{GIT_INDEX_FILE} = '.git/index';
$index{$branch} = '.git/index';
$ENV{GIT_INDEX_FILE} = "$git_dir/index";
$index{$branch} = "$git_dir/index";
} else {
# use an index per branch to speed up
# imports of projects with many branches
@@ -984,7 +984,7 @@ if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
}
foreach my $git_index (values %index) {
if ($git_index ne '.git/index') {
if ($git_index ne "$git_dir/index") {
unlink($git_index);
}
}

View File

@@ -78,5 +78,3 @@ test "$VN" = "$VC" || {
echo >&2 "GITGUI_VERSION = $VN"
echo "GITGUI_VERSION = $VN" >$GVF
}

View File

@@ -20,6 +20,22 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
######################################################################
##
## Tcl/Tk sanity check
if {[catch {package require Tcl 8.4} err]
|| [catch {package require Tk 8.4} err]
} {
catch {wm withdraw .}
tk_messageBox \
-icon error \
-type ok \
-title "git-gui: fatal error" \
-message $err
exit 1
}
######################################################################
##
## configure our library
@@ -455,7 +471,8 @@ proc rescan {after {honor_trustmtime 1}} {
if {![$ui_comm edit modified]
|| [string trim [$ui_comm get 0.0 end]] eq {}} {
if {[load_message GITGUI_MSG]} {
if {[string match amend* $commit_type]} {
} elseif {[load_message GITGUI_MSG]} {
} elseif {[load_message MERGE_MSG]} {
} elseif {[load_message SQUASH_MSG]} {
}
@@ -1008,6 +1025,7 @@ proc incr_font_size {font {amt 1}} {
incr sz $amt
font configure $font -size $sz
font configure ${font}bold -size $sz
font configure ${font}italic -size $sz
}
######################################################################
@@ -1200,12 +1218,14 @@ catch {
destroy .dummy
}
font create font_uiitalic
font create font_uibold
font create font_diffbold
font create font_diffitalic
foreach class {Button Checkbutton Entry Label
Labelframe Listbox Menu Message
Radiobutton Text} {
Radiobutton Spinbox Text} {
option add *$class.font font_ui
}
unset class
@@ -1233,8 +1253,10 @@ proc apply_config {} {
}
foreach {cn cv} [font configure $font] {
font configure ${font}bold $cn $cv
font configure ${font}italic $cn $cv
}
font configure ${font}bold -weight bold
font configure ${font}italic -slant italic
}
}
@@ -1600,7 +1622,7 @@ unset browser doc_path doc_url
# -- Standard bindings
#
bind . <Destroy> do_quit
wm protocol . WM_DELETE_WINDOW do_quit
bind all <$M1B-Key-q> do_quit
bind all <$M1B-Key-Q> do_quit
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
@@ -1715,7 +1737,7 @@ pack .vpane -anchor n -side top -fill both -expand 1
#
frame .vpane.files.index -height 100 -width 200
label .vpane.files.index.title -text {Staged Changes (Will Be Committed)} \
-background green
-background lightgreen
text $ui_index -background white -borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -1735,7 +1757,7 @@ pack $ui_index -side left -fill both -expand 1
#
frame .vpane.files.workdir -height 100 -width 200
label .vpane.files.workdir.title -text {Unstaged Changes (Will Not Be Committed)} \
-background red
-background lightsalmon
text $ui_workdir -background white -borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -1752,10 +1774,8 @@ pack $ui_workdir -side left -fill both -expand 1
.vpane.files add .vpane.files.workdir -sticky nsew
foreach i [list $ui_index $ui_workdir] {
$i tag conf in_diff -font font_uibold
$i tag conf in_sel \
-background [$i cget -foreground] \
-foreground [$i cget -background]
$i tag conf in_diff -background lightgray
$i tag conf in_sel -background lightgray
}
unset i
@@ -1913,18 +1933,18 @@ proc trace_current_diff_path {varname args} {
}
trace add variable current_diff_path write trace_current_diff_path
frame .vpane.lower.diff.header -background orange
frame .vpane.lower.diff.header -background gold
label .vpane.lower.diff.header.status \
-background orange \
-background gold \
-width $max_status_desc \
-anchor w \
-justify left
label .vpane.lower.diff.header.file \
-background orange \
-background gold \
-anchor w \
-justify left
label .vpane.lower.diff.header.path \
-background orange \
-background gold \
-anchor w \
-justify left
pack .vpane.lower.diff.header.status -side left
@@ -2038,17 +2058,17 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add separator
$ctxm add command \
-label {Show Less Context} \
-command {if {$repo_config(gui.diffcontext) >= 2} {
-command {if {$repo_config(gui.diffcontext) >= 1} {
incr repo_config(gui.diffcontext) -1
reshow_diff
}}
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add command \
-label {Show More Context} \
-command {
-command {if {$repo_config(gui.diffcontext) < 99} {
incr repo_config(gui.diffcontext)
reshow_diff
}
}}
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add separator
$ctxm add command -label {Options...} \

File diff suppressed because it is too large Load Diff

View File

@@ -201,12 +201,14 @@ proc do_create_branch {} {
pack $w.desc -anchor nw -fill x -pady 5 -padx 5
labelframe $w.from -text {Starting Revision}
radiobutton $w.from.head_r \
-text {Local Branch:} \
-value head \
-variable create_branch_revtype
eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
grid $w.from.head_r $w.from.head_m -sticky w
if {$all_heads ne {}} {
radiobutton $w.from.head_r \
-text {Local Branch:} \
-value head \
-variable create_branch_revtype
eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
grid $w.from.head_r $w.from.head_m -sticky w
}
set all_trackings [all_tracking_branches]
if {$all_trackings ne {}} {
set create_branch_trackinghead [lindex $all_trackings 0]

View File

@@ -70,7 +70,6 @@ constructor new {commit} {
bind $w_list <Right> break
bind $w_list <Visibility> [list focus $w_list]
bind $w_list <Destroy> [list delete_this $this]
set w $w_list
_ls $this $browser_commit
return $this

View File

@@ -120,10 +120,21 @@ proc delete_this {{t {}}} {
if {[namespace exists $t]} {namespace delete $t}
}
proc make_toplevel {t w} {
upvar $t top $w pfx
proc make_toplevel {t w args} {
upvar $t top $w pfx this this
if {[llength $args] % 2} {
error "make_toplevel topvar winvar {options}"
}
set autodelete 1
foreach {name value} $args {
switch -exact -- $name {
-autodelete {set autodelete $value}
default {error "unsupported option $name"}
}
}
if {[winfo ismapped .]} {
upvar this this
regsub -all {::} $this {__} w
set top .$w
set pfx $top
@@ -132,6 +143,13 @@ proc make_toplevel {t w} {
set top .
set pfx {}
}
if {$autodelete} {
wm protocol $top WM_DELETE_WINDOW "
[list delete_this $this]
[list destroy $top]
"
}
}
@@ -151,4 +169,3 @@ auto_mkindex_parser::command constructor {name args} {
[format { [list source [file join $dir %s]]} \
[file split $scriptFile]] "\n"
}

View File

@@ -17,7 +17,7 @@ constructor new {short_title long_title} {
method _init {} {
global M1B
make_toplevel top w
make_toplevel top w -autodelete 0
wm title $top "[appname] ([reponame]): $t_short"
set console_cr 1.0

View File

@@ -145,7 +145,7 @@ proc show_diff {path w {lno {}}} {
lappend cmd -p
lappend cmd --no-color
if {$repo_config(gui.diffcontext) > 0} {
if {$repo_config(gui.diffcontext) >= 0} {
lappend cmd "-U$repo_config(gui.diffcontext)"
}
if {$w eq $ui_index} {

View File

@@ -125,7 +125,8 @@ Please select fewer branches. To merge more than 15 branches, merge the branche
set cons [console::new "Merge" $msg]
console::exec $cons $cmd \
[namespace code [list _finish $revcnt $cons]]
bind $w <Destroy> {}
wm protocol $w WM_DELETE_WINDOW {}
destroy $w
}
@@ -250,7 +251,7 @@ proc dialog {} {
bind $w <$M1B-Key-Return> $_start
bind $w <Visibility> "grab $w; focus $w.source.l"
bind $w <Key-Escape> "unlock_index;destroy $w"
bind $w <Destroy> unlock_index
wm protocol $w WM_DELETE_WINDOW "unlock_index;destroy $w"
wm title $w "[appname] ([reponame]): Merge"
tkwait window $w
}

View File

@@ -15,6 +15,9 @@ proc save_config {} {
font configure ${font}bold \
-family $global_config_new(gui.$font^^family) \
-size $global_config_new(gui.$font^^size)
font configure ${font}italic \
-family $global_config_new(gui.$font^^family) \
-size $global_config_new(gui.$font^^size)
set global_config_new(gui.$name) [font configure $font]
unset global_config_new(gui.$font^^family)
unset global_config_new(gui.$font^^size)
@@ -173,7 +176,7 @@ proc do_options {} {
{i-1..5 merge.verbosity {Merge Verbosity}}
{b gui.trustmtime {Trust File Modification Timestamps}}
{i-1..99 gui.diffcontext {Number of Diff Context Lines}}
{i-0..99 gui.diffcontext {Number of Diff Context Lines}}
{t gui.newbranchtemplate {New Branch Name Template}}
} {
set type [lindex $option 0]

View File

@@ -561,7 +561,8 @@ foreach my $t (@files) {
$subject = $1;
} elsif (/^(Cc|From):\s+(.*)$/) {
if ($2 eq $from) {
if (unquote_rfc2047($2) eq $from) {
$from = $2;
next if ($suppress_from);
}
elsif ($1 eq 'From') {

12
grep.c
View File

@@ -1,5 +1,6 @@
#include "cache.h"
#include "grep.h"
#include "xdiff-interface.h"
void append_grep_pattern(struct grep_opt *opt, const char *pat,
const char *origin, int no, enum grep_pat_token t)
@@ -232,17 +233,6 @@ static void show_line(struct grep_opt *opt, const char *bol, const char *eol,
printf("%.*s\n", (int)(eol-bol), bol);
}
/*
* NEEDSWORK: share code with diff.c
*/
#define FIRST_FEW_BYTES 8000
static int buffer_is_binary(const char *ptr, unsigned long size)
{
if (FIRST_FEW_BYTES < size)
size = FIRST_FEW_BYTES;
return !!memchr(ptr, 0, size);
}
static int fixmatch(const char *pattern, char *line, regmatch_t *match)
{
char *hit = strstr(line, pattern);

View File

@@ -201,10 +201,10 @@ const char *fmt_ident(const char *name, const char *email,
setup_ident();
if (!name)
name = git_default_name;
if (!email)
email = getenv("EMAIL");
if (!email)
email = git_default_email;
if (!email)
email = getenv("EMAIL");
if (!*name) {
#ifndef NO_ETC_PASSWD

View File

@@ -680,6 +680,12 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
{
xpparam_t xpp;
if (buffer_is_binary(orig->ptr, orig->size) ||
buffer_is_binary(src1->ptr, src1->size) ||
buffer_is_binary(src2->ptr, src2->size))
return error("Cannot merge binary files: %s vs. %s\n",
name1, name2);
memset(&xpp, 0, sizeof(xpp));
return xdl_merge(orig,
src1, name1,

View File

@@ -160,8 +160,11 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
parse_tag_buffer(tag, buffer, size);
obj = &tag->object;
} else {
warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type);
obj = NULL;
}
if (obj && obj->type == OBJ_NONE)
obj->type = type;
*eaten_p = eaten;
return obj;
}

View File

@@ -1171,7 +1171,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
if (opts > 0) {
revs->diff = 1;
if (strcmp(argv[i], "-z"))
revs->diff = 1;
i += opts - 1;
continue;
}

View File

@@ -138,8 +138,8 @@ test_expect_success 'test tracking setup (non-wildcard, not matching)' \
git-config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
(git-show-ref -q refs/remotes/local/master || git-fetch local) &&
git-branch --track my5 local/master &&
! test $(git-config branch.my5.remote) = local &&
! test $(git-config branch.my5.merge) = refs/heads/master'
! test "$(git-config branch.my5.remote)" = local &&
! test "$(git-config branch.my5.merge)" = refs/heads/master'
test_expect_success 'test tracking setup via config' \
'git-config branch.autosetupmerge true &&
@@ -157,14 +157,22 @@ test_expect_success 'test overriding tracking setup via --no-track' \
(git-show-ref -q refs/remotes/local/master || git-fetch local) &&
git-branch --no-track my2 local/master &&
git-config branch.autosetupmerge false &&
! test $(git-config branch.my2.remote) = local &&
! test $(git-config branch.my2.merge) = refs/heads/master'
! test "$(git-config branch.my2.remote)" = local &&
! test "$(git-config branch.my2.merge)" = refs/heads/master'
test_expect_success 'test local tracking setup' \
'git branch --track my6 s &&
test $(git-config branch.my6.remote) = . &&
test $(git-config branch.my6.merge) = refs/heads/s'
test_expect_success 'test tracking setup via --track but deeper' \
'git-config remote.local.url . &&
git-config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
(git-show-ref -q refs/remotes/local/o/o || git-fetch local) &&
git-branch --track my7 local/o/o &&
test "$(git-config branch.my7.remote)" = local &&
test "$(git-config branch.my7.merge)" = refs/heads/o/o'
# Keep this test last, as it changes the current branch
cat >expect <<EOF
0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master

46
t/t5701-clone-local.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
test_description='test local clone'
. ./test-lib.sh
D=`pwd`
test_expect_success 'preparing origin repository' '
: >file && git add . && git commit -m1 &&
git clone --bare . a.git &&
git clone --bare . x
'
test_expect_success 'local clone without .git suffix' '
cd "$D" &&
git clone -l -s a b &&
cd b &&
git fetch
'
test_expect_success 'local clone with .git suffix' '
cd "$D" &&
git clone -l -s a.git c &&
cd c &&
git fetch
'
test_expect_success 'local clone from x' '
cd "$D" &&
git clone -l -s x y &&
cd y &&
git fetch
'
test_expect_success 'local clone from x.git that does not exist' '
cd "$D" &&
if git clone -l -s x.git z
then
echo "Oops, should have failed"
false
else
echo happy
fi
'
test_done

View File

@@ -81,4 +81,18 @@ EOF
test_expect_success "virtual trees were processed" "git diff expect out"
git reset --hard
test_expect_success 'refuse to merge binary files' '
printf "\0" > binary-file &&
git add binary-file &&
git commit -m binary &&
git checkout G &&
printf "\0\0" > binary-file &&
git add binary-file &&
git commit -m binary2 &&
! git merge F > merge.out 2> merge.err &&
grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \
merge.err
'
test_done

View File

@@ -190,4 +190,44 @@ test_expect_success 'checkout to detach HEAD with HEAD^0' '
fi
'
test_expect_success 'checkout with ambiguous tag/branch names' '
git tag both side &&
git branch both master &&
git reset --hard &&
git checkout master &&
git checkout both &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
test "z$H" = "z$M" &&
name=$(git symbolic-ref HEAD 2>/dev/null) &&
test "z$name" = zrefs/heads/both
'
test_expect_success 'checkout with ambiguous tag/branch names' '
git reset --hard &&
git checkout master &&
git tag frotz side &&
git branch frotz master &&
git reset --hard &&
git checkout master &&
git checkout tags/frotz &&
H=$(git rev-parse --verify HEAD) &&
S=$(git show-ref -s --verify refs/heads/side) &&
test "z$H" = "z$S" &&
if name=$(git symbolic-ref HEAD 2>/dev/null)
then
echo "Bad -- should have detached"
false
else
: happy
fi
'
test_done

7
tree.c
View File

@@ -173,8 +173,13 @@ static void track_tree_refs(struct tree *item)
continue;
if (S_ISDIR(entry.mode))
obj = &lookup_tree(entry.sha1)->object;
else
else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
obj = &lookup_blob(entry.sha1)->object;
else {
warning("in tree %s: entry %s has bad mode %.6o\n",
sha1_to_hex(item->object.sha1), entry.path, entry.mode);
obj = lookup_unknown_object(entry.sha1);
}
refs->ref[i++] = obj;
}
set_object_refs(&item->object, refs);

View File

@@ -122,4 +122,12 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
return 0;
}
#define FIRST_FEW_BYTES 8000
int buffer_is_binary(const char *ptr, unsigned long size)
{
if (FIRST_FEW_BYTES < size)
size = FIRST_FEW_BYTES;
return !!memchr(ptr, 0, size);
}

View File

@@ -18,5 +18,6 @@ int parse_hunk_header(char *line, int len,
int *ob, int *on,
int *nb, int *nn);
int read_mmfile(mmfile_t *ptr, const char *filename);
int buffer_is_binary(const char *ptr, unsigned long size);
#endif