summaryrefslogtreecommitdiff
path: root/rev-parse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-20 21:06:47 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-20 21:06:47 -0700
commit218e441daf24b9c3be0f5ec423ace5185389ca61 (patch)
tree795673cb40bd37bfb887626a13a59bed3c3d3707 /rev-parse.c
parenta8be83fe00eded0bd6cb0001879ddf211a2cf2f2 (diff)
downloadgit-218e441daf24b9c3be0f5ec423ace5185389ca61.tar.gz
Change parent syntax to "xyz^" instead of "xyz.p"
The ".pN" thing might be a common ending of a tag, and in contrast, ^ already is a special character for revisions so use that instead.
Diffstat (limited to 'rev-parse.c')
-rw-r--r--rev-parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/rev-parse.c b/rev-parse.c
index 1b08b45581..40707ac6ca 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -62,7 +62,7 @@ static int get_parent(char *name, unsigned char *result, int idx)
/*
* This is like "get_sha1()", except it allows "sha1 expressions",
- * notably "xyz.p" for "parent of xyz"
+ * notably "xyz^" for "parent of xyz"
*/
static int get_extended_sha1(char *name, unsigned char *sha1)
{
@@ -70,15 +70,15 @@ static int get_extended_sha1(char *name, unsigned char *sha1)
int len = strlen(name);
parent = 1;
- if (len > 3 && name[len-1] >= '1' && name[len-1] <= '9') {
+ if (len > 2 && name[len-1] >= '1' && name[len-1] <= '9') {
parent = name[len-1] - '0';
len--;
}
- if (len > 2 && !memcmp(name + len - 2, ".p", 2)) {
+ if (len > 1 && name[len-1] == '^') {
int ret;
- name[len-2] = 0;
+ name[len-1] = 0;
ret = get_parent(name, sha1, parent);
- name[len-2] = '.';
+ name[len-1] = '^';
if (!ret)
return 0;
}