git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: SZEDER Gábor <szeder.dev@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: SZEDER Gábor <szeder.dev@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] submodule.c: report the submodule that an error occurs in
Date: Fri, 22 Jun 2018 10:17:13 +0200
Message-ID: <20180622081713.5360-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <20180620223253.226092-1-sbeller@google.com>


> When an error occurs in updating the working tree of a submodule in
> submodule_move_head, tell the user which submodule the error occurred in.
> 
> The call to read-tree contains a super-prefix, such that the read-tree
> will correctly report any path related issues, but some error messages
> do not contain a path, for example:
> 
>   ~/gerrit$ git checkout --recurse-submodules origin/master
>   ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a
> 
> Give the hint which submodule has a problem.
> 
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  submodule.c               | 2 +-
>  t/lib-submodule-update.sh | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/submodule.c b/submodule.c
> index 939d6870ecd..ebd092a14fd 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,
>  	argv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());
>  
>  	if (run_command(&cp)) {
> -		ret = -1;
> +		ret = error(_("Submodule '%s' could not be updated."), path);

This is a translated error message ...

>  		goto out;
>  	}
>  
> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
> index 1f38a85371a..e27f5d8541d 100755
> --- a/t/lib-submodule-update.sh
> +++ b/t/lib-submodule-update.sh
> @@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {
>  		(
>  			cd submodule_update &&
>  			git branch -t invalid_sub1 origin/invalid_sub1 &&
> -			test_must_fail $command invalid_sub1 &&
> +			test_must_fail $command invalid_sub1 2>err &&
> +			grep sub1 err &&

... so the test should use 'test_i18ngrep' to check it.

>  			test_superproject_content origin/add_sub1 &&
>  			test_submodule_content sub1 origin/add_sub1
>  		)
> -- 
> 2.18.0.rc2.346.g013aa6912e-goog
> 
> 

  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 22:32 Stefan Beller
2018-06-21 21:00 ` Junio C Hamano
2018-06-22  8:17 ` SZEDER Gábor [this message]
2018-06-25 15:58   ` Junio C Hamano
2018-06-27 17:02     ` Stefan Beller

Reply instructions:

You may reply publically 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180622081713.5360-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --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

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox