Hidden refs
Hi all,
We want to have our build system record, in our repo, which commits correspond to which builds.
Nominally, this is a job for tags. But we don't want to have to look at these tags all the time. We particularly just want to tag the repo when we make an actual release -- tags are a Big Deal for us.
Notes are an option, though they feel a bit heavy for this application. And although we can store the build notes in their own refspace, it would (I believe) be a little clunky to make commands like checkout and log work with the commits that were noted by the build system.
It struck me that it would be neat to have hidden refs in the refs/ directory. I experimented a bit with a "refs/.builds" directory:
* "git update-ref refs/.builds/One" fails with "Cannot lock the ref 'refs/.builds/One'." So I created a ref the regular way (refs/blah/One) and copied the "One" file into refs/.builds/.
* Commands like show, checkout, and log all worked fine with "refs/.builds/One"
* "git show-ref" ignores the entries in refs/.builds/.
* So the .builds/ refs don't show up in gitk -- yay!
* "git push origin +refs/.builds/One fails with "remote part of refspec is not a valid name in +refs/.builds/One".
* Completion in bash doesn't work with entries in refs/.builds/.
So I'm wondering if it makes sense to properly support hidden directories in refs/, and what it would take to do so. (I image, for example, that things would behave quite differently on Windows...)
Thoughts?
M.
Quoted 11 lines · Marc Branchaud
We want to have our build system record, in our repo, which commits correspond to which builds.
Nominally, this is a job for tags. But we don't want to have to look at these tags all the time. We particularly just want to tag the repo when we make an actual release -- tags are a Big Deal for us.
Notes are an option, though they feel a bit heavy for this application. And although we can store the build notes in their own refspace, it would (I believe) be a little clunky to make commands like checkout and log work with the commits that were noted by the build system.
Keep in mind that notes and tags are basically inverses as far as efficient lookup goes. If you want to map a build name or number to a commit, you would use a ref which points to a commit. But if you want to map a commit sha1 to a build number, you would use notes.
Quoted 6 lines
It struck me that it would be neat to have hidden refs in the refs/ directory. I experimented a bit with a "refs/.builds" directory:
* "git update-ref refs/.builds/One" fails with "Cannot lock the ref 'refs/.builds/One'." So I created a ref the regular way (refs/blah/One) and copied the "One" file into refs/.builds/.
Yeah, I believe "." at the front of a directory component is explicitly forbidden by check_ref_format. I don't recall whether there was a specific rationale, or whether it was simply a can of worms we didn't want to explore.
...
Look like it blames to 03feddd (git-check-ref-format: reject funny ref names., 2005-10-13). This looks like the relevant thread:
http://article.gmane.org/gmane.comp.version-control.git/9874
but I didn't read through it carefully.
-Peff
Quoted 4 lines · Jeff King
Yeah, I believe "." at the front of a directory component is explicitly forbidden by
check_ref_format. I don't recall whether there was a specific rationale, or whether it was simply a can of worms we didn't want to explore.
Is "log foo...bar" a symmetric difference between foo and bar, or is it an assymmetric one from foo and .bar?
Quoted 9 lines · Junio C Hamano
Quoted 4 lines · Jeff King
Yeah, I believe "." at the front of a directory component is explicitly forbidden by
check_ref_format. I don't recall whether there was a specific rationale, or whether it was simply a can of worms we didn't want to explore.Is "log foo...bar" a symmetric difference between foo and bar, or is it an assymmetric one from foo and .bar?
Thanks, I was sure there was a simple example of how it would make things ambiguous, but for some reason I couldn't think of one.
-Peff
Quoted 9 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 4 lines · Jeff King
Yeah, I believe "." at the front of a directory component is explicitly forbidden by
check_ref_format. I don't recall whether there was a specific rationale, or whether it was simply a can of worms we didn't want to explore.
Quoted 5 lines
Quoted 2 lines
Is "log foo...bar" a symmetric difference between foo and bar, or is it an assymmetric one from foo and .bar?
Thanks, I was sure there was a simple example of how it would make things ambiguous, but for some reason I couldn't think of one.
Of course, it points at an existing bug as well. --- the example could mean an asymmetric difference from foo. to bar ;-)
Quoted 3 lines · Junio C Hamano
Quoted 3 lines · Junio C Hamano
Quoted 2 lines
Is "log foo...bar" a symmetric difference between foo and bar, or is it an
[...]
Quoted 2 lines
Of course, it points at an existing bug as well. --- the example could mean an asymmetric difference from foo. to bar ;-)
Fixed about a year ago, I think. :) (cbdffe4, check_ref_format():
tighten refname rules, 2009-03-21, part of v1.6.3)
Quoted 7 lines
So I'm wondering if it makes sense to properly support hidden directories in
refs/, and what it would take to do so. (I image, for example, that things
would behave quite differently on Windows...)Thoughts?
We currently use refs/hidden/heads and refs/hidden/tags for hidden refs. It does require calling 'gitk --branches --tags' rather than 'gitk --all', but otherwise I like the behavior (git branch only lists refs/heads, git tag only lists ref/tags). And they never get cloned by default (they can still be fetched when needed).
Stephen
Quoted 11 lines · Stephen Bash
Quoted 5 lines
So I'm wondering if it makes sense to properly support hidden directories in refs/, and what it would take to do so. (I image, for example, that things would behave quite differently on Windows...)
Thoughts?
We currently use refs/hidden/heads and refs/hidden/tags for hidden refs. It does require calling 'gitk --branches --tags' rather than 'gitk --all', but otherwise I like the behavior (git branch only lists refs/heads, git tag only lists ref/tags). And they never get cloned by default (they can still be fetched when needed).
Hmm, maybe I'm just over-designing.
It's true that we could just use refs/builds (instead of .builds) and that those refs would need to be explicitly retrieved by anyone who wanted to see them (which is fine). And after the builds/ refs are fetched and done with, it's easy enough to get rid of them with a simple "rm -r .git/refs/builds"
It appears all I'm looking for is a way to avoid that rm command. Seems a bit silly in the end.
Thanks for the perspective!
M.