All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fast-import: add ignore non-existent files option.
Date: Mon, 1 Sep 2008 15:38:03 -0700	[thread overview]
Message-ID: <20080901223802.GK7482@spearce.org> (raw)
In-Reply-To: <1220308173-20392-1-git-send-email-felipe.contreras@gmail.com>

Felipe Contreras <felipe.contreras@gmail.com> wrote:
> This is useful for SCMs that don't have proper changesets in each
> revision (monotone).
 
> +--tolerant::
> +	Avoid fatal exceptions when actions are executed in non-existent
> +	files.  For example removing a file that is not there.
> +

Yea.  But I'm not sure --tolerant is the best name.  --ignore-errors
or --treat-errors-as-warnings sounds better to me.
  
> diff --git a/fast-import.c b/fast-import.c
> index 7089e6f..01be3fa 100644
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -345,6 +345,7 @@ static struct recent_command *rc_free;
>  static unsigned int cmd_save = 100;
>  static uintmax_t next_mark;
>  static struct strbuf new_data = STRBUF_INIT;
> +static int tolerant;
>  
>  static void write_branch_report(FILE *rpt, struct branch *b)
>  {
> @@ -1993,8 +1994,15 @@ static void file_change_cr(struct branch *b, int rename)
>  		tree_content_remove(&b->branch_tree, s, &leaf);
>  	else
>  		tree_content_get(&b->branch_tree, s, &leaf);
> -	if (!leaf.versions[1].mode)
> -		die("Path %s not in branch", s);
> +	if (!leaf.versions[1].mode) {
> +		if (tolerant) {
> +			if (leaf.tree)
> +				release_tree_content_recursive(leaf.tree);
> +			warning("Path %s not in branch", s);
> +			return;
> +		} else
> +			die("Path %s not in branch", s);
> +	}
>  	tree_content_set(&b->branch_tree, d,
>  		leaf.versions[1].sha1,
>  		leaf.versions[1].mode,
> @@ -2447,6 +2455,8 @@ int main(int argc, const char **argv)
>  			show_stats = 0;
>  		else if (!strcmp(a, "--stats"))
>  			show_stats = 1;
> +		else if (!strcmp(a, "--tolerant"))
> +			tolerant = 1;
>  		else
>  			die("unknown option %s", a);
>  	}

-- 
Shawn.

  reply	other threads:[~2008-09-01 22:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-01 13:20 [PATCH 1/1] fast-import: show a warning for non-existent files Felipe Contreras
2008-09-01 19:04 ` Junio C Hamano
2008-09-01 21:58   ` Felipe Contreras
2008-09-01 19:25 ` Shawn O. Pearce
2008-09-01 22:01   ` Felipe Contreras
2008-09-01 22:30     ` [PATCH] fast-import: add ignore non-existent files option Felipe Contreras
2008-09-01 22:38       ` Shawn O. Pearce [this message]
2008-09-01 22:52         ` Felipe Contreras
2008-09-02  4:39           ` Shawn O. Pearce
2008-09-02  4:53             ` Junio C Hamano
2008-09-02  5:35               ` Shawn O. Pearce
2008-09-02  7:36                 ` Junio C Hamano
2008-09-02  7:48                   ` Felipe Contreras
2008-09-01 23:04       ` Junio C Hamano
2008-09-01 23:25         ` Felipe Contreras
2008-09-02  2:07           ` Junio C Hamano
2008-09-02  7:57             ` Felipe Contreras

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=20080901223802.GK7482@spearce.org \
    --to=spearce@spearce.org \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.