Merge branch 'jc/clone'
authorJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:56:14 +0000 (13:56 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:56:14 +0000 (13:56 -0800)
* jc/clone:
Move "no merge candidate" warning into git-pull
Use preprocessor constants for environment variable names.
Do not create $GIT_DIR/remotes/ directory anymore.
Introduce GIT_TEMPLATE_DIR
Revert "fix testsuite: make sure they use templates freshly built from the source"
fix testsuite: make sure they use templates freshly built from the source
git-clone: lose the traditional 'no-separate-remote' layout
git-clone: lose the artificial "first" fetch refspec
git-pull: refuse default merge without branch.*.merge
git-clone: use wildcard specification for tracking branches

79 files changed:
GIT-VERSION-GEN
Makefile
archive-tar.c
archive-zip.c
blob.c
builtin-add.c
builtin-apply.c
builtin-archive.c
builtin-blame.c
builtin-branch.c
builtin-for-each-ref.c
builtin-grep.c
builtin-log.c
builtin-ls-files.c
builtin-mailinfo.c
builtin-mailsplit.c
builtin-mv.c
builtin-name-rev.c
builtin-pack-objects.c
builtin-repo-config.c
builtin-runstatus.c
builtin-shortlog.c
builtin-show-branch.c
builtin-stripspace.c
builtin-tar-tree.c
builtin-unpack-objects.c
builtin-upload-archive.c
color.c
compat/inet_ntop.c
compat/mmap.c
compat/setenv.c
compat/strlcpy.c
compat/unsetenv.c
config.c
configure.ac
connect.c
convert-objects.c
daemon.c
date.c
diff-delta.c
diff.c
diffcore-order.c
diffcore-pickaxe.c
dir.c
entry.c
fetch-pack.c
fetch.c
fsck-objects.c
git-compat-util.h
git-cvsserver.perl
git.c
gitweb/gitweb.perl
grep.c
help.c
ident.c
imap-send.c
index-pack.c
interpolate.c
lockfile.c
merge-base.c
merge-index.c
merge-recursive.c
path-list.c
path.c
receive-pack.c
refs.c
revision.c
rsh.c
run-command.c
sha1_file.c
ssh-upload.c
strbuf.c
test-date.c
test-delta.c
tree.c
unpack-trees.c
upload-pack.c
var.c
wt-status.c
index 4eac314f3a12b36c379fec139de6aecee5a0a2b6..eca1ff2175c9c62ce51fe6606d615f99925e7734 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.4.4.1.GIT
+DEF_VER=v1.4.4.GIT
 
 LF='
 '
index 8919dabc781867e121238dd8dd0a05a8ac02586e..76511045a80cf5da72851d8194742de56282d953 100644 (file)
--- 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
index ff0f6e29292cf716ac32e8ae63a58902fcccc120..af47fdc95572bfa67b9c67369222a69c32ddea02 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "strbuf.h"
index 36e922a1f2ffe34264ac55c002072cb2777e7026..f31b8ed8236c3fcad10ac9a84e2f508f11e1a6cf 100644 (file)
@@ -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 d1af2e62f14965fab491a3d9dde712f02b718adc..9776beac5827a4c705eddde426817dcc40c525bc 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "blob.h"
-#include <stdlib.h>
 
 const char *blob_type = "blob";
 
index b3f920676a958e581c55dcca48e9a8f01b43859b..f306f82b16c3c3c76416610cd4cabf0a307924ed 100644 (file)
@@ -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);
index 436d9e188070df0e4a51186716b033658a8672b5..1c3583706835339d2f3a0b0a5d3b989aae2a8142 100644 (file)
@@ -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"
index a8a1f079bf4e28a3f07d49b6a4723ee8dea17178..391cf43911a16ec49862c18b7dd4f1f094d49de8 100644 (file)
@@ -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"
index a250724463fff1990c4f513cfa8468e36acc8c41..9bf6ec951fb5d7535441a8db5b73d20f509ed982 100644 (file)
 #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"
index 560309cb154504a8d280f12e3d9d2d3d6d715d7c..515330c155a8e54c72fd02ea74e30be10b852490 100644 (file)
@@ -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"
index 227aa3cd7f887ad44fd6b885479ef2afb586ded4..af72a12a5798265cece6c7b72582fd3672421394 100644 (file)
@@ -6,7 +6,6 @@
 #include "tree.h"
 #include "blob.h"
 #include "quote.h"
-#include <fnmatch.h>
 
 /* Quoting styles */
 #define QUOTE_NONE 0
index 9873e3d1dbf0e8735641cc178d687a9d5194487e..3b1b1cbbfa7bf348c17c025afa217ffff97087e3 100644 (file)
 #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;
