Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

test-path-utils: Add subcommand "prefix_path"

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit 9e8137238d1b7f558dd61c8737883e73c8368e4b 1 parent 87a246e
Michael Haggerty authored August 04, 2011 gitster committed August 04, 2011

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. 13  test-path-utils.c
13  test-path-utils.c
@@ -35,6 +35,19 @@ int main(int argc, char **argv)
35 35
 		return 0;
36 36
 	}
37 37
 
  38
+	if (argc >= 4 && !strcmp(argv[1], "prefix_path")) {
  39
+		char *prefix = argv[2];
  40
+		int prefix_len = strlen(prefix);
  41
+		int nongit_ok;
  42
+		setup_git_directory_gently(&nongit_ok);
  43
+		while (argc > 3) {
  44
+			puts(prefix_path(prefix, prefix_len, argv[3]));
  45
+			argc--;
  46
+			argv++;
  47
+		}
  48
+		return 0;
  49
+	}
  50
+
38 51
 	if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) {
39 52
 		char *prefix = strip_path_suffix(argv[2], argv[3]);
40 53
 		printf("%s\n", prefix ? prefix : "(null)");

0 notes on commit 9e81372

Please sign in to comment.
Something went wrong with that request. Please try again.