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

[RFC 6/6] test-path-utils: Add subcommand "prefix_path"

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jul 28, 2011, 10:37 UTC
Message-ID
<1311849425-9057-7-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1311849425-9057-1-git-send-email-mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 test-path-utils.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/test-path-utils.c b/test-path-utils.c
index a410e30..471406c 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -35,6 +35,19 @@ int main(int argc, char **argv)
 		return 0;
 	}
 
+	if (argc >= 4 && !strcmp(argv[1], "prefix_path")) {
+		int nongit_ok;
+		setup_git_directory_gently(&nongit_ok);
+		char *prefix = argv[2];
+		int prefix_len = strlen(prefix);
+		while (argc > 3) {
+			puts(prefix_path(prefix, prefix_len, argv[3]));
+			argc--;
+			argv++;
+		}
+		return 0;
+	}
+
 	if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) {
 		char *prefix = strip_path_suffix(argv[2], argv[3]);
 		printf("%s\n", prefix ? prefix : "(null)");
-- 
1.7.6.8.gd2879
Previous: Michael HaggertyNext: Junio C Hamano
Message 13 of 15 in “[RFC 0/6] git-check-attr should work for relative paths”
  1. Michael HaggertyJul 28, 2011
  2. 1/6 git-check-attr: test that no output is written to stderrMichael Haggerty, Jul 28, 2011
  3. 2/6 git-check-attr: Demonstrate problems with unnormalized pathsMichael Haggerty, Jul 28, 2011
  4. 3/6 git-check-attr: Demonstrate problems with relative pathsMichael Haggerty, Jul 28, 2011
  5. 4/6 git-check-attr: Normalize pathsMichael Haggerty, Jul 28, 2011
  6. Junio C HamanoAug 2, 2011
  7. Michael HaggertyAug 4, 2011
  8. Junio C HamanoAug 4, 2011
  9. Michael HaggertyAug 5, 2011
  10. Junio C HamanoAug 5, 2011
  11. Michael HaggertyAug 7, 2011
  12. 5/6 test-path-utils: Add subcommand "absolute_path"Michael Haggerty, Jul 28, 2011
  13. 6/6 test-path-utils: Add subcommand "prefix_path"Michael Haggerty, Jul 28, 2011
  14. Junio C HamanoAug 2, 2011
  15. Michael HaggertyAug 4, 2011

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.