diff --git a/rev-parse.c b/rev-parse.c
index 9cec33b8c00c322d6acde3e588a5c1dfe53f948d..62e16af33c29ddd6a9c8b2d9755dc11804d86bc4 100644 (file)
--- a/rev-parse.c
+++ b/rev-parse.c
"--header",
"--max-age=",
"--max-count=",
"--header",
"--max-age=",
"--max-count=",
- "--merge-order",
"--min-age=",
"--no-merges",
"--objects",
"--min-age=",
"--no-merges",
"--objects",
+ "--objects-edge",
"--parents",
"--pretty",
"--parents",
"--pretty",
- "--show-breaks",
"--sparse",
"--topo-order",
"--sparse",
"--topo-order",
+ "--date-order",
"--unpacked",
NULL
};
"--unpacked",
NULL
};
show(buffer);
}
show(buffer);
}
-static void show_file(const char *arg)
+static int show_file(const char *arg)
{
show_default();
{
show_default();
- if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
+ if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
show(arg);
show(arg);
+ return 1;
+ }
+ return 0;
}
int main(int argc, char **argv)
}
int main(int argc, char **argv)
unsigned char sha1[20];
const char *prefix = setup_git_directory();
unsigned char sha1[20];
const char *prefix = setup_git_directory();
+ git_config(git_default_config);
+
for (i = 1; i < argc; i++) {
for (i = 1; i < argc; i++) {
- struct stat st;
char *arg = argv[i];
char *dotdot;
char *arg = argv[i];
char *dotdot;
-
+
if (as_is) {
if (as_is) {
- show_file(arg);
+ if (show_file(arg) && as_is < 2)
+ verify_filename(prefix, arg);
continue;
}
if (!strcmp(arg,"-n")) {
continue;
}
if (!strcmp(arg,"-n")) {
if (*arg == '-') {
if (!strcmp(arg, "--")) {
if (*arg == '-') {
if (!strcmp(arg, "--")) {
- as_is = 1;
+ as_is = 2;
/* Pass on the "--" if we show anything but files.. */
if (filter & (DO_FLAGS | DO_REVS))
show_file(arg);
/* Pass on the "--" if we show anything but files.. */
if (filter & (DO_FLAGS | DO_REVS))
show_file(arg);
continue;
}
if (!strcmp(arg, "--short") ||
continue;
}
if (!strcmp(arg, "--short") ||
- !strncmp(arg, "--short=", 9)) {
+ !strncmp(arg, "--short=", 8)) {
filter &= ~(DO_FLAGS|DO_NOREV);
verify = 1;
abbrev = DEFAULT_ABBREV;
filter &= ~(DO_FLAGS|DO_NOREV);
verify = 1;
abbrev = DEFAULT_ABBREV;
- if (arg[8] == '=')
- abbrev = strtoul(arg + 9, NULL, 10);
+ if (arg[7] == '=')
+ abbrev = strtoul(arg + 8, NULL, 10);
if (abbrev < MINIMUM_ABBREV)
abbrev = MINIMUM_ABBREV;
else if (40 <= abbrev)
if (abbrev < MINIMUM_ABBREV)
abbrev = MINIMUM_ABBREV;
else if (40 <= abbrev)
dotdot = strstr(arg, "..");
if (dotdot) {
unsigned char end[20];
dotdot = strstr(arg, "..");
if (dotdot) {
unsigned char end[20];
- char *n = dotdot+2;
+ char *next = dotdot + 2;
+ char *this = arg;
*dotdot = 0;
*dotdot = 0;
- if (!get_sha1(arg, sha1)) {
- if (!*n)
- n = "HEAD";
- if (!get_sha1(n, end)) {
- show_rev(NORMAL, end, n);
- show_rev(REVERSED, sha1, arg);
- continue;
- }
+ if (!*next)
+ next = "HEAD";
+ if (dotdot == arg)
+ this = "HEAD";
+ if (!get_sha1(this, sha1) && !get_sha1(next, end)) {
+ show_rev(NORMAL, end, next);
+ show_rev(REVERSED, sha1, this);
+ continue;
}
*dotdot = '.';
}
}
*dotdot = '.';
}
show_rev(REVERSED, sha1, arg+1);
continue;
}
show_rev(REVERSED, sha1, arg+1);
continue;
}
+ as_is = 1;
+ if (!show_file(arg))
+ continue;
if (verify)
die("Needed a single revision");
if (verify)
die("Needed a single revision");
- if ((filter & DO_REVS) &&
- (filter & DO_NONFLAGS) && /* !def && */
- lstat(arg, &st) < 0)
- die("'%s': %s", arg, strerror(errno));
- as_is = 1;
- show_file(arg);
+ verify_filename(prefix, arg);
}
show_default();
if (verify && revs_count != 1)
}
show_default();
if (verify && revs_count != 1)