summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cbdffe4)
raw | patch | inline | side by side (parent: cbdffe4)
author | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 24 Mar 2009 23:31:01 +0000 (16:31 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 25 Mar 2009 00:02:20 +0000 (17:02 -0700) |
We already skip over loose refs under $GIT_DIR/refs if the name
ends with ".lock", so creating a branch named "foo.lock" will not
appear in the output of "git branch", "git for-each-ref", nor will
its commit be considered reachable by "git rev-list --all".
In the latter case this is especially evil, as it may cause
repository corruption when objects reachable only through such a
ref are deleted by "git prune".
It should be reasonably safe to deny use of ".lock" as a ref suffix.
In prior versions of Git such branches would be "phantom branches";
you can create it, but you can't see it in "git branch" output.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ends with ".lock", so creating a branch named "foo.lock" will not
appear in the output of "git branch", "git for-each-ref", nor will
its commit be considered reachable by "git rev-list --all".
In the latter case this is especially evil, as it may cause
repository corruption when objects reachable only through such a
ref are deleted by "git prune".
It should be reasonably safe to deny use of ".lock" as a ref suffix.
In prior versions of Git such branches would be "phantom branches";
you can create it, but you can't see it in "git branch" output.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-check-ref-format.txt | patch | blob | history | |
refs.c | patch | blob | history |
index d23fd219da8dce05712d76aad5482ca7a420a533..9b707a7030b0128a32e3290f2325754d608624e3 100644 (file)
. They cannot end with a slash `/` nor a dot `.`.
+. They cannot end with the sequence `.lock`.
+
. They cannot contain a sequence `@{`.
These rules makes it easy for shell script based tools to parse
index e355489e512e82df8e7ed22111157220eb01efc8..f3fdcbd202ab8ac7970f0e8c8cc9b79846c8ff9b 100644 (file)
--- a/refs.c
+++ b/refs.c
* - it has double dots "..", or
* - it has ASCII control character, "~", "^", ":" or SP, anywhere, or
* - it ends with a "/".
+ * - it ends with ".lock"
*/
static inline int bad_ref_char(int ch)
return CHECK_REF_FORMAT_ERROR;
if (level < 2)
return CHECK_REF_FORMAT_ONELEVEL;
+ if (has_extension(ref, ".lock"))
+ return CHECK_REF_FORMAT_ERROR;
return ret;
}
}