Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Avoid ambiguity between refname and filename in rev-parse
author
Linus Torvalds
<torvalds@osdl.org>
Tue, 18 Oct 2005 07:16:45 +0000
(
00:16
-0700)
committer
Junio C Hamano
<junkio@cox.net>
Tue, 18 Oct 2005 07:16:45 +0000
(
00:16
-0700)
Although it really is very convenient, not requiring explicit
'-r' option to name revs is sometimes ambiguous.
Usually we allow a "--" to say where a filename starts when it
_is_ ambiguous. However, we fail that at times. In particular,
git-rev-parse fails it.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
rev-parse.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
cdb3950
)
diff --git
a/rev-parse.c
b/rev-parse.c
index 41b9dae429d2b423f57af4f4e091accfd9697022..85230dfaa9d943938bffa0266490fd6956ee7a4f 100644
(file)
--- a/
rev-parse.c
+++ b/
rev-parse.c
@@
-151,6
+151,12
@@
static void show_datestring(const char *flag, const char *datestr)
show(buffer);
}
show(buffer);
}
+static void show_file(const char *arg)
+{
+ if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
+ show(arg);
+}
+
int main(int argc, char **argv)
{
int i, as_is = 0, verify = 0;
int main(int argc, char **argv)
{
int i, as_is = 0, verify = 0;
@@
-162,7
+168,7
@@
int main(int argc, char **argv)
char *dotdot;
if (as_is) {
char *dotdot;
if (as_is) {
- show(arg);
+ show
_file
(arg);
continue;
}
if (*arg == '-') {
continue;
}
if (*arg == '-') {
@@
-282,9
+288,7
@@
int main(int argc, char **argv)
}
if (verify)
die("Needed a single revision");
}
if (verify)
die("Needed a single revision");
- if ((filter & (DO_NONFLAGS|DO_NOREV)) ==
- (DO_NONFLAGS|DO_NOREV))
- show(arg);
+ show_file(arg);
}
show_default();
if (verify && revs_count != 1)
}
show_default();
if (verify && revs_count != 1)