Code

git svn info: tests: do not use set -e
[git.git] / builtin-fetch-pack.c
index f4dbcf069ee8e5226d52c9c2194a8ed20ed65a34..459c6f0da35ac0a4d6cc0a914f6aa905f8a94d42 100644 (file)
@@ -18,7 +18,7 @@ static struct fetch_pack_args args = {
 };
 
 static const char fetch_pack_usage[] =
-"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
+"git fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
 
 #define COMPLETE       (1U << 0)
 #define COMMON         (1U << 1)
@@ -309,7 +309,8 @@ done:
                }
                flushes--;
        }
-       return retval;
+       /* it is no error to fetch into a completely empty repo */
+       return count ? retval : 0;
 }
 
 static struct commit_list *complete;
@@ -519,7 +520,8 @@ static int get_pack(int xd[2], char **pack_lockfile)
 
                if (read_pack_header(demux.out, &header))
                        die("protocol error: bad pack header");
-               snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%u,%u",
+               snprintf(hdr_arg, sizeof(hdr_arg),
+                        "--pack_header=%"PRIu32",%"PRIu32,
                         ntohl(header.hdr_version), ntohl(header.hdr_entries));
                if (ntohl(header.hdr_entries) < unpack_limit)
                        do_keep = 0;
@@ -538,7 +540,7 @@ static int get_pack(int xd[2], char **pack_lockfile)
                        *av++ = "--fix-thin";
                if (args.lock_pack || unpack_limit) {
                        int s = sprintf(keep_arg,
-                                       "--keep=fetch-pack %d on ", getpid());
+                                       "--keep=fetch-pack %"PRIuMAX " on ", (uintmax_t) getpid());
                        if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
                                strcpy(keep_arg + s, "localhost");
                        *av++ = keep_arg;
@@ -607,7 +609,7 @@ static struct ref *do_fetch_pack(int fd[2],
                        fprintf(stderr, "warning: no common commits\n");
 
        if (get_pack(fd, pack_lockfile))
-               die("git-fetch-pack: fetch failed.");
+               die("git fetch-pack: fetch failed.");
 
  all_done:
        return ref;