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

This commit is contained in:
Johannes Sixt
2009-10-05 08:27:33 +02:00
21 changed files with 124 additions and 63 deletions

View File

@@ -12,6 +12,7 @@ SYNOPSIS
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
[--prune-empty]
[--original <namespace>] [-d <directory>] [-f | --force]
[--] [<rev-list options>...]

View File

@@ -106,7 +106,7 @@ much time is spent optimizing the delta compression of the objects in
the repository when the --aggressive option is specified. The larger
the value, the more time is spent optimizing the delta compression. See
the documentation for the --window' option in linkgit:git-repack[1] for
more details. This defaults to 10.
more details. This defaults to 250.
The optional configuration variable 'gc.pruneExpire' controls how old
the unreferenced loose objects have to be before they are pruned. The

View File

@@ -329,24 +329,28 @@ static void remove_junk_on_signal(int signo)
raise(signo);
}
static struct ref *write_remote_refs(const struct ref *refs,
struct refspec *refspec, const char *reflog)
static struct ref *wanted_peer_refs(const struct ref *refs,
struct refspec *refspec)
{
struct ref *local_refs = NULL;
struct ref **tail = &local_refs;
struct ref *r;
get_fetch_map(refs, refspec, &tail, 0);
if (!option_mirror)
get_fetch_map(refs, tag_refspec, &tail, 0);
return local_refs;
}
static void write_remote_refs(const struct ref *local_refs)
{
const struct ref *r;
for (r = local_refs; r; r = r->next)
add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
pack_refs(PACK_REFS_ALL);
clear_extra_refs();
return local_refs;
}
int cmd_clone(int argc, const char **argv, const char *prefix)
@@ -495,9 +499,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_reset(&value);
if (path && !is_bundle)
if (path && !is_bundle) {
refs = clone_local(path, git_dir);
else {
mapped_refs = wanted_peer_refs(refs, refspec);
} else {
struct remote *remote = remote_get(argv[0]);
transport = transport_get(remote, remote->url[0]);
@@ -520,14 +525,16 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
option_upload_pack);
refs = transport_get_remote_refs(transport);
if (refs)
transport_fetch_refs(transport, refs);
if (refs) {
mapped_refs = wanted_peer_refs(refs, refspec);
transport_fetch_refs(transport, mapped_refs);
}
}
if (refs) {
clear_extra_refs();
mapped_refs = write_remote_refs(refs, refspec, reflog_msg.buf);
write_remote_refs(mapped_refs);
remote_head = find_ref_by_name(refs, "HEAD");
remote_head_points_at =

View File

@@ -785,8 +785,10 @@ static int handle_commit_msg(struct strbuf *line)
if (use_scissors && is_scissors_line(line)) {
int i;
rewind(cmitmsg);
ftruncate(fileno(cmitmsg), 0);
if (fseek(cmitmsg, 0L, SEEK_SET))
die_errno("Could not rewind output message file");
if (ftruncate(fileno(cmitmsg), 0))
die_errno("Could not truncate output message file at scissors");
still_looking = 1;
/*

View File

@@ -489,6 +489,7 @@ struct lock_file {
};
#define LOCK_DIE_ON_ERROR 1
#define LOCK_NODEREF 2
extern int unable_to_lock_error(const char *path, int err);
extern NORETURN void unable_to_lock_index_die(const char *path, int err);
extern int hold_lock_file_for_update(struct lock_file *, const char *path, int);
extern int hold_lock_file_for_append(struct lock_file *, const char *path, int);

View File

@@ -9,7 +9,7 @@
* Default version that the compiler ought to optimize properly with
* constant values.
*/
static inline unsigned int default_swab32(unsigned int val)
static inline uint32_t default_swab32(uint32_t val)
{
return (((val & 0xff000000) >> 24) |
((val & 0x00ff0000) >> 8) |
@@ -20,7 +20,7 @@ static inline unsigned int default_swab32(unsigned int val)
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define bswap32(x) ({ \
unsigned int __res; \
uint32_t __res; \
if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \
} else { \

View File

@@ -131,6 +131,7 @@ sub createLibProject {
$includes =~ s/-I//g;
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
binmode F, ":crlf";
print F << "EOM";
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
@@ -173,7 +174,7 @@ sub createLibProject {
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$includes"
PreprocessorDefinitions="UNICODE,WIN32,_DEBUG,$defines"
PreprocessorDefinitions="WIN32,_DEBUG,$defines"
MinimalRebuild="true"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -239,7 +240,7 @@ sub createLibProject {
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="$includes"
PreprocessorDefinitions="UNICODE,WIN32,NDEBUG,$defines"
PreprocessorDefinitions="WIN32,NDEBUG,$defines"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -353,6 +354,7 @@ sub createAppProject {
$includes =~ s/-I//g;
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
binmode F, ":crlf";
print F << "EOM";
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
@@ -395,7 +397,7 @@ sub createAppProject {
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="$includes"
PreprocessorDefinitions="UNICODE,WIN32,_DEBUG,$defines"
PreprocessorDefinitions="WIN32,_DEBUG,$defines"
MinimalRebuild="true"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -466,7 +468,7 @@ sub createAppProject {
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="$includes"
PreprocessorDefinitions="UNICODE,WIN32,NDEBUG,$defines"
PreprocessorDefinitions="WIN32,NDEBUG,$defines"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -537,7 +539,7 @@ sub createGlueProject {
print "Generate solutions file\n";
$rel_dir = "..\\$rel_dir";
$rel_dir =~ s/\//\\/g;
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 10.00\n";
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 10.00\n# Visual Studio 2008\n";
my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
my $SLN_POST = "\nEndProject\n";
@@ -560,6 +562,7 @@ sub createGlueProject {
@apps = @tmp;
open F, ">git.sln" || die "Could not open git.sln for writing!\n";
binmode F, ":crlf";
print F "$SLN_HEAD";
foreach (@libs) {
my $libname = $_;
@@ -568,45 +571,29 @@ sub createGlueProject {
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
print F "$SLN_POST";
}
my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
print F "$SLN_PRE";
print F "\"${appname}\", \"${appname}\\${appname}.vcproj\", \"${uuid}\"";
print F "\"${appname}\", \"${appname}\\${appname}.vcproj\", \"${uuid}\"\n";
print F " ProjectSection(ProjectDependencies) = postProject\n";
print F " ${uuid_libgit} = ${uuid_libgit}\n";
print F " ${uuid_xdiff_lib} = ${uuid_xdiff_lib}\n";
print F " EndProjectSection";
print F "$SLN_POST";
}
print F << "EOM";
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug|Win32
ConfigName.1 = Release|Win32
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EOM
foreach (@{$build_structure{"APPS"}}) {
my $appname = $_;
my $appname_clean = $_;
$appname_clean =~ s/\//_/g;
$appname_clean =~ s/\.exe//;
my $uuid = $build_structure{"APPS_${appname_clean}_GUID"};
my $dep_index = 0;
foreach(@{$build_structure{"APPS_${appname}_LIBS"}}) {
my $libname = $_;
$libname =~ s/\//_/g;
$libname =~ s/\.(a|lib)//;
my $libuuid = $build_structure{"LIBS_${libname}_GUID"};
if (defined $libuuid) {
print F "\t\t${uuid}.${dep_index} = ${libuuid}\n";
$dep_index += 1;
}
}
}
print F << "EOM";
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
GlobalSection(ProjectConfigurationPlatforms) = postSolution
EOM
foreach (@libs) {
my $libname = $_;
@@ -627,10 +614,6 @@ EOM
print F << "EOM";
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
EOM
close F;

View File

@@ -810,7 +810,21 @@ _git_checkout ()
{
__git_has_doubledash && return
__gitcomp "$(__git_refs)"
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--conflict=*)
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
;;
--*)
__gitcomp "
--quiet --ours --theirs --track --no-track --merge
--conflict= --patch
"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_cherry ()

2
date.c
View File

@@ -123,7 +123,7 @@ const char *show_date_relative(unsigned long time, int tz,
return timebuf;
}
/* Say months for the past 12 months or so */
if (diff < 360) {
if (diff < 365) {
snprintf(timebuf, timebuf_size, "%lu months ago", (diff + 15) / 30);
return timebuf;
}

View File

@@ -921,7 +921,7 @@ X-Mailer: git-send-email $gitversion
$smtp ||= Net::SMTP->new((defined $smtp_server_port)
? "$smtp_server:$smtp_server_port"
: $smtp_server);
if ($smtp_encryption eq 'tls') {
if ($smtp_encryption eq 'tls' && $smtp) {
require Net::SMTP::SSL;
$smtp->command('STARTTLS');
$smtp->response();

View File

@@ -98,7 +98,7 @@ module_clone()
if test -d "$path"
then
rmdir "$path" 2>/dev/null ||
die "Directory '$path' exist, but is neither empty nor a git repository"
die "Directory '$path' exists, but is neither empty nor a git repository"
fi
test -e "$path" &&

View File

@@ -155,18 +155,32 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
return lk->fd;
}
NORETURN void unable_to_lock_index_die(const char *path, int err)
static char *unable_to_lock_message(const char *path, int err)
{
struct strbuf buf = STRBUF_INIT;
if (err == EEXIST) {
die("Unable to create '%s.lock': %s.\n\n"
strbuf_addf(&buf, "Unable to create '%s.lock': %s.\n\n"
"If no other git process is currently running, this probably means a\n"
"git process crashed in this repository earlier. Make sure no other git\n"
"process is running and remove the file manually to continue.",
path, strerror(err));
} else {
die("Unable to create '%s.lock': %s", path, strerror(err));
}
} else
strbuf_addf(&buf, "Unable to create '%s.lock': %s", path, strerror(err));
return strbuf_detach(&buf, NULL);
}
int unable_to_lock_error(const char *path, int err)
{
char *msg = unable_to_lock_message(path, err);
error("%s", msg);
free(msg);
return -1;
}
NORETURN void unable_to_lock_index_die(const char *path, int err)
{
die("%s", unable_to_lock_message(path, err));
}
int hold_lock_file_for_update(struct lock_file *lk, const char *path, int flags)

View File

@@ -230,6 +230,9 @@ is_abbreviated:
abbrev_flags = flags;
continue;
}
/* negation allowed? */
if (options->flags & PARSE_OPT_NONEG)
continue;
/* negated and abbreviated very much? */
if (!prefixcmp("no-", arg)) {
flags |= OPT_UNSET;

View File

@@ -5,6 +5,14 @@ sub MY::postamble {
instlibdir:
@echo '$(INSTALLSITELIB)'
ifneq (,$(DESTDIR))
ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))
$(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
is likely incompatible with the DESTDIR mechanism. Try setting \
NO_PERL_MAKEMAKER=1 instead)
endif
endif
MAKE_FRAG
}

4
refs.c
View File

@@ -972,8 +972,10 @@ static int repack_without_ref(const char *refname)
if (!found)
return 0;
fd = hold_lock_file_for_update(&packlock, git_path("packed-refs"), 0);
if (fd < 0)
if (fd < 0) {
unable_to_lock_error(git_path("packed-refs"), errno);
return error("cannot delete '%s' from packed refs", refname);
}
for (list = packed_ref_list; list; list = list->next) {
char line[PATH_MAX + 100];

View File

@@ -24,6 +24,7 @@ check_show 13000000 '5 months ago'
check_show 37500000 '1 year, 2 months ago'
check_show 55188000 '1 year, 9 months ago'
check_show 630000000 '20 years ago'
check_show 31449600 '12 months ago'
check_parse() {
echo "$1 -> $2" >expect

View File

@@ -33,6 +33,8 @@ Magic arguments
--quux means --quux
-NUM set integer to NUM
+ same as -b
--ambiguous positive ambiguity
--no-ambiguous negative ambiguity
Standard options
--abbrev[=<n>] use <n> digits to display SHA-1s
@@ -315,4 +317,22 @@ test_expect_success 'OPT_NUMBER_CALLBACK() works' '
test_cmp expect output
'
cat >expect <<EOF
boolean: 0
integer: 0
timestamp: 0
string: (not set)
abbrev: 7
verbose: 0
quiet: no
dry run: no
file: (not set)
EOF
test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
test-parse-options --no-ambig >output 2>output.err &&
test ! -s output.err &&
test_cmp expect output
'
test_done

0
t/t5531-deep-submodule-push.sh Normal file → Executable file
View File

0
t/t9501-gitweb-standalone-http-status.sh Normal file → Executable file
View File

View File

@@ -9,7 +9,7 @@
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
#
# see contrib/hooks/ for an sample, or uncomment the next line and
# see contrib/hooks/ for a sample, or uncomment the next line and
# rename the file to "post-receive".
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email

View File

@@ -8,6 +8,7 @@ static int abbrev = 7;
static int verbose = 0, dry_run = 0, quiet = 0;
static char *string = NULL;
static char *file = NULL;
static int ambiguous;
static int length_callback(const struct option *opt, const char *arg, int unset)
{
@@ -59,6 +60,10 @@ int main(int argc, const char **argv)
number_callback),
{ OPTION_BOOLEAN, '+', NULL, &boolean, NULL, "same as -b",
PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH },
{ OPTION_BOOLEAN, 0, "ambiguous", &ambiguous, NULL,
"positive ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
{ OPTION_BOOLEAN, 0, "no-ambiguous", &ambiguous, NULL,
"negative ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
OPT_GROUP("Standard options"),
OPT__ABBREV(&abbrev),
OPT__VERBOSE(&verbose),