Thread (1 message) 1 message, 1 author, 2017-06-22

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

From: Junio C Hamano <hidden>
Date: 2017-06-22 19:37:17

Phillip Wood [off-list ref] writes:
quoted hunk
From: Phillip Wood <redacted>

This is what the other routines in Git.pm do if there's an error.

Signed-off-by: Phillip Wood <redacted>
---
 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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help