A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gitster/git/commit/d35c8027937546e6b22a2f28123f731c84e3b380 below:

Merge branch 'jc/clone-borrow' · gitster/git@d35c802 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+46

-2

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+46

-2

lines changed Original file line number Diff line number Diff line change

@@ -12,7 +12,7 @@ SYNOPSIS

12 12

'git clone' [--template=<template_directory>]

13 13

[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]

14 14

[-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]

15 -

[--separate-git-dir <git dir>]

15 +

[--dissociate] [--separate-git-dir <git dir>]

16 16

[--depth <depth>] [--[no-]single-branch]

17 17

[--recursive | --recurse-submodules] [--] <repository>

18 18

[<directory>]

@@ -98,7 +98,14 @@ objects from the source repository into a pack in the cloned repository.

98 98

require fewer objects to be copied from the repository

99 99

being cloned, reducing network and local storage costs.

100 100

+

101 -

*NOTE*: see the NOTE for the `--shared` option.

101 +

*NOTE*: see the NOTE for the `--shared` option, and also the

102 +

`--dissociate` option.

103 + 104 +

--dissociate::

105 +

Borrow the objects from reference repositories specified

106 +

with the `--reference` options only to reduce network

107 +

transfer and stop borrowing from them after a clone is made

108 +

by making necessary local copies of borrowed objects.

102 109 103 110

--quiet::

104 111

-q::

Original file line number Diff line number Diff line change

@@ -49,6 +49,7 @@ static int option_verbosity;

49 49

static int option_progress = -1;

50 50

static struct string_list option_config;

51 51

static struct string_list option_reference;

52 +

static int option_dissociate;

52 53 53 54

static int opt_parse_reference(const struct option *opt, const char *arg, int unset)

54 55

{

@@ -94,6 +95,8 @@ static struct option builtin_clone_options[] = {

94 95

N_("create a shallow clone of that depth")),

95 96

OPT_BOOL(0, "single-branch", &option_single_branch,

96 97

N_("clone only one branch, HEAD or --branch")),

98 +

OPT_BOOL(0, "dissociate", &option_dissociate,

99 +

N_("use --reference only while cloning")),

97 100

OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),

98 101

N_("separate git dir from working tree")),

99 102

OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),

@@ -735,6 +738,16 @@ static void write_refspec_config(const char *src_ref_prefix,

735 738

strbuf_release(&value);

736 739

}

737 740 741 +

static void dissociate_from_references(void)

742 +

{

743 +

static const char* argv[] = { "repack", "-a", "-d", NULL };

744 + 745 +

if (run_command_v_opt(argv, RUN_GIT_CMD|RUN_COMMAND_NO_STDIN))

746 +

die(_("cannot repack to clean up"));

747 +

if (unlink(git_path("objects/info/alternates")) && errno != ENOENT)

748 +

die_errno(_("cannot unlink temporary alternates file"));

749 +

}

750 + 738 751

int cmd_clone(int argc, const char **argv, const char *prefix)

739 752

{

740 753

int is_bundle = 0, is_local;

@@ -880,6 +893,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)

880 893 881 894

if (option_reference.nr)

882 895

setup_reference();

896 +

else if (option_dissociate) {

897 +

warning(_("--dissociate given, but there is no --reference"));

898 +

option_dissociate = 0;

899 +

}

883 900 884 901

fetch_pattern = value.buf;

885 902

refspec = parse_fetch_refspec(1, &fetch_pattern);

@@ -993,6 +1010,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)

993 1010

transport_unlock_pack(transport);

994 1011

transport_disconnect(transport);

995 1012 1013 +

if (option_dissociate)

1014 +

dissociate_from_references();

1015 + 996 1016

junk_mode = JUNK_LEAVE_REPO;

997 1017

err = checkout();

998 1018 Original file line number Diff line number Diff line change

@@ -198,4 +198,21 @@ test_expect_success 'clone using repo pointed at by gitfile as reference' '

198 198

test_cmp expected "$base_dir/O/.git/objects/info/alternates"

199 199

'

200 200 201 +

test_expect_success 'clone and dissociate from reference' '

202 +

git init P &&

203 +

(

204 +

cd P && test_commit one

205 +

) &&

206 +

git clone P Q &&

207 +

(

208 +

cd Q && test_commit two

209 +

) &&

210 +

git clone --no-local --reference=P Q R &&

211 +

git clone --no-local --reference=P --dissociate Q S &&

212 +

# removing the reference P would corrupt R but not S

213 +

rm -fr P &&

214 +

test_must_fail git -C R fsck &&

215 +

git -C S fsck

216 +

'

217 + 201 218

test_done

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4