summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 62476c8)
raw | patch | inline | side by side (parent: 62476c8)
author | Jeff King <peff@peff.net> | |
Thu, 2 Nov 2006 07:22:49 +0000 (02:22 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 2 Nov 2006 08:11:30 +0000 (00:11 -0800) |
We forgot to add prefix to the given path.
[jc: interestingly enough, Jeff King had the same idea after I
pushed mine out to "pu", and his patch was cleaner, so I dropped
mine.]
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
[jc: interestingly enough, Jeff King had the same idea after I
pushed mine out to "pu", and his patch was cleaner, so I dropped
mine.]
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-pickaxe.c | patch | blob | history |
diff --git a/builtin-pickaxe.c b/builtin-pickaxe.c
index c9405e918bc5e6da94c61f7fe2cdd00b5da44508..f6e861a26dbda100ea6aeb884ad62c75872a8e76 100644 (file)
--- a/builtin-pickaxe.c
+++ b/builtin-pickaxe.c
return score;
}
+static const char *add_prefix(const char *prefix, const char *path)
+{
+ if (!prefix || !prefix[0])
+ return path;
+ return prefix_path(prefix, strlen(prefix), path);
+}
+
int cmd_pickaxe(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
/* (1) */
if (argc <= i)
usage(pickaxe_usage);
- path = argv[i];
+ path = add_prefix(prefix, argv[i]);
if (i + 1 == argc - 1) {
if (unk != 1)
usage(pickaxe_usage);
if (seen_dashdash) {
if (seen_dashdash + 1 != argc - 1)
usage(pickaxe_usage);
- path = argv[seen_dashdash + 1];
+ path = add_prefix(prefix, argv[seen_dashdash + 1]);
for (j = i; j < seen_dashdash; j++)
argv[unk++] = argv[j];
}
else {
/* (3) */
- path = argv[i];
+ path = add_prefix(prefix, argv[i]);
if (i + 1 == argc - 1) {
final_commit_name = argv[i + 1];
* old-style
*/
if (unk == 1 && !has_path_in_work_tree(path)) {
- path = argv[i + 1];
+ path = add_prefix(prefix, argv[i + 1]);
final_commit_name = argv[i];
}
}