public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <sbeller@google•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] fetch: add a config option to always use the depth argument
Date: Mon, 01 Dec 2014 12:58:16 -0800	[thread overview]
Message-ID: <xmqqvblvnl3r.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqzjb7nlyx.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Mon, 01 Dec 2014 12:39:34 -0800")

Junio C Hamano <gitster@pobox•com> writes:

> Stefan Beller <sbeller@google•com> writes:
>
>> +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.
>> +
>
> Hmm, is this something a user would typically want repository-wide?
> I am wondering if "remote.$nick.fetchDepth" or something scoped to
> remote is more appropriate.

Regardless of what configuration variable is used, I think setting
depth directly from the config will mean the user cannot defeat a
configured value by passing --unshallow because of this code
sequence in builtin/fetch.c; am I mistaken?

	...
	git_config(git_fetch_config, NULL);
	argc = parse_options(argc, argv, prefix,
			     builtin_fetch_options, builtin_fetch_usage, 0);
	if (unshallow) {
		if (depth)
			die(_("--depth and --unshallow cannot be used together"));
	...

I think depth variable should be left alone.

The right solution may be to leave the above "unshallow and depth
are incompatible" check done only for the command line options as
the original code, and much later in the code path after you figure
out which remote we are talking to, only when neither --depth nor
--unshallow is given, consult the configuration system to see if
there is a default, perhaps in prepare_transport().  That approach
will let you later support "remote.$nick.fetchDepth", even if you
start with a repository-wide "fetch.depth" option, I would think.

      reply	other threads:[~2014-12-01 20:58 UTC|newest]

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

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=xmqqvblvnl3r.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=sbeller@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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