git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] Git::unquote_path() throw an exception on bad path

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 22, 2017, 19:37 UTC
Message-ID
<xmqqh8z7ke57.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170622102622.26147-4-phillip.wood@talktalk.net>
Phillip Wood <phillip.wood@talktalk.net> writes:
Show 22 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> This is what the other routines in Git.pm do if there's an error.
>
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
>  perl/Git.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/perl/Git.pm b/perl/Git.pm
> index 889bf88cfcd34136e24e166fb3b72cced6debf9d..51cb3446088dd12e8fd93d47b95e29fab22a8466 100644
> --- a/perl/Git.pm
> +++ b/perl/Git.pm
> @@ -1493,8 +1493,8 @@ when not using -z
>  					$_ = $2;
>  					last;
>  				}
> -				# This is malformed -- just return it as-is for now.
> -				return $_[0];
> +				# This is malformed
> +				throw Error::Simple("Invalid quoted path $_[0]");
>  			}

Output from "git grep Error::Simple" tells me that mostly we do not upcase the first word of the error message. Perhaps this should follow the convention.

It is a different matter that use of Error::Simple has been discouraged for quite some time (e.g. *1*) and we haven't been got around doing that. When the clean-up happens, this code will have to be migrated to a different mechanism together with 30+ existing uses of it; in the scope of this series, throwing of Error::Simple is consistent with the remainder of Git.pm and is a good thing.

[References]
*1* https://public-inbox.org/git/1330809281-25774-1-git-send-email-jnareb@gmail.com/
Previous: Phillip WoodNext: Phillip Wood
Message 6 of 17 in “Move unquote_path() from git-add--interactive.perl to Git.pm”
  1. 0/5 Move unquote_path() from git-add--interactive.perl to Git.pmPhillip Wood, Jun 22, 2017
  2. 2/5 Git::unquote_path() Handle '\a'Phillip Wood, Jun 22, 2017
  3. 1/5 Git.pm Add unquote_path()Phillip Wood, Jun 22, 2017
  4. Junio C HamanoJun 22, 2017
  5. 3/5 Git::unquote_path() throw an exception on bad pathPhillip Wood, Jun 22, 2017
  6. Junio C HamanoJun 22, 2017
  7. 5/5 git-add--interactive.perl: Use unquote_path() from Git.pmPhillip Wood, Jun 22, 2017
  8. 4/5 Add tests for Git::unquote_path()Phillip Wood, Jun 22, 2017
  9. Junio C HamanoJun 22, 2017
  10. Jeff KingJun 22, 2017
  11. Phillip WoodJun 30, 2017
  12. 0/4 Move unquote_path from git-add--interactive.perl to Git.pmPhillip Wood, Jun 30, 2017
  13. 1/4 add -i move unquote_path() to Git.pmPhillip Wood, Jun 30, 2017
  14. 4/4 Add tests for Git::unquote_path()Phillip Wood, Jun 30, 2017
  15. 2/4 Git::unquote_path() Handle '\a'Phillip Wood, Jun 30, 2017
  16. 3/4 Git::unquote_path() throw an exception on bad pathPhillip Wood, Jun 30, 2017
  17. Junio C HamanoJun 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.