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

[PATCH 1/2] Git.pm: add new temp_is_locked function

From
Kyle McKay <mackyle@gmail.com>
Date
Jul 6, 2013, 03:42 UTC
Message-ID
<D34E9C76-89B8-44E6-B364-C71B2FC2AC52@gmail.com>

The temp_is_locked function can be used to determine whether or not a given name previously passed to temp_acquire is currently locked.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
---
perl/Git.pm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 7a252ef..5416b5a 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -61,7 +61,7 @@ require Exporter;
                 remote_refs prompt
                 get_tz_offset
                 credential credential_read credential_write
-                temp_acquire temp_release temp_reset temp_path);
+                temp_acquire temp_is_locked temp_release temp_reset  
temp_path);


=head1 DESCRIPTION
@@ -1206,6 +1206,21 @@ sub temp_acquire {
	$temp_fd;
}

+=item temp_is_locked ( NAME )
+
+Returns true if the file mapped to C<NAME> is currently locked.
+
+If true is returned, an attempt to C<temp_acquire()> the same C<NAME>  
will
+throw an error.
+
+=cut
+
+sub temp_is_locked {
+	my ($self, $name) = _maybe_self(@_);
+	my $temp_fd = \$TEMP_FILEMAP{$name};
+	defined $$temp_fd && $$temp_fd->opened && $TEMP_FILES{$$temp_fd} 
{locked};
+}
+
=item temp_release ( NAME )

=item temp_release ( FILEHANDLE )
-- 
1.8.3
Next: Jonathan Nieder
Message 1 of 2 in “Git.pm: add new temp_is_locked function”
  1. 1/2 Git.pm: add new temp_is_locked functionKyle McKay, Jul 6, 2013
  2. Jonathan NiederJul 7, 2013

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.