builtin/blame.c: struct blame_entry does not need a prev link
[gitweb.git] / builtin / fetch-pack.c
index 81fae380e8ad8a3c2b32b023fce54cb126b81392..1262b405f8212e71d088f4e090b8121fa304699a 100644 (file)
@@ -8,7 +8,7 @@
 static const char fetch_pack_usage[] =
 "git fetch-pack [--all] [--stdin] [--quiet|-q] [--keep|-k] [--thin] "
 "[--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] "
-"[--no-progress] [-v] [<host>:]<directory> [<refs>...]";
+"[--no-progress] [--diag-url] [-v] [<host>:]<directory> [<refs>...]";
 
 static void add_sought_entry_mem(struct ref ***sought, int *nr, int *alloc,
                                 const char *name, int namelen)
@@ -57,11 +57,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
        for (i = 1; i < argc && *argv[i] == '-'; i++) {
                const char *arg = argv[i];
 
-               if (!prefixcmp(arg, "--upload-pack=")) {
+               if (starts_with(arg, "--upload-pack=")) {
                        args.uploadpack = arg + 14;
                        continue;
                }
-               if (!prefixcmp(arg, "--exec=")) {
+               if (starts_with(arg, "--exec=")) {
                        args.uploadpack = arg + 7;
                        continue;
                }
@@ -90,11 +90,15 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
                        args.stdin_refs = 1;
                        continue;
                }
+               if (!strcmp("--diag-url", arg)) {
+                       args.diag_url = 1;
+                       continue;
+               }
                if (!strcmp("-v", arg)) {
                        args.verbose = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--depth=")) {
+               if (starts_with(arg, "--depth=")) {
                        args.depth = strtol(arg + 8, NULL, 0);
                        continue;
                }
@@ -163,10 +167,14 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
                fd[0] = 0;
                fd[1] = 1;
        } else {
+               int flags = args.verbose ? CONNECT_VERBOSE : 0;
+               if (args.diag_url)
+                       flags |= CONNECT_DIAG_URL;
                conn = git_connect(fd, dest, args.uploadpack,
-                                  args.verbose ? CONNECT_VERBOSE : 0);
+                                  flags);
+               if (!conn)
+                       return args.diag_url ? 0 : 1;
        }
-
        get_remote_heads(fd[0], NULL, 0, &ref, 0, NULL, &shallow);
 
        ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought,