Merge commit 'mingw/master' into devel

This commit is contained in:
Steffen Prohaska
2008-01-28 23:18:51 +01:00
36 changed files with 597 additions and 210 deletions

View File

@@ -10,17 +10,27 @@ Removal
* As git-commit and git-status have been rewritten, "git runstatus"
helper script lost all its users and has been removed.
* Curl library older than 7.10 is not supported by "git http-push",
as it does not work without CURLM.
Temporarily disabled
--------------------
* "git http-push" is known not to work well with cURL library older
than 7.16, and we had reports of repository corruption. It is
disabled on such platforms for now. Unfortunately, 1.5.3.8 shares
the same issue. In other words, this does not mean you will be
fine if you stick to an older git release. For now, please do not
use http-push from older git with cURL older than 7.16 if you
value your data. A proper fix will hopefully materialize in
later versions.
Deprecation notices
-------------------
* The next feature release of git (this change is scheduled for v1.6.0)
will by default install dashed form of commands (e.g. "git-commit")
outside of users' normal $PATH, and will install only selected
commands ("git" itself, and "gitk") in $PATH. This implies:
* From v1.6.0, git will by default install dashed form of commands
(e.g. "git-commit") outside of users' normal $PATH, and will install
only selected commands ("git" itself, and "gitk") in $PATH. This
implies:
- Using dashed forms of git commands (e.g. "git-commit") from the
command line has been informally deprecated since early 2006, but
@@ -34,8 +44,8 @@ Deprecation notices
- Use of dashed forms with "PATH=$(git --exec-path):$PATH; export
PATH" early in your script is not deprecated with this change.
Users are strongly encouraged to adjust their habits and scripts now
to prepare for this.
Users are strongly encouraged to adjust their habits and scripts now
to prepare for this change.
* The post-receive hook was introduced in March 2007 to supersede
the post-update hook, primarily to overcome the command line length
@@ -70,7 +80,7 @@ Updates since v1.5.3
* Comes with much improved gitk, with i18n.
* Comes with "git gui" 0.9.1 with i18n.
* Comes with git-gui 0.9.2 with i18n.
* gitk is now merged as a subdirectory of git.git project, in
preparation for its i18n.
@@ -232,8 +242,8 @@ Updates since v1.5.3
from its first parent.
* "git commit" used to unconditionally strip comment lines that
began with '#' and removed excess blank lines. This
behaviour has been made configurable.
began with '#' and removed excess blank lines. This behavior has
been made configurable.
* "git commit" has been rewritten in C.
@@ -317,7 +327,7 @@ Updates since v1.5.3
* "git status" from a subdirectory now shows relative paths, which
makes copy-and-pasting for git-checkout/git-add/git-rm easier. The
traditional behaviour to show the full path relative to the top of
traditional behavior to show the full path relative to the top of
the work tree can be had by setting status.relativepaths
configuration variable to false.
@@ -341,6 +351,7 @@ Updates since v1.5.3
- enhancement and more use of the strbuf API.
* Makefile tweaks to support HP-UX is in.
Fixes since v1.5.3
------------------
@@ -367,6 +378,6 @@ series.
--
exec >/var/tmp/1
O=v1.5.4-rc4
O=v1.5.4-rc5
echo O=`git describe refs/heads/master`
git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint

View File

@@ -23,11 +23,15 @@
fetches is a descendant of `<lbranch>`. This option
overrides that check.
ifdef::git-pull[]
\--no-tags::
endif::git-pull[]
ifndef::git-pull[]
-n, \--no-tags::
By default, `git-fetch` fetches tags that point at
objects that are downloaded from the remote repository
and stores them locally. This option disables this
automatic tag following.
endif::git-pull[]
By default, tags that point at objects that are downloaded
from the remote repository are fetched and stored locally.
This option disables this automatic tag following.
-t, \--tags::
Most of the tags are fetched automatically as branch

View File

@@ -62,6 +62,14 @@ OPTIONS
.git/objects/info/alternates to share the objects
with the source repository. The resulting repository
starts out without any object of its own.
*NOTE*: this is a possibly dangerous operation; do *not* use
it unless you understand what it does. If you clone your
repository using this option, then delete branches in the
source repository and then run linkgit:git-gc[1] using the
'--prune' option in the source repository, it may remove
objects which are referenced by the cloned repository.
--reference <repository>::
If the reference repository is on the local machine

View File

@@ -15,6 +15,9 @@ DESCRIPTION
Sends missing objects to remote repository, and updates the
remote branch.
*NOTE*: This command is temporarily disabled if your cURL
library is older than 7.16, as the combination has been reported
not to work and sometimes corrupts repository.
OPTIONS
-------

View File

@@ -25,6 +25,7 @@ OPTIONS
-------
include::merge-options.txt[]
:git-pull: 1
include::fetch-options.txt[]
include::pull-fetch-param.txt[]
@@ -34,7 +35,11 @@ include::urls-remotes.txt[]
include::merge-strategies.txt[]
\--rebase::
Instead of a merge, perform a rebase after fetching.
Instead of a merge, perform a rebase after fetching. If
there is a remote ref for the upstream branch, and this branch
was rebased since last fetched, the rebase uses that information
to avoid rebasing non-local changes.
*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

View File

@@ -137,6 +137,8 @@ The --cc option must be repeated for each user you want on the cc list.
Specify the primary recipient of the emails generated.
Generally, this will be the upstream maintainer of the
project involved.
Default is the value of the 'sendemail.to' configuration value;
if that is unspecified, this will be prompted for.
+
The --to option must be repeated for each user you want on the to list.

