Skip to contentSkip to conversation

Add options to specify snapshot file name, prefix

PATCH Thomas Guyot-Sionnest 1 participant 1 message Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please disregard; i've actually managed to break the patch while playing with it.

I will resubmit.

- --

Thomas

Quoted 31 lines · Thomas Guyot-Sionnest

commit b629275 implemented "smart" snapshot names and prefixes. I have scripts that used to rely on the old behaviour which allowed in some cases to have fixed prefix, and would require modifications to work with newer Gitweb.

This patch adds two parameters for overriding the snapshot name and prefix, sn and sp respectively. For example, to get a snapshot named "myproject.[suffix]" with no prefix one can add this query string:
?sn=myproject;sp=

---
 gitweb/gitweb.perl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
gitweb/gitweb.perl +2 -0
index 4f0c3bd..4820ef7 100755
@@ -756,6 +756,8 @@ our @cgi_param_mapping = (
 	searchtext => "s",
 	searchtype => "st",
 	snapshot_format => "sf",
+	snapshot_name => "sn",
+	snapshot_prefix => "sp",
 	extra_options => "opt",
 	search_use_regexp => "sr",
 	ctag => "by_tag",
@@ -6684,6 +6686,12 @@ sub git_snapshot {
 	}
 

gitweb/gitweb.perl sub git_snapshot { · line 6697

Quoted 10 lines
gitweb/gitweb.perl +6 -0
 	my ($name, $prefix) = snapshot_name($project, $hash);
+	if (defined($input_params{'snapshot_name'})) {
+		$name = $input_params{'snapshot_name'};
+	}
+	if (defined($input_params{'snapshot_prefix'})) {
+		$prefix = $input_params{'snapshot_prefix'};
+	}
 	my $filename = "$name$known_snapshot_formats{$format}{'suffix'}";
 	my $cmd = quote_command(
 		git_cmd(), 'archive',

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6yNJcACgkQ6dZ+Kt5BchZkCgCgvJ9kAF636HYCAwQ7LoWu8ckG 8+8Anj5ocii3c7vKQ2/eVjcAvDJxsvhQ
=jGwr
-----END PGP SIGNATURE-----