Git development
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com, git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [PATCH] fetch: add a config option to always use the depth argument
Date: Mon,  1 Dec 2014 11:07:03 -0800	[thread overview]
Message-ID: <1417460823-17295-1-git-send-email-sbeller@google.com> (raw)

When having a repository, which deals with large amounts of data, i.e.
graphics, music, films, you may want to keep the git directory at
the smallest size possible.

The depth option helped us in achieving this goal by removing the sizable
history and just keep recent history around. In the case of having large
amounts of data around, you probably want to use the depth option at any
fetch you do, so it would be convenient to have an option for this.

Change-Id: I45a569239639f20e24fbae32fb2046bc478c5f07
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 Documentation/config.txt        | 6 ++++++
 Documentation/fetch-options.txt | 2 ++
 builtin/fetch.c                 | 5 +++++
 3 files changed, 13 insertions(+)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 9220725..418e21f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1106,6 +1106,12 @@ fetch.prune::
 	If true, fetch will automatically behave as if the `--prune`
 	option was given on the command line.  See also `remote.<name>.prune`.
 
+fetch.depth::
+	If set, fetch will automatically behave as if the `--depth`
+	option was given on the command line.  This allows users to keep
+	the git directory at low space requirements, and thus comes in handy
+	for users with large binary files in the repository.
+
 format.attach::
 	Enable multipart/mixed attachments as the default for
 	'format-patch'.  The value can also be a double quoted string
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index b09a783..81131d0 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -12,6 +12,8 @@
 	`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])
 	to the specified number of commits from the tip of each remote
 	branch history. Tags for the deepened commits are not fetched.
+	You can configure git to always use the depth option, see
+	`fetch.depth` in linkgit:git-config[1]
 
 --unshallow::
 	If the source repository is complete, convert a shallow
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 7b84d35..30fa15b 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -68,6 +68,11 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
 		fetch_prune_config = git_config_bool(k, v);
 		return 0;
 	}
+	if (!strcmp(k, "fetch.depth")) {
+		if (git_config_string(&depth, k, v))
+			return -1;
+		return 0;
+	}
 	return git_default_config(k, v, cb);
 }
 
-- 
2.1.2

             reply	other threads:[~2014-12-01 19:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 19:07 Stefan Beller [this message]
2014-12-01 20:39 ` [PATCH] fetch: add a config option to always use the depth argument Junio C Hamano
2014-12-01 20:58   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417460823-17295-1-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox