diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-08-17 17:36:22 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-17 17:36:22 -0700 |
commit | 324b6b1678a3c1c6179f53fccf4e5fe2cef43240 (patch) | |
tree | d59ceeace1abf83b562bd8bac5285130f86c9593 /test-path-utils.c | |
parent | da68bf337664f6160d56153cfe4a38c49a5185f3 (diff) | |
parent | 9e8137238d1b7f558dd61c8737883e73c8368e4b (diff) | |
download | git-324b6b1678a3c1c6179f53fccf4e5fe2cef43240.tar.gz git-324b6b1678a3c1c6179f53fccf4e5fe2cef43240.tar.xz |
Merge branch 'mh/check-attr-relative'
* mh/check-attr-relative: (29 commits)
test-path-utils: Add subcommand "prefix_path"
test-path-utils: Add subcommand "absolute_path"
git-check-attr: Normalize paths
git-check-attr: Demonstrate problems with relative paths
git-check-attr: Demonstrate problems with unnormalized paths
git-check-attr: test that no output is written to stderr
Rename git_checkattr() to git_check_attr()
git-check-attr: Fix command-line handling to match docs
git-check-attr: Drive two tests using the same raw data
git-check-attr: Add an --all option to show all attributes
git-check-attr: Error out if no pathnames are specified
git-check-attr: Process command-line args more systematically
git-check-attr: Handle each error separately
git-check-attr: Extract a function error_with_usage()
git-check-attr: Introduce a new variable
git-check-attr: Extract a function output_attr()
Allow querying all attributes on a file
Remove redundant check
Remove redundant call to bootstrap_attr_stack()
Extract a function collect_all_attrs()
...
Diffstat (limited to 'test-path-utils.c')
-rw-r--r-- | test-path-utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test-path-utils.c b/test-path-utils.c index e7671593d..3bc20e91d 100644 --- a/test-path-utils.c +++ b/test-path-utils.c @@ -20,12 +20,34 @@ int main(int argc, char **argv) return 0; } + if (argc >= 2 && !strcmp(argv[1], "absolute_path")) { + while (argc > 2) { + puts(absolute_path(argv[2])); + argc--; + argv++; + } + return 0; + } + if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) { int len = longest_ancestor_length(argv[2], argv[3]); printf("%d\n", len); return 0; } + if (argc >= 4 && !strcmp(argv[1], "prefix_path")) { + char *prefix = argv[2]; + int prefix_len = strlen(prefix); + int nongit_ok; + setup_git_directory_gently(&nongit_ok); + 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)"); |