index 17014f70a2896de46ff4714e77093b8adaa9fc8f..8df3c1394a0b70548708137bfe20126fbea01709 100644 (file)
@@ -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;
 
index bc79ce40fc87b7a77d22f2fea85f2198102fcb67..21c2a6e2d9b68c0c3bcfac824e85c7b392c72486 100644 (file)
@@ -5,8 +5,6 @@
  *
  * Copyright (C) Linus Torvalds, 2005
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "quote.h"
 #include "dir.h"
index b8d7dbc0b71929a95aaebd79d5912897d5eb70e7..e6472293d47611d415276f6057227d9c93788f63 100644 (file)
@@ -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"
 
index 91a699d34d93462b56f2591193bb5729b42b3950..3bca855aae857cde15f2a249f8e0a5c30b3e7d82 100644 (file)
@@ -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"
 
index d14a4a7f5c66c5f8712399d4b1fc566e0891125a..737af350b873e90c787cb49960236fc19b62a3bf 100644 (file)
@@ -3,8 +3,6 @@
  *
  * Copyright (C) 2006 Johannes Schindelin
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "builtin.h"
 #include "dir.h"
index 618aa314d22dd16bb62b0a7deb3be14fda411ebe..b4f15cc38ab7fa045fc5cf025ca3fd6251a01973 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "builtin.h"
 #include "cache.h"
 #include "commit.h"
index a2dc7d1d9d39436e8e5266d1d4bb693b06a54b17..807be8c3f8a051d9171cf2ee3c9f973f77a2ff08 100644 (file)
@@ -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\
index 4885930ca460ba1143089c9a050ff55f4682a912..90633119d4ae873ed30889e93dbb4307af0ae0d1 100644 (file)
@@ -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";
index 0b63037dd04e7c66d2e378ee394979cec040fe55..4b489b1214e1ae693a9b0b5166909800f5ca94ac 100644 (file)
@@ -1,5 +1,5 @@
-#include "wt-status.h"
 #include "cache.h"
+#include "wt-status.h"
 
 extern int wt_status_use_color;
 
index 3fc43dd7dd89fea2fb7f02e694ed632215002e13..edb40429ec4465f3bebba02f2174314dd0183225 100644 (file)
@@ -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>... ]";
index a38ac34efb8738fca2b415a47f782dd3745e9ff9..b9d9781d4d6a12860d377607369a4dea95a3c7be 100644 (file)
@@ -1,5 +1,3 @@
-#include <stdlib.h>
-#include <fnmatch.h>
 #include "cache.h"
 #include "commit.h"
 #include "refs.h"
index 09cc9108cdaf2aa20dc10788bccd2fee0ae9b02a..f0d4d9e2d10446a229094c991363f5a17ce4c666 100644 (file)
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "builtin.h"
 
 /*
index 4d4cfec878e468b8ab8a7f055c836c3569443914..11e62fc141f592977373630c7671d3e7e914c314 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "tar.h"
index e6d75748444ef4fc263970d4fe87b4623d2790fc..d351e02649401364e7384d0e784901e6f3fcb119 100644 (file)
@@ -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";
 
index 45c92e163c477af4ec7c36c8ee6fcfd9242a0b2d..e4156f8f48aeed307b1754bada173034dd81a311 100644 (file)
@@ -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/color.c b/color.c
index d8c8399d5916432eaa4122175f5e5d7ce209001b..09d82eec3d0adf5b7bd8828b0c8df0554695f75c 100644 (file)
--- 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"
 
index ec8c1bff539232c581fd10ef1d01c345442a2e35..4d7ab9d9758428c003a74d9f85699d7fc6922e05 100644 (file)
@@ -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;
 
        /*
index a4d2e507f73c5595a2ca76c0369349cc11e2426f..0fd46e793d088e6567b20c7e81a5cde7023bdb58 100644 (file)
@@ -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)
index b7d76785980b81a6f1057d678d34a732f45ca4cd..3a22ea7b751efb768d72afa2f97fd963e10eec7e 100644 (file)
@@ -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)
 {
index b66856a3a50a93262ee4b5bd0294bb0c7fc85b15..4024c360301ebe7d58ac5b84dcbb692341b649ed 100644 (file)
@@ -1,4 +1,4 @@
-#include <string.h>
+#include "../git-compat-util.h"
 
 size_t gitstrlcpy(char *dest, const char *src, size_t size)
 {
index 3a5e4ec04ae4a523823e633031b85559bf5dc973..eb29f5e0849370afe90c400271fea12e0f9090aa 100644 (file)
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
index 6a4224e98cf51f8ced2b8e942231012b42aaeef7..1662a4626e569b07d96c622b357928216a24538c 100644 (file)
--- a/config.c
+++ b/config.c
@@ -6,7 +6,6 @@
  *
  */
 #include "cache.h"
