git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Riesen <alexander.riesen@cetitec.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] Allow "clone --dissociate" to dissociate from alternates
Date: Thu, 15 Oct 2015 16:38:00 +0200	[thread overview]
Message-ID: <561FBA48.3050609@cetitec.com> (raw)
In-Reply-To: <alpine.DEB.1.00.1510151609280.31610@s15462909.onlinehome-server.info>

The option requiring the explicit reference repositories is a bit of overkill:
the alternates in the original repository *are* reference repositories and
would be dissociated from should one pass any reference repository (even an
unrelated one).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

On 10/15/2015 04:11 PM, Johannes Schindelin wrote:
> On Thu, 15 Oct 2015, Alexander  Riesen wrote:
 >
 >> The "--dissociate" option required reference repositories, which sometimes
 >> demanded a look into the objects/info/alternates by the user. As this
 >> is something which can be figured out automatically, do it in the
 >> clone unless there is no other reference repositories.
 >
 > Would it not make sense to reuse the copy_alternates() function to simply
 > copy the alternates and let `--dissociate` run its course with the copied
 > .objects/info/alternate file? That would make for less new code...

IIUC, I should validate the alternates in the source repository...
But, the only thing the user looses if it is not validated, is the nice
warning regarding no reference repositories to dissociate from, right?

So maybe we can just remove the reset of option_dissociate and be done with
it? I would actually suggest removing the warning as well: the alternates are
something to dissociate from. And I see no harm otherwise.

How about this instead?

  builtin/clone.c | 4 ----
  1 file changed, 4 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 578da85..b33d6f9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -947,10 +947,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)

      if (option_reference.nr)
          setup_reference();
-    else if (option_dissociate) {
-        warning(_("--dissociate given, but there is no --reference"));
-        option_dissociate = 0;
-    }

      fetch_pattern = value.buf;
      refspec = parse_fetch_refspec(1, &fetch_pattern);
-- 
2.6.1.151.g74e8091

  reply	other threads:[~2015-10-15 14:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 11:28 [PATCH] Use the alternates of the source repository for dissociating clone Alexander Riesen
2015-10-15 14:11 ` Johannes Schindelin
2015-10-15 14:38   ` Alexander Riesen [this message]
2015-10-21  8:13     ` [PATCH] Allow "clone --dissociate" to dissociate from alternates Alexander Riesen
2015-10-21 17:52       ` Junio C Hamano
2015-10-22 13:59         ` [PATCH] Consider object stores in alternates during a dissociating clone Alexander Riesen
2015-10-22 16:12           ` Junio C Hamano
2015-10-22 16:41             ` Alexander Riesen
2015-10-22 17:50               ` Junio C Hamano
2015-10-22 18:08                 ` Alexander Riesen
2015-10-22 18:33                   ` Junio C Hamano
2015-10-22 18:48                     ` Junio C Hamano
2015-10-22 20:10                       ` [PATCH] Documentation: AsciiDoc spells em-dash as double-dashes, not triple Junio C Hamano
2015-10-23  1:14                   ` [PATCH] Consider object stores in alternates during a dissociating clone Johannes Löthberg
2015-10-15 21:59 ` [PATCH] Use the alternates of the source repository for " Junio C Hamano
2015-10-16  7:00   ` Alexander Riesen

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=561FBA48.3050609@cetitec.com \
    --to=alexander.riesen@cetitec.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    /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).