git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee <dstolee@microsoft.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	"sbeller@google.com" <sbeller@google.com>,
	"jnareb@gmail.com" <jnareb@gmail.com>
Subject: Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
Date: Fri, 1 Jun 2018 07:46:08 -0400	[thread overview]
Message-ID: <95354da4-7590-4fa6-de83-30f883d77188@gmail.com> (raw)
In-Reply-To: <xmqqd0xb9r1k.fsf@gitster-ct.c.googlers.com>

On 5/31/2018 10:30 PM, Junio C Hamano wrote:
> Derrick Stolee <dstolee@microsoft.com> writes:
>
>> Shallow clones do not interact well with the commit-graph feature for
>> several reasons. Instead of doing the hard thing to fix those
>> interactions, instead prevent reading or writing a commit-graph file for
>> shallow repositories.
> The latter instead would want to vanish, I would guess.

Do you mean that we should call destroy_commit_graph() if we detect a 
shallow repository during write_commit_graph(), then I can make that change.

>
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
>> ---
>>   commit-graph.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/commit-graph.c b/commit-graph.c
>> index 95af4ed519..80e377b90f 100644
>> --- a/commit-graph.c
>> +++ b/commit-graph.c
>> @@ -208,6 +208,9 @@ static void prepare_commit_graph(void)
>>   		return;
>>   	prepare_commit_graph_run_once = 1;
>>   
>> +	if (is_repository_shallow())
>> +		return;
>> +
>>   	obj_dir = get_object_directory();
>>   	prepare_commit_graph_one(obj_dir);
>>   	prepare_alt_odb();
>> @@ -711,6 +714,15 @@ void write_commit_graph(const char *obj_dir,
>>   	int num_extra_edges;
>>   	struct commit_list *parent;
>>   
>> +	/*
>> +	 * Shallow clones are not supproted, as they create bad
>> +	 * generation skips as they are un-shallowed.
>> +	 */
>> +	if (is_repository_shallow()) {
>> +		warning("writing a commit-graph in a shallow repository is not supported");
>> +		return;
>> +	}
>> +
>>   	oids.nr = 0;
>>   	oids.alloc = approximate_object_count() / 4;


  reply	other threads:[~2018-06-01 11:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 17:40 [RFC PATCH 0/6] Fix commit-graph/graft/replace/shallow combo Derrick Stolee
2018-05-31 17:41 ` [RFC PATCH 1/6] DO NOT MERGE: compute commit-graph on every commit Derrick Stolee
2018-05-31 19:39   ` Stefan Beller
2018-05-31 17:41 ` [RFC PATCH 2/6] DO NOT MERGE: write commit-graph on every fetch Derrick Stolee
2018-05-31 17:41 ` [RFC PATCH 3/6] commit-graph: enable replace-object and grafts Derrick Stolee
2018-06-09 15:47   ` Jakub Narebski
2018-05-31 17:41 ` [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow Derrick Stolee
2018-05-31 19:07   ` Stefan Beller
2018-06-01  2:30   ` Junio C Hamano
2018-06-01 11:46     ` Derrick Stolee [this message]
2018-06-02 18:39       ` Jakub Narebski
2018-06-04  2:19       ` Junio C Hamano
2018-05-31 17:41 ` [RFC PATCH 5/6] fetch: destroy commit graph on shallow parameters Derrick Stolee
2018-05-31 19:29   ` Stefan Beller
2018-05-31 17:41 ` [RFC PATCH 6/6] commit-graph: revert to odb on missing parents Derrick Stolee
2018-05-31 18:33 ` [RFC PATCH 0/6] Fix commit-graph/graft/replace/shallow combo Stefan Beller
2018-06-01  1:09   ` Derrick Stolee
2018-06-08 11:59 ` Jakub Narebski

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=95354da4-7590-4fa6-de83-30f883d77188@gmail.com \
    --to=stolee@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=sbeller@google.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;
as well as URLs for NNTP newsgroup(s).