-#include <regex.h>
 
 #define MAXNAME (256)
 
@@ -749,7 +748,7 @@ int git_config_set_multivar(const char* key, const char* value,
 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];
@@ -762,11 +761,15 @@ int git_config_rename_section(const char *old_name, const char *new_name)
        }
        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;
 }
 
index 34e34789bd295d0e06e548c797acc73889928053..e153d5382364def42fa062a39148a696e2e49785 100644 (file)
@@ -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
index f7edba82c4d2fcc642ccae785aa7a315b1f819d6..66daa11a5737efd6ee2dbd6ff2ad0e1475fcba20 100644 (file)
--- 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;
 
index 881258311a47f9faa437ec02e99b4a0df1439d53..a63013298566fd3dc21275a90ca976227de8c7f0 100644 (file)
@@ -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"
index e66bb802da9faed6e01229fffbe56e3d7cca60c6..b129b83e4026490c1e6e77861cd6f03a5007d01e 100644 (file)
--- 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 18259227321f47988386c2bd70888b3c967d8ab6..7acb8cbd91bb1491931326ade1905d9c6f7bfdf5 100644 (file)
--- 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)
index fa16d06c8d1e85a458428c673cb2f589857f5424..9f998d0a73e0127d3a68a7caecb3727569149871 100644 (file)
  *  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 99744354a77418ab462b6b797c6ab334cc364960..91f956b23b0d641e4e330e1e22c0b8bc8cc0fed0 100644 (file)
--- 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);
index aef6da60447b98a05d91513b4aa74e505b0a0d84..7ad09461858aa6832b828df411fd1b736f035465 100644 (file)
@@ -4,7 +4,6 @@
 #include "cache.h"
 #include "diff.h"
 #include "diffcore.h"
-#include <fnmatch.h>
 
 static char **order;
 static int order_cnt;
index cfcce315babb0edb7ad7be7f2ab2437aaf41eb9d..de44adabf09dcb47090e7865d6cd77677115d2b6 100644 (file)
@@ -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 e6a61ee913d9f0f4f56402bdb451689cb80373ab..16401d8017c5d96dc17ac9d52ab77eabbc4e9270 100644 (file)
--- 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 b2ea0efa82e1a0511fe5aa798618c23827b59bab..88df7139477f94c236f93ca835c28ed4dd9543de 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
 #include "cache.h"
 #include "blob.h"
 
index 743eab7efaa5b53a56d432bea268dda04350be7b..92322cf4da39434d44e4aa52fa0c3f735b22d752 100644 (file)
@@ -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 663b4b2f42744a2d12ba1d8661b8b0d3645ef82b..f69be82f10d287d71f6184c4b9203bdab3ce81fc 100644 (file)
--- 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"
index 46b628cb94375e3f645f868efb04547ffc20e6e7..409aea02b4f8570dbaf0a8425eb29e5d45515367 100644 (file)
@@ -1,6 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
-
 #include "cache.h"
 #include "commit.h"
 #include "tree.h"
index 0272d043d0b82dc6ad0ff4836fe8db8ed1e1d960..bc296b3a45708296c3f14f5af53624801045e554 100644 (file)
 
 #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>
 #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).
index 2a8447e2534e93b4cec4e86c2dcbadfede99208a..df395126b86bbed4d8f785e7eccbdb091c3f888b 100755 (executable)
@@ -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.c b/git.c
index 016ee8adb730ea7c390dcb84dcbbafda7936f2d5..73cf4d4e019c2c0169e6181b2c557cdeb3f962e7 100644 (file)
--- 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]";
 
index 4059894e0b51d2c355193064f0cca8fb882a3055..ebbc397ee8dce807bd9700aa72d33c80b13f02bf 100755 (executable)
@@ -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 0fc078ec0ac42e39125c8e5a8f05a3b6ecae4fa3..fcc676230282e4c5bda4f9f97c5ae65c1a6beb30 100644 (file)
--- 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 0824c25226ad7b106e56d1b7c23fad40eed92749..341b9e370eec4fa90014249a63afac17b083b275 100644 (file)
--- 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 d7faba6a70139020d9ee0a2f801ae2e6b567d4f4..6ad8fedd60ba1461d77dc2b1d66e52cf56158c6f 100644 (file)
--- 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)
index a6a65680ee6daf062180d2580e83616cfff4cda4..894cbbdf53ccf4728276b46b9491f409f3b9e03b 100644 (file)
 
 #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 */
index 6d6c92bf14803923f4c98678ae682aef4d41d3ab..5f6d128a836f8ed9447f81280ae679e19c9939ff 100644 (file)
@@ -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;
 }
 