View File

@@ -9,8 +9,9 @@ git-submodule - Initialize, update or inspect submodules
SYNOPSIS
--------
[verse]
'git-submodule' [--quiet] [-b branch] add <repository> [<path>]
'git-submodule' [--quiet] [--cached] [status|init|update] [--] [<path>...]
'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
'git-submodule' [--quiet] status [--cached] [--] [<path>...]
'git-submodule' [--quiet] [init|update] [--] [<path>...]
COMMANDS

View File

@@ -456,10 +456,13 @@ have each person clone that repository with 'git clone':
------------------------------------------------------------------------
# Do the initial import on a server
ssh server "cd /pub && git-svn clone http://svn.foo.org/project
# Clone locally
git clone server:/pub/project
# Tell git-svn which branch contains the Subversion commits
git update-ref refs/remotes/git-svn origin/master
# Clone locally - make sure the refs/remotes/ space matches the server
mkdir project
cd project
git-init
git remote add origin server:/pub/project
git config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/*
git fetch
# Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)
git-svn init http://svn.foo.org/project
# Pull the latest changes from Subversion

View File

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

View File

@@ -42,6 +42,8 @@ all::
#
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
#
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows. By default, symrefs are still used.
#
@@ -508,6 +510,17 @@ ifeq ($(uname_S),IRIX64)
# for now, build 32-bit version
BASIC_LDFLAGS += -L/usr/lib32
endif
ifeq ($(uname_S),HP-UX)
NO_IPV6=YesPlease
NO_SETENV=YesPlease
NO_STRCASESTR=YesPlease
NO_MEMMEM = YesPlease
NO_STRLCPY = YesPlease
NO_MKDTEMP = YesPlease
NO_UNSETENV = YesPlease
NO_HSTRERROR = YesPlease
NO_SYS_SELECT_H = YesPlease
endif
ifneq (,$(findstring MINGW,$(uname_S)))
NO_MMAP = YesPlease
NO_PREAD = YesPlease
@@ -676,6 +689,9 @@ ifdef NO_UNSETENV
COMPAT_CFLAGS += -DNO_UNSETENV
COMPAT_OBJS += compat/unsetenv.o
endif
ifdef NO_SYS_SELECT_H
BASIC_CFLAGS += -DNO_SYS_SELECT_H
endif
ifdef NO_MMAP
COMPAT_CFLAGS += -DNO_MMAP
COMPAT_OBJS += compat/mmap.o
@@ -979,7 +995,7 @@ git-%$X: %.o $(GITLIBS)
git-imap-send$X: imap-send.o $(LIB_FILE)
http.o http-walker.o http-push.o: http.h
http.o http-walker.o http-push.o transport.o: http.h
git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \

View File

@@ -122,19 +122,23 @@ static void rollback_index_files(void)
}
}
static void commit_index_files(void)
static int commit_index_files(void)
{
int err = 0;
switch (commit_style) {
case COMMIT_AS_IS:
break; /* nothing to do */
case COMMIT_NORMAL:
commit_lock_file(&index_lock);
err = commit_lock_file(&index_lock);
break;
case COMMIT_PARTIAL:
commit_lock_file(&index_lock);
err = commit_lock_file(&index_lock);
rollback_lock_file(&false_lock);
break;
}
return err;
}
/*
@@ -926,7 +930,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
unlink(git_path("MERGE_HEAD"));
unlink(git_path("MERGE_MSG"));
commit_index_files();
if (commit_index_files())
die ("Repository has been updated, but unable to write\n"
"new_index file. Check that disk is not full or quota is\n"
"not exceeded, and then \"git reset HEAD\" to recover.");
rerere();
run_hook(get_index_file(), "post-commit", NULL);

View File

@@ -1672,7 +1672,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
p[i].data_ready = 0;
/* try to split chunks on "path" boundaries */
while (sub_size < list_size && list[sub_size]->hash &&
while (sub_size && sub_size < list_size &&
list[sub_size]->hash &&
list[sub_size]->hash == list[sub_size-1]->hash)
sub_size++;

View File

@@ -30,6 +30,7 @@ NO_CURL=@NO_CURL@
NO_EXPAT=@NO_EXPAT@
NEEDS_LIBICONV=@NEEDS_LIBICONV@
NEEDS_SOCKET=@NEEDS_SOCKET@
NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@

View File

@@ -235,6 +235,12 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
## Checks for header files.
AC_MSG_NOTICE([CHECKS for header files])
#
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
AC_CHECK_HEADER([sys/select.h],
[NO_SYS_SELECT_H=],
[NO_SYS_SELECT_H=UnfortunatelyYes])
AC_SUBST(NO_SYS_SELECT_H)
#
# Define OLD_ICONV if your library has an old iconv(), where the second
# (input buffer pointer) parameter is declared with type (const char **).
AC_DEFUN([OLDICONVTEST_SRC], [[

View File

@@ -275,6 +275,8 @@ struct recent_command
static unsigned long max_depth = 10;
static off_t max_packsize = (1LL << 32) - 1;
static int force_update;
static int pack_compression_level = Z_DEFAULT_COMPRESSION;
static int pack_compression_seen;
/* Stats and misc. counters */
static uintmax_t alloc_count;
@@ -1040,7 +1042,7 @@ static int store_object(
delta = NULL;
memset(&s, 0, sizeof(s));
deflateInit(&s, zlib_compression_level);
deflateInit(&s, pack_compression_level);
if (delta) {
s.next_in = delta;
s.avail_in = deltalen;
@@ -1068,7 +1070,7 @@ static int store_object(
delta = NULL;
memset(&s, 0, sizeof(s));
deflateInit(&s, zlib_compression_level);
deflateInit(&s, pack_compression_level);
s.next_in = (void *)dat->buf;
s.avail_in = dat->len;
s.avail_out = deflateBound(&s, s.avail_in);
@@ -1125,6 +1127,24 @@ static int store_object(
return 0;
}
/* All calls must be guarded by find_object() or find_mark() to
* ensure the 'struct object_entry' passed was written by this
* process instance. We unpack the entry by the offset, avoiding
* the need for the corresponding .idx file. This unpacking rule
* works because we only use OBJ_REF_DELTA within the packfiles
* created by fast-import.
*
* oe must not be NULL. Such an oe usually comes from giving
* an unknown SHA-1 to find_object() or an undefined mark to
* find_mark(). Callers must test for this condition and use
* the standard read_sha1_file() when it happens.
*
* oe->pack_id must not be MAX_PACK_ID. Such an oe is usually from
* find_mark(), where the mark was reloaded from an existing marks
* file and is referencing an object that this fast-import process
* instance did not write out to a packfile. Callers must test for
* this condition and use read_sha1_file() instead.
*/
static void *gfi_unpack_entry(
struct object_entry *oe,
unsigned long *sizep)
@@ -1132,7 +1152,22 @@ static void *gfi_unpack_entry(
enum object_type type;
struct packed_git *p = all_packs[oe->pack_id];
if (p == pack_data && p->pack_size < (pack_size + 20)) {
/* The object is stored in the packfile we are writing to
* and we have modified it since the last time we scanned
* back to read a previously written object. If an old
* window covered [p->pack_size, p->pack_size + 20) its
* data is stale and is not valid. Closing all windows
* and updating the packfile length ensures we can read
* the newly written data.
*/
close_pack_windows(p);
/* We have to offer 20 bytes additional on the end of
* the packfile as the core unpacker code assumes the
* footer is present at the file end and must promise
* at least 20 bytes within any window it maps. But
* we don't actually create the footer here.
*/
p->pack_size = pack_size + 20;
}
return unpack_entry(p, oe->offset, &type, sizep);
@@ -2284,6 +2319,27 @@ static void import_marks(const char *input_file)
fclose(f);
}
static int git_pack_config(const char *k, const char *v)
{
if (!strcmp(k, "pack.depth")) {
max_depth = git_config_int(k, v);
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
return 0;
}
if (!strcmp(k, "pack.compression")) {
int level = git_config_int(k, v);
if (level == -1)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
die("bad pack compression level %d", level);
pack_compression_level = level;
pack_compression_seen = 1;
return 0;
}
return git_default_config(k, v);
}
static const char fast_import_usage[] =
"git-fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
@@ -2291,7 +2347,10 @@ int main(int argc, const char **argv)
{
unsigned int i, show_stats = 1;
git_config(git_default_config);
git_config(git_pack_config);
if (!pack_compression_seen && core_compression_seen)
pack_compression_level = core_compression_level;
alloc_objects(object_entry_alloc);
strbuf_init(&command_buf, 0);
atom_table = xcalloc(atom_table_sz, sizeof(struct atom_str*));

View File

@@ -71,7 +71,9 @@
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#ifndef NO_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>

View File

@@ -2543,8 +2543,15 @@ sub update
if ($parent eq $lastpicked) {
next;
}
my $base = safe_pipe_capture('git-merge-base',
my $base = eval {
safe_pipe_capture('git-merge-base',
$lastpicked, $parent);
};
# The two branches may not be related at all,
# in which case merge base simply fails to find
# any, but that's Ok.
next if ($@);
chomp $base;
if ($base) {
my @merged;

View File

@@ -67,7 +67,7 @@ ifndef V
QUIET_GEN = $(QUIET)echo ' ' GEN '$@' &&
QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) &&
QUIET_MSGFMT0 = $(QUIET)printf ' MSGFMT %12s ' $@ && v=`
QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages//g'
QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages*//g'
QUIET_2DEVNULL = 2>/dev/null
INSTALL_D0 = dir=
@@ -198,6 +198,9 @@ ifdef NO_MSGFMT
MSGFMT ?= $(TCL_PATH) po/po2msg.sh
else
MSGFMT ?= msgfmt
ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
MSGFMT := $(TCL_PATH) po/po2msg.sh
endif
endif
msgsdir = $(gg_libdir)/msgs

View File

@@ -438,6 +438,34 @@ proc git_write {args} {
return [open [concat $opt $cmdp $args] w]
}
proc githook_read {hook_name args} {
set pchook [gitdir hooks $hook_name]
lappend args 2>@1
# On Cygwin [file executable] might lie so we need to ask
# the shell if the hook is executable. Yes that's annoying.
#
if {[is_Cygwin]} {
upvar #0 _sh interp
if {![info exists interp]} {
set interp [_which sh]
}
if {$interp eq {}} {
error "hook execution requires sh (not in PATH)"
}
set scr {if test -x "$1";then exec "$@";fi}
set sh_c [list | $interp -c $scr $interp $pchook]
return [_open_stdout_stderr [concat $sh_c $args]]
}
if {[file executable $pchook]} {
return [_open_stdout_stderr [concat [list | $pchook] $args]]
}
return {}
}
proc sq {value} {
regsub -all ' $value "'\\''" value
return "'$value'"

View File

@@ -451,7 +451,8 @@ method _sb_set {sb orient first last} {
focus $old_focus
}
}
$sb set $first $last
catch {$sb set $first $last}
}
method _show_tooltip {pos} {

View File

@@ -192,45 +192,52 @@ A good commit message has the following format:
return
}
# -- Build the message file.
#
set msg_p [gitdir GITGUI_EDITMSG]
set msg_wt [open $msg_p w]
fconfigure $msg_wt -translation lf
if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
set enc utf-8
}
set use_enc [tcl_encoding $enc]
if {$use_enc ne {}} {
fconfigure $msg_wt -encoding $use_enc
} else {
puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
fconfigure $msg_wt -encoding utf-8
}
puts $msg_wt $msg
close $msg_wt
# -- Run the pre-commit hook.
#
set pchook [gitdir hooks pre-commit]
# On Cygwin [file executable] might lie so we need to ask
# the shell if the hook is executable. Yes that's annoying.
#
if {[is_Cygwin] && [file isfile $pchook]} {
set pchook [list sh -c [concat \
"if test -x \"$pchook\";" \
"then exec \"$pchook\" 2>&1;" \
"fi"]]
} elseif {[file executable $pchook]} {
set pchook [list $pchook |& cat]
} else {
commit_writetree $curHEAD $msg
set fd_ph [githook_read pre-commit]
if {$fd_ph eq {}} {
commit_commitmsg $curHEAD $msg_p
return
}
ui_status {Calling pre-commit hook...}
set pch_error {}
set fd_ph [open "| $pchook" r]
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fileevent $fd_ph readable \
[list commit_prehook_wait $fd_ph $curHEAD $msg]
[list commit_prehook_wait $fd_ph $curHEAD $msg_p]
}
proc commit_prehook_wait {fd_ph curHEAD msg} {
proc commit_prehook_wait {fd_ph curHEAD msg_p} {
global pch_error
append pch_error [read $fd_ph]
fconfigure $fd_ph -blocking 1
if {[eof $fd_ph]} {
if {[catch {close $fd_ph}]} {
catch {file delete $msg_p}
ui_status {Commit declined by pre-commit hook.}
hook_failed_popup pre-commit $pch_error
unlock_index
} else {
commit_writetree $curHEAD $msg
commit_commitmsg $curHEAD $msg_p
}
set pch_error {}
return
@@ -238,14 +245,52 @@ proc commit_prehook_wait {fd_ph curHEAD msg} {
fconfigure $fd_ph -blocking 0
}
proc commit_writetree {curHEAD msg} {
proc commit_commitmsg {curHEAD msg_p} {
global pch_error
# -- Run the commit-msg hook.
#
set fd_ph [githook_read commit-msg $msg_p]
if {$fd_ph eq {}} {
commit_writetree $curHEAD $msg_p
return
}
ui_status {Calling commit-msg hook...}
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fileevent $fd_ph readable \
[list commit_commitmsg_wait $fd_ph $curHEAD $msg_p]
}
proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
global pch_error
append pch_error [read $fd_ph]
fconfigure $fd_ph -blocking 1
if {[eof $fd_ph]} {
if {[catch {close $fd_ph}]} {
catch {file delete $msg_p}
ui_status {Commit declined by commit-msg hook.}
hook_failed_popup commit-msg $pch_error
unlock_index
} else {
commit_writetree $curHEAD $msg_p
}
set pch_error {}
return
}
fconfigure $fd_ph -blocking 0
}
proc commit_writetree {curHEAD msg_p} {
ui_status {Committing changes...}
set fd_wt [git_read write-tree]
fileevent $fd_wt readable \
[list commit_committree $fd_wt $curHEAD $msg]
[list commit_committree $fd_wt $curHEAD $msg_p]
}
proc commit_committree {fd_wt curHEAD msg} {
proc commit_committree {fd_wt curHEAD msg_p} {
global HEAD PARENT MERGE_HEAD commit_type
global current_branch
global ui_comm selected_commit_type
@@ -254,6 +299,7 @@ proc commit_committree {fd_wt curHEAD msg} {
gets $fd_wt tree_id
if {[catch {close $fd_wt} err]} {
catch {file delete $msg_p}
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
@@ -276,6 +322,7 @@ proc commit_committree {fd_wt curHEAD msg} {
}
if {$tree_id eq $old_tree} {
catch {file delete $msg_p}
info_popup [mc "No changes to commit.
No files were modified by this commit and it was not a merge commit.
@@ -288,24 +335,6 @@ A rescan will be automatically started now.
}
}
# -- Build the message.
#
set msg_p [gitdir COMMIT_EDITMSG]
set msg_wt [open $msg_p w]
fconfigure $msg_wt -translation lf
if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
set enc utf-8
}
set use_enc [tcl_encoding $enc]
if {$use_enc ne {}} {
fconfigure $msg_wt -encoding $use_enc
} else {
puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
fconfigure $msg_wt -encoding utf-8
}
puts $msg_wt $msg
close $msg_wt
# -- Create the commit.
#
set cmd [list commit-tree $tree_id]
@@ -314,6 +343,7 @@ A rescan will be automatically started now.
}
lappend cmd <$msg_p
if {[catch {set cmt_id [eval git $cmd]} err]} {
catch {file delete $msg_p}
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
@@ -326,16 +356,14 @@ A rescan will be automatically started now.
if {$commit_type ne {normal}} {
append reflogm " ($commit_type)"
}
set i [string first "\n" $msg]
if {$i >= 0} {
set subject [string range $msg 0 [expr {$i - 1}]]
} else {
set subject $msg
}
set msg_fd [open $msg_p r]
gets $msg_fd subject
close $msg_fd
append reflogm {: } $subject
if {[catch {
git update-ref -m $reflogm HEAD $cmt_id $curHEAD
} err]} {
catch {file delete $msg_p}
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
@@ -363,17 +391,13 @@ A rescan will be automatically started now.
# -- Run the post-commit hook.
#
set pchook [gitdir hooks post-commit]
if {[is_Cygwin] && [file isfile $pchook]} {
set pchook [list sh -c [concat \
"if test -x \"$pchook\";" \
"then exec \"$pchook\";" \
"fi"]]
} elseif {![file executable $pchook]} {
set pchook {}
}
if {$pchook ne {}} {
catch {exec $pchook &}
set fd_ph [githook_read post-commit]
if {$fd_ph ne {}} {
upvar #0 pch_error$cmt_id pc_err
set pc_err {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fileevent $fd_ph readable \
[list commit_postcommit_wait $fd_ph $cmt_id]
}
$ui_comm delete 0.0 end
@@ -429,3 +453,18 @@ A rescan will be automatically started now.
reshow_diff
ui_status [mc "Created commit %s: %s" [string range $cmt_id 0 7] $subject]
}
proc commit_postcommit_wait {fd_ph cmt_id} {
upvar #0 pch_error$cmt_id pch_error
append pch_error [read $fd_ph]
fconfigure $fd_ph -blocking 1
if {[eof $fd_ph]} {
if {[catch {close $fd_ph}]} {
hook_failed_popup post-commit $pch_error 0
}
unset pch_error
return
}
fconfigure $fd_ph -blocking 0
}

View File

@@ -62,7 +62,7 @@ proc ask_popup {msg} {
eval $cmd
}
proc hook_failed_popup {hook msg} {
proc hook_failed_popup {hook msg {is_fatal 1}} {
set w .hookfail
toplevel $w
@@ -77,14 +77,16 @@ proc hook_failed_popup {hook msg} {
-width 80 -height 10 \
-font font_diff \
-yscrollcommand [list $w.m.sby set]
label $w.m.l2 \
-text [mc "You must correct the above errors before committing."] \
-anchor w \
-justify left \
-font font_uibold
scrollbar $w.m.sby -command [list $w.m.t yview]
pack $w.m.l1 -side top -fill x
pack $w.m.l2 -side bottom -fill x
if {$is_fatal} {
label $w.m.l2 \
-text [mc "You must correct the above errors before committing."] \
-anchor w \
-justify left \
-font font_uibold
pack $w.m.l2 -side bottom -fill x
}
pack $w.m.sby -side right -fill y
pack $w.m.t -side left -fill both -expand 1
pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
@@ -99,6 +101,6 @@ proc hook_failed_popup {hook msg} {
bind $w <Visibility> "grab $w; focus $w"
bind $w <Key-Return> "destroy $w"
wm title $w [append "[appname] ([reponame]): " [mc "error"]]
wm title $w [strcat "[appname] ([reponame]): " [mc "error"]]
tkwait window $w
}

View File

@@ -34,7 +34,7 @@ msgstr "branche"
#. ""
msgid "branch [verb]"
msgstr "cr<EFBFBD>er une branche"
msgstr "créer une branche"
#. ""
msgid "checkout [noun]"
@@ -58,7 +58,7 @@ msgstr "commiter"
#. ""
msgid "diff [noun]"
msgstr "diff<EFBFBD>rence"
msgstr "différence"
#. ""
msgid "diff [verb]"
@@ -70,11 +70,11 @@ msgstr "fusion par avance rapide"
#. "Fetching a branch means to get the branch's head from a remote repository, to find out which objects are missing from the local object database, and to get them, too."
msgid "fetch"
msgstr "r<EFBFBD>cup<EFBFBD>rer"
msgstr "récupérer"
#. "A collection of files. The index is a stored version of your working tree."
msgid "index (in git-gui: staging area)"
msgstr "pr<EFBFBD>-commit"
msgstr "pré-commit"
#. "A successful merge results in the creation of a new commit representing the result of the merge."
msgid "merge [noun]"
@@ -106,15 +106,15 @@ msgstr "refaire"
#. "An other repository ('remote'). One might have a set of remotes whose branches one tracks."
msgid "remote"
msgstr "r<EFBFBD>f<EFBFBD>rentiel distant"
msgstr "référentiel distant"
#. "A collection of refs (?) together with an object database containing all objects which are reachable from the refs... (oops, you've lost me here. Again, please an explanation for mere mortals?)"
msgid "repository"
msgstr "r<EFBFBD>f<EFBFBD>rentiel"
msgstr "référentiel"
#. ""
msgid "reset"
msgstr "r<EFBFBD>initialiser"
msgstr "réinitialiser"
#. ""
msgid "revert"
@@ -122,7 +122,7 @@ msgstr "inverser"
#. "A particular state of files and directories which was stored in the object database."
msgid "revision"
msgstr "r<EFBFBD>vision"
msgstr "révision"
#. ""
msgid "sign off"
@@ -130,11 +130,11 @@ msgstr "signer"
#. ""
msgid "staging area"
msgstr "pr<EFBFBD>-commit"
msgstr "pré-commit"
#. ""
msgid "status"
msgstr "<EFBFBD>tat"
msgstr "état"
#. "A ref pointing to a tag or commit object"
msgid "tag [noun]"
@@ -150,15 +150,15 @@ msgstr "branche de suivi"
#. ""
msgid "undo"
msgstr "d<EFBFBD>faire"
msgstr "défaire"
#. ""
msgid "update"
msgstr "mise <EFBFBD> jour"
msgstr "mise à jour"
#. ""
msgid "verify"
msgstr "v<EFBFBD>rifier"
msgstr "vérifier"
#. "The tree of actual checked out files."
msgid "working copy, working tree"

View File

@@ -127,7 +127,26 @@ foreach file $files {
}
if {$show_statistics} {
puts [concat "$translated_count translated messages, " \
"$fuzzy_count fuzzy ones, " \
"$not_translated_count untranslated ones."]
set str ""
append str "$translated_count translated message"
if {$translated_count != 1} {
append str s
}
if {$fuzzy_count > 1} {
append str ", $fuzzy_count fuzzy translation"
if {$fuzzy_count != 1} {
append str s
}
}
if {$not_translated_count > 0} {
append str ", $not_translated_count untranslated message"
if {$not_translated_count != 1} {
append str s
}
}
append str .
puts $str
}

View File

@@ -106,6 +106,15 @@ error_on_no_merge_candidates () {
exit 1
}
test true = "$rebase" && {
. git-parse-remote &&
origin="$1"
test -z "$origin" && origin=$(get_default_remote)
reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null |
sed "s|refs/heads/\(.*\):|\1|")" &&
oldremoteref="$(git rev-parse --verify \
"refs/remotes/$origin/$reflist" 2>/dev/null)"
}
orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
git-fetch --update-head-ok "$@" || exit 1
@@ -164,6 +173,7 @@ then
fi
merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
test true = "$rebase" && exec git-rebase $merge_head
test true = "$rebase" &&
exec git-rebase --onto $merge_head ${oldremoteref:-$merge_head}
exec git-merge $no_summary $no_commit $squash $no_ff $strategy_args \
"$merge_name" HEAD $merge_head

View File

@@ -462,7 +462,7 @@ EOT
exit(0);
}
@files = ($compose_filename . ".final");
@files = ($compose_filename . ".final", @files);
}
# Variables we set as part of the loop over files

View File

@@ -9,11 +9,8 @@ OPTIONS_SPEC=
. git-sh-setup
require_work_tree
add=
command=
branch=
init=
update=
status=
quiet=
cached=
@@ -86,9 +83,9 @@ module_name()
#
# Clone a submodule
#
# Prior to calling, modules_update checks that a possibly existing
# Prior to calling, cmd_update checks that a possibly existing
# path is not a git repository.
# Likewise, module_add checks that path does not exist at all,
# Likewise, cmd_add checks that path does not exist at all,
# since it is the location of a new submodule.
#
module_clone()
@@ -121,8 +118,34 @@ module_clone()
#
# optional branch is stored in global branch variable
#
module_add()
cmd_add()
{
# parse $args after "submodule ... add".
while test $# -ne 0
do
case "$1" in
-b | --branch)
case "$2" in '') usage ;; esac
branch=$2
shift
;;
-q|--quiet)
quiet=1
;;
--)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
repo=$1
path=$2
@@ -174,8 +197,29 @@ module_add()
#
# $@ = requested paths (default to all)
#
modules_init()
cmd_init()
{
# parse $args after "submodule ... init".
while test $# -ne 0
do
case "$1" in
-q|--quiet)
quiet=1
;;
--)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
git ls-files --stage -- "$@" | grep -e '^160000 ' |
while read mode sha1 stage path
do
@@ -207,8 +251,29 @@ modules_init()
#
# $@ = requested paths (default to all)
#
modules_update()
cmd_update()
{
# parse $args after "submodule ... update".
while test $# -ne 0
do
case "$1" in
-q|--quiet)
quiet=1
;;
--)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
git ls-files --stage -- "$@" | grep -e '^160000 ' |
while read mode sha1 stage path
do
@@ -266,8 +331,32 @@ set_name_rev () {
#
# $@ = requested paths (default to all)
#
modules_list()
cmd_status()
{
# parse $args after "submodule ... status".
while test $# -ne 0
do
case "$1" in
-q|--quiet)
quiet=1
;;
--cached)
cached=1
;;
--)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
git ls-files --stage -- "$@" | grep -e '^160000 ' |
while read mode sha1 stage path
do
@@ -293,20 +382,17 @@ modules_list()
done
}
while test $# != 0
# This loop parses the command line arguments to find the
# subcommand name to dispatch. Parsing of the subcommand specific
# options are primarily done by the subcommand implementations.
# Subcommand specific options such as --branch and --cached are
# parsed here as well, for backward compatibility.
while test $# != 0 && test -z "$command"
do
case "$1" in
add)
add=1
;;
init)
init=1
;;
update)
update=1
;;
status)
status=1
add | init | update | status)
command=$1
;;
-q|--quiet)
quiet=1
@@ -335,30 +421,19 @@ do
shift
done
case "$add,$branch" in
1,*)
;;
,)
;;
,*)
usage
;;
esac
# No command word defaults to "status"
test -n "$command" || command=status
case "$add,$init,$update,$status,$cached" in
1,,,,)
module_add "$@"
;;
,1,,,)
modules_init "$@"
;;
,,1,,)
modules_update "$@"
;;
,,,*,*)
modules_list "$@"
;;
*)
# "-b branch" is accepted only by "add"
if test -n "$branch" && test "$command" != add
then
usage
;;
esac
fi
# "--cached" is accepted only by "status"
if test -n "$cached" && test "$command" != status
then
usage
fi
"cmd_$command" "$@"

View File

@@ -1408,11 +1408,9 @@ sub read_all_remotes {
}
sub init_vars {
if (defined $_repack) {
$_repack = 1000 if ($_repack <= 0);
$_repack_nr = $_repack;
$_repack_flags ||= '-d';
}
$_repack = 1000 unless (defined $_repack && $_repack > 0);
$_repack_nr = $_repack;
$_repack_flags ||= '-d';
}
sub verify_remotes_sanity {
@@ -2151,7 +2149,7 @@ sub do_git_commit {
0, $self->svm_uuid);
}
print " = $commit ($self->{ref_id})\n";
if (defined $_repack && (--$_repack_nr == 0)) {
if ($_repack && (--$_repack_nr == 0)) {
$_repack_nr = $_repack;
# repack doesn't use any arguments with spaces in them, does it?
print "Running git repack $_repack_flags ...\n";

8
http.h
View File

@@ -8,6 +8,14 @@
#include "strbuf.h"
/*
* We detect based on the cURL version if multi-transfer is
* usable in this implementation and define this symbol accordingly.
* This is not something Makefile should set nor users should pass
* via CFLAGS.
*/
#undef USE_CURL_MULTI
#if LIBCURL_VERSION_NUM >= 0x071000
#define USE_CURL_MULTI
#define DEFAULT_MAX_REQUESTS 5

View File

@@ -216,6 +216,26 @@ is_abbreviated:
return error("unknown option `%s'", arg);
}
void check_typos(const char *arg, const struct option *options)
{
if (strlen(arg) < 3)
return;
if (!prefixcmp(arg, "no-")) {
error ("did you mean `--%s` (with two dashes ?)", arg);
exit(129);
}
for (; options->type != OPTION_END; options++) {
if (!options->long_name)
continue;
if (!prefixcmp(options->long_name, arg)) {
error ("did you mean `--%s` (with two dashes ?)", arg);
exit(129);
}
}
}
static NORETURN void usage_with_options_internal(const char * const *,
const struct option *, int);
@@ -235,12 +255,18 @@ int parse_options(int argc, const char **argv, const struct option *options,
if (arg[1] != '-') {
args.opt = arg + 1;
do {
if (*args.opt == 'h')
usage_with_options(usagestr, options);
if (parse_short_opt(&args, options) < 0)
usage_with_options(usagestr, options);
if (args.opt)
check_typos(arg + 1, options);
while (args.opt) {
if (*args.opt == 'h')
usage_with_options(usagestr, options);
if (parse_short_opt(&args, options) < 0)
usage_with_options(usagestr, options);
} while (args.opt);
}
continue;
}

View File

@@ -19,6 +19,7 @@ string options
get a string
--string2 <str> get another string
--st <st> get another string (pervert ordering)
-o <str> get another string
EOF
@@ -103,4 +104,14 @@ test_expect_success 'non ambiguous option (after two options it abbreviates)' '
git diff expect output
'
cat > expect.err << EOF
error: did you mean \`--boolean\` (with two dashes ?)
EOF
test_expect_success 'detect possible typos' '
! test-parse-options -boolean > output 2> output.err &&
test ! -s output &&
git diff expect.err output.err
'
test_done

View File

@@ -71,8 +71,25 @@ test_expect_success 'branch.to-rebase.rebase' '
git reset --hard before-rebase &&
git config branch.to-rebase.rebase 1 &&
git pull . copy &&
git config branch.to-rebase.rebase 0 &&
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
test new = $(git show HEAD:file2)
'
test_expect_success '--rebase with rebased upstream' '
git remote add -f me . &&
git checkout copy &&
git reset --hard HEAD^ &&
echo conflicting modification > file &&
git commit -m conflict file &&
git checkout to-rebase &&
echo file > file2 &&
git commit -m to-rebase file2 &&
git pull --rebase me copy &&
test "conflicting modification" = "$(cat file)" &&
test file = $(cat file2)
'
test_done

View File

@@ -53,14 +53,18 @@ git prune'
cd "$base_dir"
test_expect_failure 'creating too deep nesting' \
test_expect_success 'creating too deep nesting' \
'git clone -l -s C D &&
git clone -l -s D E &&
git clone -l -s E F &&
git clone -l -s F G &&
git clone -l -s G H &&
cd H &&
test_valid_repo'
git clone -l -s G H'
test_expect_success 'invalidity of deepest repository' \
'cd H && {
test_valid_repo
test $? -ne 0
}'
cd "$base_dir"

View File

@@ -13,11 +13,11 @@ subcommands of git-submodule.
#
# Test setup:
# -create a repository in directory lib
# -create a repository in directory init
# -add a couple of files
# -add directory lib to 'superproject', this creates a DIRLINK entry
# -add directory init to 'superproject', this creates a DIRLINK entry
# -add a couple of regular files to enable testing of submodule filtering
# -mv lib subrepo
# -mv init subrepo
# -add an entry to .gitmodules for submodule 'example'
#
test_expect_success 'Prepare submodule testing' '
@@ -25,8 +25,8 @@ test_expect_success 'Prepare submodule testing' '
git-add t &&
git-commit -m "initial commit" &&
git branch initial HEAD &&
mkdir lib &&
cd lib &&
mkdir init &&
cd init &&
git init &&
echo a >a &&
git add a &&
@@ -41,10 +41,10 @@ test_expect_success 'Prepare submodule testing' '
cd .. &&
echo a >a &&
echo z >z &&
git add a lib z &&
git add a init z &&
git-commit -m "super commit 1" &&
mv lib .subrepo &&
GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/lib.git
mv init .subrepo &&
GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
'
test_expect_success 'status should fail for unmapped paths' '
@@ -52,7 +52,7 @@ test_expect_success 'status should fail for unmapped paths' '
then
echo "[OOPS] submodule status succeeded"
false
elif ! GIT_CONFIG=.gitmodules git config submodule.example.path lib
elif ! GIT_CONFIG=.gitmodules git config submodule.example.path init
then
echo "[OOPS] git config failed to update .gitmodules"
false
@@ -71,7 +71,7 @@ test_expect_success 'status should initially be "missing"' '
test_expect_success 'init should register submodule url in .git/config' '
git-submodule init &&
url=$(git config submodule.example.url) &&
if test "$url" != "git://example.com/lib.git"
if test "$url" != "git://example.com/init.git"
then
echo "[OOPS] init succeeded but submodule url is wrong"
false
@@ -83,41 +83,41 @@ test_expect_success 'init should register submodule url in .git/config' '
'
test_expect_success 'update should fail when path is used by a file' '
echo "hello" >lib &&
echo "hello" >init &&
if git-submodule update
then
echo "[OOPS] update should have failed"
false
elif test "$(cat lib)" != "hello"
elif test "$(cat init)" != "hello"
then
echo "[OOPS] update failed but lib file was molested"
echo "[OOPS] update failed but init file was molested"
false
else
rm lib
rm init
fi
'
test_expect_success 'update should fail when path is used by a nonempty directory' '
mkdir lib &&
echo "hello" >lib/a &&
mkdir init &&
echo "hello" >init/a &&
if git-submodule update
then
echo "[OOPS] update should have failed"
false
elif test "$(cat lib/a)" != "hello"
elif test "$(cat init/a)" != "hello"
then
echo "[OOPS] update failed but lib/a was molested"
echo "[OOPS] update failed but init/a was molested"
false
else
rm lib/a
rm init/a
fi
'
test_expect_success 'update should work when path is an empty dir' '
rm -rf lib &&
mkdir lib &&
rm -rf init &&
mkdir init &&
git-submodule update &&
head=$(cd lib && git rev-parse HEAD) &&
head=$(cd init && git rev-parse HEAD) &&
if test -z "$head"
then
echo "[OOPS] Failed to obtain submodule head"
@@ -134,7 +134,7 @@ test_expect_success 'status should be "up-to-date" after update' '
'
test_expect_success 'status should be "modified" after submodule commit' '
cd lib &&
cd init &&
echo b >b &&
git add b &&
git-commit -m "submodule commit 2" &&
@@ -157,8 +157,8 @@ test_expect_success 'git diff should report the SHA1 of the new submodule commit
'
test_expect_success 'update should checkout rev1' '
git-submodule update &&
head=$(cd lib && git rev-parse HEAD) &&
git-submodule update init &&
head=$(cd init && git rev-parse HEAD) &&
if test -z "$head"
then
echo "[OOPS] submodule git rev-parse returned nothing"
@@ -182,13 +182,13 @@ test_expect_success 'checkout superproject with subproject already present' '
test_expect_success 'apply submodule diff' '
git branch second &&
(
cd lib &&
cd init &&
echo s >s &&
git add s &&
git commit -m "change subproject"
) &&
git update-index --add lib &&
git-commit -m "change lib" &&
git update-index --add init &&
git-commit -m "change init" &&
git-format-patch -1 --stdout >P.diff &&
git checkout second &&
git apply --index P.diff &&

View File

@@ -33,19 +33,28 @@ CVS_SERVER=git-cvsserver
export CVSROOT CVS_SERVER
rm -rf "$CVSWORK" "$SERVERDIR"
echo >empty &&
test_expect_success 'setup' '
echo >empty &&
git add empty &&
git commit -q -m "First Commit" &&
mkdir secondroot &&
( cd secondroot &&
git init &&
touch secondrootfile &&
git add secondrootfile &&
git commit -m "second root") &&
git pull secondroot master &&
git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
exit 1
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log"
'
# note that cvs doesn't accept absolute pathnames
# as argument to co -d
test_expect_success 'basic checkout' \
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"'
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/"
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | tail -n 1))" = "secondrootfile/1.1/"'
#------------------------
# PSERVER AUTHENTICATION

View File

@@ -19,6 +19,7 @@ int main(int argc, const char **argv)
OPT_STRING('s', "string", &string, "string", "get a string"),
OPT_STRING(0, "string2", &string, "str", "get another string"),
OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
OPT_STRING('o', NULL, &string, "str", "get another string"),
OPT_END(),
};
int i;