summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-clone.txt15
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--Makefile4
-rw-r--r--archive-tar.c1
-rw-r--r--archive-zip.c1
-rw-r--r--blob.c1
-rw-r--r--builtin-add.c7
-rw-r--r--builtin-apply.c1
-rw-r--r--builtin-archive.c1
-rw-r--r--builtin-blame.c4
-rw-r--r--builtin-branch.c2
-rw-r--r--builtin-for-each-ref.c1
-rw-r--r--builtin-grep.c3
-rw-r--r--builtin-init-db.c7
-rw-r--r--builtin-log.c2
-rw-r--r--builtin-ls-files.c2
-rw-r--r--builtin-mailinfo.c9
-rw-r--r--builtin-mailsplit.c7
-rw-r--r--builtin-mv.c2
-rw-r--r--builtin-name-rev.c1
-rw-r--r--builtin-pack-objects.c2
-rw-r--r--builtin-repo-config.c5
-rw-r--r--builtin-runstatus.c2
-rw-r--r--builtin-shortlog.c1
-rw-r--r--builtin-show-branch.c2
-rw-r--r--builtin-stripspace.c3
-rw-r--r--builtin-tar-tree.c1
-rw-r--r--builtin-unpack-objects.c2
-rw-r--r--builtin-upload-archive.c3
-rw-r--r--cache.h4
-rw-r--r--color.c5
-rw-r--r--compat/inet_ntop.c2
-rw-r--r--compat/mmap.c4
-rw-r--r--compat/setenv.c3
-rw-r--r--compat/strlcpy.c2
-rw-r--r--compat/unsetenv.c3
-rw-r--r--config.c32
-rw-r--r--configure.ac4
-rw-r--r--connect.c6
-rw-r--r--convert-objects.c4
-rw-r--r--daemon.c16
-rw-r--r--date.c3
-rw-r--r--diff-delta.c5
-rw-r--r--diff.c5
-rw-r--r--diffcore-order.c1
-rw-r--r--diffcore-pickaxe.c2
-rw-r--r--dir.c3
-rw-r--r--entry.c2
-rw-r--r--exec_cmd.c4
-rw-r--r--fetch-pack.c1
-rw-r--r--fetch.c3
-rw-r--r--fsck-objects.c3
-rwxr-xr-xgit-clone.sh61
-rw-r--r--git-compat-util.h25
-rwxr-xr-xgit-cvsserver.perl2
-rwxr-xr-xgit-parse-remote.sh13
-rwxr-xr-xgit-pull.sh4
-rw-r--r--git.c14
-rwxr-xr-xgitweb/gitweb.perl11
-rw-r--r--grep.c1
-rw-r--r--help.c3
-rw-r--r--ident.c3
-rw-r--r--imap-send.c7
-rw-r--r--index-pack.c24
-rw-r--r--interpolate.c2
-rw-r--r--lockfile.c1
-rw-r--r--merge-base.c1
-rw-r--r--merge-index.c4
-rw-r--r--merge-recursive.c9
-rw-r--r--path-list.c1
-rw-r--r--path.c1
-rw-r--r--receive-pack.c1
-rw-r--r--refs.c4
-rw-r--r--revision.c1
-rw-r--r--rsh.c6
-rw-r--r--run-command.c1
-rw-r--r--sha1_file.c4
-rw-r--r--ssh-upload.c2
-rw-r--r--strbuf.c4
-rwxr-xr-xt/t5510-fetch.sh7
-rwxr-xr-xt/test-lib.sh3
-rw-r--r--templates/remotes--1
-rw-r--r--test-date.c3
-rw-r--r--test-delta.c8
-rw-r--r--tree.c1
-rw-r--r--unpack-trees.c2
-rw-r--r--upload-pack.c3
-rw-r--r--var.c3
-rw-r--r--wt-status.c2
89 files changed, 137 insertions, 317 deletions
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index bfddb21fee..874934a332 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -11,8 +11,7 @@ SYNOPSIS
[verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
- [--use-separate-remote | --no-separate-remote] <repository>
- [<directory>]
+ <repository> [<directory>]
DESCRIPTION
-----------
@@ -99,18 +98,6 @@ OPTIONS
if unset the templates are taken from the installation
defined default, typically `/usr/share/git-core/templates`.
---use-separate-remote::
- Save remotes heads under `$GIT_DIR/refs/remotes/origin/` instead
- of `$GIT_DIR/refs/heads/`. Only the local master branch is
- saved in the latter. This is the default.
-
---no-separate-remote::
- Save remotes heads in the same namespace as the local
- heads, `$GIT_DIR/refs/heads/'. In regular repositories,
- this is a legacy setup git-clone created by default in
- older Git versions, and will be removed before the next
- major release.
-
<repository>::
The (possibly remote) repository to clone from. It can
be any URL git-fetch supports.
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 4eac314f3a..eca1ff2175 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v1.4.4.1.GIT
+DEF_VER=v1.4.4.GIT
LF='
'
diff --git a/Makefile b/Makefile
index 8919dabc78..76511045a8 100644
--- a/Makefile
+++ b/Makefile
@@ -82,10 +82,6 @@ all:
# Define NO_ACCURATE_DIFF if your diff program at least sometimes misses
# a missing newline at the end of the file.
#
-# Define COLLISION_CHECK below if you believe that SHA1's
-# 1461501637330902918203684832716283019655932542976 hashes do not give you
-# sufficient guarantee that no collisions between objects will ever happen.
-#
# 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
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
diff --git a/archive-tar.c b/archive-tar.c
index ff0f6e2929..af47fdc955 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2005, 2006 Rene Scharfe
*/
-#include <time.h>
#include "cache.h"
#include "commit.h"
#include "strbuf.h"
diff --git a/archive-zip.c b/archive-zip.c
index 36e922a1f2..f31b8ed823 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2006 Rene Scharfe
*/
-#include <time.h>
#include "cache.h"
#include "commit.h"
#include "blob.h"
diff --git a/blob.c b/blob.c
index d1af2e62f1..9776beac58 100644
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
#include "cache.h"
#include "blob.h"
-#include <stdlib.h>
const char *blob_type = "blob";
diff --git a/builtin-add.c b/builtin-add.c
index b3f920676a..f306f82b16 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -3,8 +3,6 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
-#include <fnmatch.h>
-
#include "cache.h"
#include "builtin.h"
#include "dir.h"
@@ -113,6 +111,11 @@ int cmd_add(int argc, const char **argv, const char *prefix)
}
usage(builtin_add_usage);
}
+ if (argc <= i) {
+ fprintf(stderr, "Nothing specified, nothing added.\n");
+ fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
+ return 0;
+ }
pathspec = get_pathspec(prefix, argv + i);
fill_directory(&dir, pathspec);
diff --git a/builtin-apply.c b/builtin-apply.c
index 436d9e1880..1c35837068 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -6,7 +6,6 @@
* This applies patches on top of some (arbitrary) version of the SCM.
*
*/
-#include <fnmatch.h>
#include "cache.h"
#include "cache-tree.h"
#include "quote.h"
diff --git a/builtin-archive.c b/builtin-archive.c
index a8a1f079bf..391cf43911 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -2,7 +2,6 @@
* Copyright (c) 2006 Franck Bui-Huu
* Copyright (c) 2006 Rene Scharfe
*/
-#include <time.h>
#include "cache.h"
#include "builtin.h"
#include "archive.h"
diff --git a/builtin-blame.c b/builtin-blame.c
index a250724463..9bf6ec951f 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -15,10 +15,6 @@
#include "revision.h"
#include "xdiff-interface.h"
-#include <time.h>
-#include <sys/time.h>
-#include <regex.h>
-
static char blame_usage[] =
"git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\n"
" -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
diff --git a/builtin-branch.c b/builtin-branch.c
index 011ef3a265..903d5cf056 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -5,8 +5,8 @@
* Based on git-branch.sh by Junio C Hamano.
*/
-#include "color.h"
#include "cache.h"
+#include "color.h"
#include "refs.h"
#include "commit.h"
#include "builtin.h"
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 227aa3cd7f..af72a12a57 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -6,7 +6,6 @@
#include "tree.h"
#include "blob.h"
#include "quote.h"
-#include <fnmatch.h>
/* Quoting styles */
#define QUOTE_NONE 0
diff --git a/builtin-grep.c b/builtin-grep.c
index 9873e3d1db..3b1b1cbbfa 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -10,10 +10,7 @@
#include "tag.h"
#include "tree-walk.h"
#include "builtin.h"
-#include <regex.h>
#include "grep.h"
-#include <fnmatch.h>
-#include <sys/wait.h>
/*
* git grep pathspecs are somewhat different from diff-tree pathspecs;
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 1d7d15e8d5..01f366ad0b 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -124,8 +124,11 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
int template_len;
DIR *dir;
- if (!template_dir)
- template_dir = DEFAULT_GIT_TEMPLATE_DIR;
+ if (!template_dir) {
+ template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT);
+ if (!template_dir)
+ template_dir = DEFAULT_GIT_TEMPLATE_DIR;
+ }
strcpy(template_path, template_dir);
template_len = strlen(template_path);
if (template_path[template_len-1] != '/') {
diff --git a/builtin-log.c b/builtin-log.c
index 17014f70a2..8df3c1394a 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -11,8 +11,6 @@
#include "log-tree.h"
#include "builtin.h"
#include "tag.h"
-#include <time.h>
-#include <sys/time.h>
static int default_show_root = 1;
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index bc79ce40fc..21c2a6e2d9 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -5,8 +5,6 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#include <fnmatch.h>
-
#include "cache.h"
#include "quote.h"
#include "dir.h"
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b8d7dbc0b7..e6472293d4 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -2,15 +2,6 @@
* Another stupid program, this one parsing the headers of an
* email to figure out authorship and subject
*/
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef NO_ICONV
-#include <iconv.h>
-#endif
-#include "git-compat-util.h"
#include "cache.h"
#include "builtin.h"
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 91a699d34d..3bca855aae 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -4,13 +4,6 @@
* It just splits a mbox into a list of files: "0001" "0002" ..
* so you can process them further from there.
*/
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
#include "cache.h"
#include "builtin.h"
diff --git a/builtin-mv.c b/builtin-mv.c
index d14a4a7f5c..737af350b8 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -3,8 +3,6 @@
*
* Copyright (C) 2006 Johannes Schindelin
*/
-#include <fnmatch.h>
-
#include "cache.h"
#include "builtin.h"
#include "dir.h"
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 618aa314d2..b4f15cc38a 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -1,4 +1,3 @@
-#include <stdlib.h>
#include "builtin.h"
#include "cache.h"
#include "commit.h"
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index a2dc7d1d9d..807be8c3f8 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -12,8 +12,6 @@
#include "diff.h"
#include "revision.h"
#include "list-objects.h"
-#include <sys/time.h>
-#include <signal.h>
static const char pack_usage[] = "\
git-pack-objects [{ -q | --progress | --all-progress }] \n\
diff --git a/builtin-repo-config.c b/builtin-repo-config.c
index a38099a63d..90633119d4 100644
--- a/builtin-repo-config.c
+++ b/builtin-repo-config.c
@@ -1,6 +1,5 @@
#include "builtin.h"
#include "cache.h"
-#include <regex.h>
static const char git_config_set_usage[] =
"git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
@@ -67,10 +66,10 @@ static int get_value(const char* key_, const char* regex_)
char *global = NULL, *repo_config = NULL;
const char *local;
- local = getenv("GIT_CONFIG");
+ local = getenv(CONFIG_ENVIRONMENT);
if (!local) {
const char *home = getenv("HOME");
- local = getenv("GIT_CONFIG_LOCAL");
+ local = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!local)
local = repo_config = xstrdup(git_path("config"));
if (home)
diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index 0b63037dd0..4b489b1214 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -1,5 +1,5 @@
-#include "wt-status.h"
#include "cache.h"
+#include "wt-status.h"
extern int wt_status_use_color;
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 3fc43dd7dd..edb40429ec 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -4,7 +4,6 @@
#include "diff.h"
#include "path-list.h"
#include "revision.h"
-#include <string.h>
static const char shortlog_usage[] =
"git-shortlog [-n] [-s] [<commit-id>... ]";
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index a38ac34efb..b9d9781d4d 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -1,5 +1,3 @@
-#include <stdlib.h>
-#include <fnmatch.h>
#include "cache.h"
#include "commit.h"
#include "refs.h"
diff --git a/builtin-stripspace.c b/builtin-stripspace.c
index 09cc9108cd..f0d4d9e2d1 100644
--- a/builtin-stripspace.c
+++ b/builtin-stripspace.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
#include "builtin.h"
/*
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index 4d4cfec878..11e62fc141 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2005, 2006 Rene Scharfe
*/
-#include <time.h>
#include "cache.h"
#include "commit.h"
#include "tar.h"
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index e6d7574844..d351e02649 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -8,8 +8,6 @@
#include "tag.h"
#include "tree.h"
-#include <sys/time.h>
-
static int dry_run, quiet, recover, has_errors;
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] < pack-file";
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 45c92e163c..e4156f8f48 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -1,9 +1,6 @@
/*
* Copyright (c) 2006 Franck Bui-Huu
*/
-#include <time.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
#include "cache.h"
#include "builtin.h"
#include "archive.h"
diff --git a/cache.h b/cache.h
index 8ad5920d2b..4943056c19 100644
--- a/cache.h
+++ b/cache.h
@@ -122,6 +122,10 @@ extern int cache_errno;
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
+#define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
+#define CONFIG_ENVIRONMENT "GIT_CONFIG"
+#define CONFIG_LOCAL_ENVIRONMENT "GIT_CONFIG_LOCAL"
+#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
extern int is_bare_git_dir(const char *dir);
extern const char *get_git_dir(void);
diff --git a/color.c b/color.c
index d8c8399d59..09d82eec3d 100644
--- a/color.c
+++ b/color.c
@@ -1,8 +1,5 @@
-#include "color.h"
#include "cache.h"
-#include "git-compat-util.h"
-
-#include <stdarg.h>
+#include "color.h"
#define COLOR_RESET "\033[m"
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index ec8c1bff53..4d7ab9d975 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -93,7 +93,7 @@ inet_ntop6(src, dst, size)
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
- u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
+ unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
/*
diff --git a/compat/mmap.c b/compat/mmap.c
index a4d2e507f7..0fd46e793d 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -1,7 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
#include "../git-compat-util.h"
void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
diff --git a/compat/setenv.c b/compat/setenv.c
index b7d7678598..3a22ea7b75 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
int gitsetenv(const char *name, const char *value, int replace)
{
diff --git a/compat/strlcpy.c b/compat/strlcpy.c
index b66856a3a5..4024c36030 100644
--- a/compat/strlcpy.c
+++ b/compat/strlcpy.c
@@ -1,4 +1,4 @@
-#include <string.h>
+#include "../git-compat-util.h"
size_t gitstrlcpy(char *dest, const char *src, size_t size)
{
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index 3a5e4ec04a..eb29f5e084 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
void gitunsetenv (const char *name)
{
diff --git a/config.c b/config.c
index 663993fefa..1662a4626e 100644
--- a/config.c
+++ b/config.c
@@ -6,7 +6,6 @@
*
*/
#include "cache.h"
-#include <regex.h>
#define MAXNAME (256)
@@ -350,10 +349,10 @@ int git_config(config_fn_t fn)
* $GIT_CONFIG_LOCAL will make it process it in addition to the
* global config file, the same way it would the per-repository
* config file otherwise. */
- filename = getenv("GIT_CONFIG");
+ filename = getenv(CONFIG_ENVIRONMENT);
if (!filename) {
home = getenv("HOME");
- filename = getenv("GIT_CONFIG_LOCAL");
+ filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!filename)
filename = repo_config = xstrdup(git_path("config"));
}
@@ -544,9 +543,9 @@ int git_config_set_multivar(const char* key, const char* value,
char* lock_file;
const char* last_dot = strrchr(key, '.');
- config_filename = getenv("GIT_CONFIG");
+ config_filename = getenv(CONFIG_ENVIRONMENT);
if (!config_filename) {
- config_filename = getenv("GIT_CONFIG_LOCAL");
+ config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!config_filename)
config_filename = git_path("config");
}
@@ -749,24 +748,28 @@ out_free:
int git_config_rename_section(const char *old_name, const char *new_name)
{
int ret = 0;
- const char *config_filename;
+ char *config_filename;
struct lock_file *lock = xcalloc(sizeof(struct lock_file), 1);
int out_fd;
char buf[1024];
- config_filename = getenv("GIT_CONFIG");
+ config_filename = getenv(CONFIG_ENVIRONMENT);
if (!config_filename) {
- config_filename = getenv("GIT_CONFIG_LOCAL");
+ config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!config_filename)
config_filename = git_path("config");
}
config_filename = xstrdup(config_filename);
out_fd = hold_lock_file_for_update(lock, config_filename, 0);
- if (out_fd < 0)
- return error("Could not lock config file!");
+ if (out_fd < 0) {
+ ret = error("Could not lock config file!");
+ goto out;
+ }
- if (!(config_file = fopen(config_filename, "rb")))
- return error("Could not open config file!");
+ if (!(config_file = fopen(config_filename, "rb"))) {
+ ret = error("Could not open config file!");
+ goto out;
+ }
while (fgets(buf, sizeof(buf), config_file)) {
int i;
@@ -806,8 +809,11 @@ int git_config_rename_section(const char *old_name, const char *new_name)
}
write(out_fd, buf, strlen(buf));
}
+ fclose(config_file);
if (close(out_fd) || commit_lock_file(lock) < 0)
- return error("Cannot commit config file!");
+ ret = error("Cannot commit config file!");
+ out:
+ free(config_filename);
return ret;
}
diff --git a/configure.ac b/configure.ac
index 34e34789bd..e153d53823 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,10 +316,6 @@ GIT_PARSE_WITH(iconv))
## --enable-FEATURE[=ARG] and --disable-FEATURE
#
-# Define COLLISION_CHECK below if you believe that SHA1's
-# 1461501637330902918203684832716283019655932542976 hashes do not give you
-# sufficient guarantee that no collisions between objects will ever happen.
-#
# 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
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
diff --git a/connect.c b/connect.c
index f7edba82c4..66daa11a57 100644
--- a/connect.c
+++ b/connect.c
@@ -3,12 +3,6 @@
#include "pkt-line.h"
#include "quote.h"
#include "refs.h"
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <signal.h>
static char *server_capabilities;
diff --git a/convert-objects.c b/convert-objects.c
index 881258311a..a630132985 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -1,7 +1,3 @@
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
-#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
-#define _GNU_SOURCE
-#include <time.h>
#include "cache.h"
#include "blob.h"
#include "commit.h"
diff --git a/daemon.c b/daemon.c
index e66bb802da..b129b83e40 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1,20 +1,10 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/poll.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <syslog.h>
-#include <pwd.h>
-#include <grp.h>
-#include <limits.h>
-#include "pkt-line.h"
#include "cache.h"
+#include "pkt-line.h"
#include "exec_cmd.h"
#include "interpolate.h"
+#include <syslog.h>
+
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 256
#endif
diff --git a/date.c b/date.c
index 1825922732..7acb8cbd91 100644
--- a/date.c
+++ b/date.c
@@ -4,9 +4,6 @@
* Copyright (C) Linus Torvalds, 2005
*/
-#include <time.h>
-#include <sys/time.h>
-
#include "cache.h"
static time_t my_mktime(struct tm *tm)
diff --git a/diff-delta.c b/diff-delta.c
index fa16d06c8d..9f998d0a73 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -18,11 +18,8 @@
* licensing gets turned into GPLv2 within this project.
*/
-#include <stdlib.h>
-#include <string.h>
-#include "delta.h"
-
#include "git-compat-util.h"
+#include "delta.h"
/* maximum hash entry list for the same hash bucket */
#define HASH_LIMIT 64
diff --git a/diff.c b/diff.c
index 99744354a7..91f956b23b 100644
--- a/diff.c
+++ b/diff.c
@@ -1,9 +1,6 @@
/*
* Copyright (C) 2005 Junio C Hamano
*/
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
#include "cache.h"
#include "quote.h"
#include "diff.h"
@@ -1223,7 +1220,7 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
* objects however would tend to be slower as they need
* to be individually opened and inflated.
*/
- if (FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
+ if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
return 0;
len = strlen(name);
diff --git a/diffcore-order.c b/diffcore-order.c
index aef6da6044..7ad0946185 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -4,7 +4,6 @@
#include "cache.h"
#include "diff.h"
#include "diffcore.h"
-#include <fnmatch.h>
static char **order;
static int order_cnt;
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index cfcce315ba..de44adabf0 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -5,8 +5,6 @@
#include "diff.h"
#include "diffcore.h"
-#include <regex.h>
-
static unsigned int contains(struct diff_filespec *one,
const char *needle, unsigned long len,
regex_t *regexp)
diff --git a/dir.c b/dir.c
index e6a61ee913..16401d8017 100644
--- a/dir.c
+++ b/dir.c
@@ -5,9 +5,6 @@
* Copyright (C) Linus Torvalds, 2005-2006
* Junio Hamano, 2005-2006
*/
-#include <dirent.h>
-#include <fnmatch.h>
-
#include "cache.h"
#include "dir.h"
diff --git a/entry.c b/entry.c
index b2ea0efa82..88df713947 100644
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
#include "cache.h"
#include "blob.h"
diff --git a/exec_cmd.c b/exec_cmd.c
index 5d6a1247b4..3996bce33f 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -21,7 +21,7 @@ const char *git_exec_path(void)
if (current_exec_path)
return current_exec_path;
- env = getenv("GIT_EXEC_PATH");
+ env = getenv(EXEC_PATH_ENVIRONMENT);
if (env && *env) {
return env;
}
@@ -35,7 +35,7 @@ int execv_git_cmd(const char **argv)
char git_command[PATH_MAX + 1];
int i;
const char *paths[] = { current_exec_path,
- getenv("GIT_EXEC_PATH"),
+ getenv(EXEC_PATH_ENVIRONMENT),
builtin_exec_path };
for (i = 0; i < ARRAY_SIZE(paths); ++i) {
diff --git a/fetch-pack.c b/fetch-pack.c
index 743eab7efa..92322cf4da 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -5,7 +5,6 @@
#include "tag.h"
#include "exec_cmd.h"
#include "sideband.h"
-#include <sys/wait.h>
static int keep_pack;
static int quiet;
diff --git a/fetch.c b/fetch.c
index 663b4b2f42..f69be82f10 100644
--- a/fetch.c
+++ b/fetch.c
@@ -1,6 +1,5 @@
-#include "fetch.h"
-
#include "cache.h"
+#include "fetch.h"
#include "commit.h"
#include "tree.h"
#include "tree-walk.h"
diff --git a/fsck-objects.c b/fsck-objects.c
index 46b628cb94..409aea02b4 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -1,6 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
-
#include "cache.h"
#include "commit.h"
#include "tree.h"
diff --git a/git-clone.sh b/git-clone.sh
index 1f5d07a057..490f3e48db 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -14,7 +14,7 @@ die() {
}
usage() {
- die "Usage: $0 [--template=<template_directory>] [--no-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
+ die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
}
get_repo_base() {
@@ -137,11 +137,9 @@ while
*,--template=*)
template="$1" ;;
*,-q|*,--quiet) quiet=-q ;;
- *,--use-separate-remote)
- # default
- use_separate_remote=t ;;
+ *,--use-separate-remote) ;;
*,--no-separate-remote)
- use_separate_remote= ;;
+ die "clones are always made with separate-remote layout" ;;
1,--reference) usage ;;
*,--reference)
shift; reference="$1" ;;
@@ -327,12 +325,8 @@ cd "$D" || exit
if test -z "$bare" && test -f "$GIT_DIR/REMOTE_HEAD"
then
- # Figure out which remote branch HEAD points at.
- case "$use_separate_remote" in
- '') remote_top=refs/heads ;;
- *) remote_top="refs/remotes/$origin" ;;
- esac
-
+ # a non-bare repository is always in separate-remote layout
+ remote_top="refs/remotes/$origin"
head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
case "$head_sha1" in
'ref: refs/'*)
@@ -366,41 +360,26 @@ then
)
)
- # Write out remotes/$origin file, and update our "$head_points_at".
+ # Write out remote.$origin config, and update our "$head_points_at".
case "$head_points_at" in
?*)
- mkdir -p "$GIT_DIR/remotes" &&
+ # Local default branch
git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
- case "$use_separate_remote" in
- t) origin_track="$remote_top/$head_points_at"
- git-update-ref HEAD "$head_sha1" ;;
- *) origin_track="$remote_top/$origin"
- git-update-ref "refs/heads/$origin" "$head_sha1" ;;
- esac &&
+
+ # Tracking branch for the primary branch at the remote.
+ origin_track="$remote_top/$head_points_at" &&
+ git-update-ref HEAD "$head_sha1" &&
+
+ # Upstream URL
git-repo-config remote."$origin".url "$repo" &&
+
+ # Set up the mappings to track the remote branches.
git-repo-config remote."$origin".fetch \
- "refs/heads/$head_points_at:$origin_track" &&
- (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
- while read dotslref
- do
- name=`expr "$dotslref" : './\(.*\)'`
- if test "z$head_points_at" = "z$name"
- then
- continue
- fi
- if test "$use_separate_remote" = '' &&
- test "z$origin" = "z$name"
- then
- continue
- fi
- git-repo-config remote."$origin".fetch "refs/heads/${name}:$remote_top/${name}" '^$'
- done &&
- case "$use_separate_remote" in
- t)
- rm -f "refs/remotes/$origin/HEAD"
- git-symbolic-ref "refs/remotes/$origin/HEAD" \
- "refs/remotes/$origin/$head_points_at"
- esac &&
+ "refs/heads/*:$remote_top/*" '^$' &&
+ rm -f "refs/remotes/$origin/HEAD"
+ git-symbolic-ref "refs/remotes/$origin/HEAD" \
+ "refs/remotes/$origin/$head_points_at" &&
+
git-repo-config branch."$head_points_at".remote "$origin" &&
git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at"
esac
diff --git a/git-compat-util.h b/git-compat-util.h
index 0272d043d0..bc296b3a45 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -11,6 +11,11 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
+#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
+#define _GNU_SOURCE
+#define _BSD_SOURCE
+
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
@@ -22,9 +27,27 @@
#include <errno.h>
#include <limits.h>
#include <sys/param.h>
-#include <netinet/in.h>
#include <sys/types.h>
#include <dirent.h>
+#include <sys/time.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fnmatch.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <assert.h>
+#include <regex.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <grp.h>
+
+#ifndef NO_ICONV
+#include <iconv.h>
+#endif
/* On most systems <limits.h> would have given us this, but
* not on some systems (e.g. GNU/Hurd).
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 2a8447e253..df395126b8 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -946,7 +946,7 @@ sub req_update
$log->debug("Temporary directory for merge is $dir");
- my $return = system("git merge-file", $file_local, $file_old, $file_new);
+ my $return = system("git", "merge-file", $file_local, $file_old, $file_new);
$return >>= 8;
if ( $return == 0 )
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index bc881cc5f9..ea7511e8a0 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -132,7 +132,6 @@ canon_refs_list_for_fetch () {
# or the first one otherwise; add prefix . to the rest
# to prevent the secondary branches to be merged by default.
merge_branches=
- found_mergeref=
curr_branch=
if test "$1" = "-d"
then
@@ -142,7 +141,8 @@ canon_refs_list_for_fetch () {
curr_branch=$(git-symbolic-ref HEAD | \
sed -e 's|^refs/heads/||')
merge_branches=$(git-repo-config \
- --get-all "branch.${curr_branch}.merge")
+ --get-all "branch.${curr_branch}.merge") ||
+ merge_branches=.this.would.never.match.any.ref.
fi
set x $(expand_refs_wildcard "$@")
shift
@@ -171,10 +171,6 @@ canon_refs_list_for_fetch () {
dot_prefix= && break
done
fi
- if test -z $dot_prefix
- then
- found_mergeref=true
- fi
case "$remote" in
'') remote=HEAD ;;
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
@@ -195,11 +191,6 @@ canon_refs_list_for_fetch () {
fi
echo "${dot_prefix}${force}${remote}:${local}"
done
- if test -z "$found_mergeref" -a "$curr_branch"
- then
- echo >&2 "Warning: No merge candidate found because value of config option
- \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
- fi
}
# Returns list of src: (no store), or src:dst (store)
diff --git a/git-pull.sh b/git-pull.sh
index e23beb685d..1703091bbb 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -76,6 +76,10 @@ merge_head=$(sed -e '/ not-for-merge /d' \
case "$merge_head" in
'')
+ curr_branch=$(git-symbolic-ref HEAD | \
+ sed -e 's|^refs/heads/||')
+ echo >&2 "Warning: No merge candidate found because value of config option
+ \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
echo >&2 "No changes."
exit 0
;;
diff --git a/git.c b/git.c
index 016ee8adb7..73cf4d4e01 100644
--- a/git.c
+++ b/git.c
@@ -1,20 +1,8 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include "git-compat-util.h"
+#include "builtin.h"
#include "exec_cmd.h"
#include "cache.h"
#include "quote.h"
-#include "builtin.h"
-
const char git_usage_string[] =
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4059894e0b..ebbc397ee8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2915,8 +2915,10 @@ sub git_summary {
my $owner = git_get_project_owner($project);
my $refs = git_get_references();
- my @taglist = git_get_tags_list(15);
- my @headlist = git_get_heads_list(15);
+ # These get_*_list functions return one more to allow us to see if
+ # there are more ...
+ my @taglist = git_get_tags_list(16);
+ my @headlist = git_get_heads_list(16);
my @forklist;
my ($check_forks) = gitweb_check_feature('forks');
@@ -2952,6 +2954,8 @@ sub git_summary {
}
}
+ # we need to request one more than 16 (0..15) to check if
+ # those 16 are all
open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
git_get_head_hash($project), "--"
or die_error(undef, "Open git-rev-list failed");
@@ -2959,17 +2963,20 @@ sub git_summary {
close $fd;
git_print_header_div('shortlog');
git_shortlog_body(\@revlist, 0, 15, $refs,
+ $#revlist <= 15 ? undef :
$cgi->a({-href => href(action=>"shortlog")}, "..."));
if (@taglist) {
git_print_header_div('tags');
git_tags_body(\@taglist, 0, 15,
+ $#taglist <= 15 ? undef :
$cgi->a({-href => href(action=>"tags")}, "..."));
}
if (@headlist) {
git_print_header_div('heads');
git_heads_body(\@headlist, $head, 0, 15,
+ $#headlist <= 15 ? undef :
$cgi->a({-href => href(action=>"heads")}, "..."));
}
diff --git a/grep.c b/grep.c
index 0fc078ec0a..fcc6762302 100644
--- a/grep.c
+++ b/grep.c
@@ -1,5 +1,4 @@
#include "cache.h"
-#include <regex.h>
#include "grep.h"
void append_grep_pattern(struct grep_opt *opt, const char *pat,
diff --git a/help.c b/help.c
index 0824c25226..341b9e370e 100644
--- a/help.c
+++ b/help.c
@@ -3,12 +3,11 @@
*
* Builtin help-related commands (help, usage, version)
*/
-#include <sys/ioctl.h>
#include "cache.h"
#include "builtin.h"
#include "exec_cmd.h"
#include "common-cmds.h"
-
+#include <sys/ioctl.h>
/* most GUI terminals set COLUMNS (although some don't export it) */
static int term_columns(void)
diff --git a/ident.c b/ident.c
index d7faba6a70..6ad8fedd60 100644
--- a/ident.c
+++ b/ident.c
@@ -7,9 +7,6 @@
*/
#include "cache.h"
-#include <pwd.h>
-#include <netdb.h>
-
static char git_default_date[50];
static void copy_gecos(struct passwd *w, char *name, int sz)
diff --git a/imap-send.c b/imap-send.c
index a6a65680ee..894cbbdf53 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -24,13 +24,6 @@
#include "cache.h"
-#include <assert.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
typedef struct store_conf {
char *name;
const char *path; /* should this be here? its interpretation is driver-specific */
diff --git a/index-pack.c b/index-pack.c
index 6d6c92bf14..5f6d128a83 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -6,8 +6,6 @@
#include "commit.h"
#include "tag.h"
#include "tree.h"
-#include <sys/time.h>
-#include <signal.h>
static const char index_pack_usage[] =
"git-index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
@@ -87,7 +85,7 @@ static unsigned display_progress(unsigned n, unsigned total, unsigned last_pc)
static unsigned char input_buffer[4096];
static unsigned long input_offset, input_len, consumed_bytes;
static SHA_CTX input_ctx;
-static int input_fd, output_fd, mmap_fd;
+static int input_fd, output_fd, pack_fd;
/* Discard current buffer used content. */
static void flush(void)
@@ -148,14 +146,14 @@ static const char *open_pack_file(const char *pack_name)
output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600);
if (output_fd < 0)
die("unable to create %s: %s\n", pack_name, strerror(errno));
- mmap_fd = output_fd;
+ pack_fd = output_fd;
} else {
input_fd = open(pack_name, O_RDONLY);
if (input_fd < 0)
die("cannot open packfile '%s': %s",
pack_name, strerror(errno));
output_fd = -1;
- mmap_fd = input_fd;
+ pack_fd = input_fd;
}
SHA1_Init(&input_ctx);
return pack_name;
@@ -268,7 +266,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_
case OBJ_TAG:
break;
default:
- bad_object(obj->offset, "bad object type %d", obj->type);
+ bad_object(obj->offset, "unknown object type %d", obj->type);
}
obj->hdr_size = consumed_bytes - obj->offset;
@@ -279,27 +277,25 @@ static void *get_data_from_pack(struct object_entry *obj)
{
unsigned long from = obj[0].offset + obj[0].hdr_size;
unsigned long len = obj[1].offset - from;
- unsigned pg_offset = from % getpagesize();
- unsigned char *map, *data;
+ unsigned char *src, *data;
z_stream stream;
int st;
- map = mmap(NULL, len + pg_offset, PROT_READ, MAP_PRIVATE,
- mmap_fd, from - pg_offset);
- if (map == MAP_FAILED)
- die("cannot mmap pack file: %s", strerror(errno));
+ src = xmalloc(len);
+ if (pread(pack_fd, src, len, from) != len)
+ die("cannot pread pack file: %s", strerror(errno));
data = xmalloc(obj->size);
memset(&stream, 0, sizeof(stream));
stream.next_out = data;
stream.avail_out = obj->size;
- stream.next_in = map + pg_offset;
+ stream.next_in = src;
stream.avail_in = len;
inflateInit(&stream);
while ((st = inflate(&stream, Z_FINISH)) == Z_OK);
inflateEnd(&stream);
if (st != Z_STREAM_END || stream.total_out != obj->size)
die("serious inflate inconsistency");
- munmap(map, len + pg_offset);
+ free(src);
return data;
}
diff --git a/interpolate.c b/interpolate.c
index 5d9d1889f0..f992ef7753 100644
--- a/interpolate.c
+++ b/interpolate.c
@@ -2,8 +2,6 @@
* Copyright 2006 Jon Loeliger
*/
-#include <string.h>
-
#include "git-compat-util.h"
#include "interpolate.h"
diff --git a/lockfile.c b/lockfile.c
index 2a2fea3cb6..261baff049 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2005, Junio C Hamano
*/
-#include <signal.h>
#include "cache.h"
static struct lock_file *lock_file_list;
diff --git a/merge-base.c b/merge-base.c
index 009caf804b..385f4ba386 100644
--- a/merge-base.c
+++ b/merge-base.c
@@ -1,4 +1,3 @@
-#include <stdlib.h>
#include "cache.h"
#include "commit.h"
diff --git a/merge-index.c b/merge-index.c
index 646d090c58..a9983dd78a 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -1,7 +1,3 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
#include "cache.h"
static const char *pgm;
diff --git a/merge-recursive.c b/merge-recursive.c
index 6dd6e2e5af..ae7ae4cd2a 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -3,13 +3,6 @@
* Fredrik Kuivinen.
* The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
*/
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
#include "cache.h"
#include "cache-tree.h"
#include "commit.h"
@@ -1279,7 +1272,7 @@ int main(int argc, char *argv[])
struct commit *result, *h1, *h2;
git_config(git_default_config); /* core.filemode */
- original_index_file = getenv("GIT_INDEX_FILE");
+ original_index_file = getenv(INDEX_ENVIRONMENT);
if (!original_index_file)
original_index_file = xstrdup(git_path("index"));
diff --git a/path-list.c b/path-list.c
index f8800f8e66..caaa5cc57b 100644
--- a/path-list.c
+++ b/path-list.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include "cache.h"
#include "path-list.h"
diff --git a/path.c b/path.c
index d2c076d7cb..066f621955 100644
--- a/path.c
+++ b/path.c
@@ -11,7 +11,6 @@
* which is what it's designed for.
*/
#include "cache.h"
-#include <pwd.h>
static char bad_path[] = "/bad-path/";
diff --git a/receive-pack.c b/receive-pack.c
index 5e5510bc3d..59b682c03a 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -6,7 +6,6 @@
#include "exec_cmd.h"
#include "commit.h"
#include "object.h"
-#include <sys/wait.h>
static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
diff --git a/refs.c b/refs.c
index d911b9e860..a101ff3bf8 100644
--- a/refs.c
+++ b/refs.c
@@ -1,10 +1,8 @@
-#include "refs.h"
#include "cache.h"
+#include "refs.h"
#include "object.h"
#include "tag.h"
-#include <errno.h>
-
/* ISSYMREF=01 and ISPACKED=02 are public interfaces */
#define REF_KNOWS_PEELED 04
diff --git a/revision.c b/revision.c
index 993bb668a2..7b6f91f83e 100644
--- a/revision.c
+++ b/revision.c
@@ -6,7 +6,6 @@
#include "diff.h"
#include "refs.h"
#include "revision.h"
-#include <regex.h>
#include "grep.h"
static char *path_name(struct name_path *path, const char *name)
diff --git a/rsh.c b/rsh.c
index f34409e1bc..5754a230e2 100644
--- a/rsh.c
+++ b/rsh.c
@@ -1,10 +1,6 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
+#include "cache.h"
#include "rsh.h"
#include "quote.h"
-#include "cache.h"
#define COMMAND_SIZE 4096
diff --git a/run-command.c b/run-command.c
index 61908682b9..492ad3e64c 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1,6 +1,5 @@
#include "cache.h"
#include "run-command.h"
-#include <sys/wait.h>
#include "exec_cmd.h"
int run_command_v_opt(int argc, const char **argv, int flags)
diff --git a/sha1_file.c b/sha1_file.c
index 63f416bb5a..1c4df5b73e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1013,7 +1013,7 @@ void packed_object_info_detail(struct packed_git *p,
for (;;) {
switch (kind) {
default:
- die("corrupted pack file %s containing object of kind %d",
+ die("pack %s contains unknown object type %d",
p->pack_name, kind);
case OBJ_COMMIT:
case OBJ_TREE:
@@ -1063,7 +1063,7 @@ static int packed_object_info(struct packed_git *p, unsigned long offset,
strcpy(type, type_names[kind]);
break;
default:
- die("corrupted pack file %s containing object of kind %d",
+ die("pack %s contains unknown object type %d",
p->pack_name, kind);
}
if (sizep)
diff --git a/ssh-upload.c b/ssh-upload.c
index 20b15eab57..0b52ae15cb 100644
--- a/ssh-upload.c
+++ b/ssh-upload.c
@@ -12,8 +12,6 @@
#include "rsh.h"
#include "refs.h"
-#include <string.h>
-
static unsigned char local_version = 1;
static unsigned char remote_version;
diff --git a/strbuf.c b/strbuf.c
index 9d9d8bed91..7f14b0fb59 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,7 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "strbuf.h"
#include "cache.h"
+#include "strbuf.h"
void strbuf_init(struct strbuf *sb) {
sb->buf = NULL;
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a11ab0ad41..90eeeba2a3 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -23,15 +23,14 @@ test_expect_success "clone and setup child repos" '
git clone . two &&
cd two &&
git repo-config branch.master.remote one &&
- {
- echo "URL: ../one/.git/"
- echo "Pull: refs/heads/master:refs/heads/one"
- } >.git/remotes/one
+ git repo-config remote.one.url ../one/.git/ &&
+ git repo-config remote.one.fetch refs/heads/master:refs/heads/one &&
cd .. &&
git clone . three &&
cd three &&
git repo-config branch.master.remote two &&
git repo-config branch.master.merge refs/heads/one &&
+ mkdir -p .git/remotes &&
{
echo "URL: ../two/.git/"
echo "Pull: refs/heads/master:refs/heads/two"
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ac7be769b4..f0f9cd6be0 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -208,8 +208,9 @@ test_done () {
# t/ subdirectory and are run in trash subdirectory.
PATH=$(pwd)/..:$PATH
GIT_EXEC_PATH=$(pwd)/..
+GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
HOME=$(pwd)/trash
-export PATH GIT_EXEC_PATH HOME
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
export GITPERLLIB
diff --git a/templates/remotes-- b/templates/remotes--
deleted file mode 100644
index fae88709a6..0000000000
--- a/templates/remotes--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/test-date.c b/test-date.c
index 93e802759f..62e8f2387a 100644
--- a/test-date.c
+++ b/test-date.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <time.h>
-
#include "cache.h"
int main(int argc, char **argv)
diff --git a/test-delta.c b/test-delta.c
index 1be8ee0c72..795aa08377 100644
--- a/test-delta.c
+++ b/test-delta.c
@@ -8,13 +8,7 @@
* published by the Free Software Foundation.
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
+#include "git-compat-util.h"
#include "delta.h"
static const char usage[] =
diff --git a/tree.c b/tree.c
index ea386e5066..b6f02fecc4 100644
--- a/tree.c
+++ b/tree.c
@@ -4,7 +4,6 @@
#include "commit.h"
#include "tag.h"
#include "tree-walk.h"
-#include <stdlib.h>
const char *tree_type = "tree";
diff --git a/unpack-trees.c b/unpack-trees.c
index b8689ebc86..2e2232cbb0 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1,5 +1,3 @@
-#include <signal.h>
-#include <sys/time.h>
#include "cache.h"
#include "dir.h"
#include "tree.h"
diff --git a/upload-pack.c b/upload-pack.c
index 4572fff07c..32b06b2e66 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,6 +1,3 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
#include "cache.h"
#include "refs.h"
#include "pkt-line.h"
diff --git a/var.c b/var.c
index a57a33b81a..39977b949a 100644
--- a/var.c
+++ b/var.c
@@ -4,9 +4,6 @@
* Copyright (C) Eric Biederman, 2005
*/
#include "cache.h"
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
static const char var_usage[] = "git-var [-l | <variable>]";
diff --git a/wt-status.c b/wt-status.c
index cface6ca88..db427384ff 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1,6 +1,6 @@
+#include "cache.h"
#include "wt-status.h"
#include "color.h"
-#include "cache.h"
#include "object.h"
#include "dir.h"
#include "commit.h"