index 5d9d1889f088c64131cd3c116e6a16876ce95db8..f992ef77533737fe2ec52dc3b662cb6cacca0ea2 100644 (file)
@@ -2,8 +2,6 @@
  * Copyright 2006 Jon Loeliger
  */
 
-#include <string.h>
-
 #include "git-compat-util.h"
 #include "interpolate.h"
 
index 2a2fea3cb6bd1de059e7c0f8c2008c5fe8376b93..261baff049cd8b2e4d1b1a269992851eb00b2aa8 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, Junio C Hamano
  */
-#include <signal.h>
 #include "cache.h"
 
 static struct lock_file *lock_file_list;
index 009caf804b43fdd644ff08991d55d0e417fd34d8..385f4ba386ada3e43f962d9051cf4b651320fcd3 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "cache.h"
 #include "commit.h"
 
index 646d090c58e774bdf0f412da39f4b67fd7a696c6..a9983dd78ad5cd1e364f0e00c259bdb7e6f151f0 100644 (file)
@@ -1,7 +1,3 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
 #include "cache.h"
 
 static const char *pgm;
index ae4dcfbe5b0b8b1e9a03df128b9d0b67706a371b..ae7ae4cd2a9ce392945ad8ed27e4289c27ee24bd 100644 (file)
@@ -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"
index f8800f8e66e39f035820c2aeb0843fb3ebf65fb3..caaa5cc57b05e1a27bb4fd8f49bb74e06b9936e3 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include "cache.h"
 #include "path-list.h"
 
diff --git a/path.c b/path.c
index d2c076d7cbad3a16a002897d926cc13633be4f77..066f62195508033a5f72504e4805ea436424296e 100644 (file)
--- 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/";
 
index 5e5510bc3dadff835324f46b0cd936ceba8f1c6e..59b682c03af53fbfe600d063fa832f874440493c 100644 (file)
@@ -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 d911b9e86009aa3d81c6c4d310a26bf057920e8a..a101ff3bf88dafa56ac85fcd977c0ae6be1b495e 100644 (file)
--- 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
 
index 993bb668a205a9fb3e2f5ddd2f378f10ac7905b4..7b6f91f83ef4a04f1af74daf37fbae2da7eac0d7 100644 (file)
@@ -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 f34409e1bc5fcf3b6295021043339793b25a8913..5754a230e2c23ce3fea255fccd8726af76c13317 100644 (file)
--- 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
 
index 61908682b9b251ac49ae655522a3143476a888ea..492ad3e64ce5d2435c029ab032f1221347f37c19 100644 (file)
@@ -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)
index 63f416bb5a900210d6b3ab15bb4ffe1e16244b9a..1c4df5b73e9dff900c69c0994eb21105614511b6 100644 (file)
@@ -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)
index 20b15eab57e1c4f7c4b306010d7d12bff2308141..0b52ae15cbd216bff5002c89e0c8af84ea68ed1a 100644 (file)
@@ -12,8 +12,6 @@
 #include "rsh.h"
 #include "refs.h"
 
-#include <string.h>
-
 static unsigned char local_version = 1;
 static unsigned char remote_version;
 
index 9d9d8bed915483abbc2ebb340e0881ae4e296bd4..7f14b0fb59bd7e14979b002f441ae84ff5b0e9a2 100644 (file)
--- 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;
index 93e802759f1906665857c82c71f589b7d636b540..62e8f2387a1cab97ec1c71d1993d082274e17bf5 100644 (file)
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <time.h>
-
 #include "cache.h"
 
 int main(int argc, char **argv)
index 1be8ee0c721ec35372fee4e686d9664b143b4345..795aa08377aaa9a229affaa054e243251436f755 100644 (file)
@@ -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 ea386e506659c65224cfe55bdc4f8d086171637a..b6f02fecc46ec4633dc1ee75f38bc90761a4fbe3 100644 (file)
--- 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";
 
index b8689ebc86bb69c21fd650572c55a4c3d246a183..2e2232cbb07e61de3be74302fba67142a58a857b 100644 (file)
@@ -1,5 +1,3 @@
-#include <signal.h>
-#include <sys/time.h>
 #include "cache.h"
 #include "dir.h"
 #include "tree.h"
index 4572fff07ca39a53a69453fdc8037e3aae1605a6..32b06b2e66099787d621c2557a8a9ee00aec4be6 100644 (file)
@@ -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 a57a33b81ac6c9cb5ec0c833edc21bd66428d976..39977b949a1be61f1cf35512bd729862de842108 100644 (file)
--- 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>]";
 
index cface6ca88666d5e1de116110cb52eea4d91a5f1..db427384ff454aa07e38c588537cbaa6b835dee6 100644 (file)
@@ -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"