Of course, one way would be to have a revision number server, which dishes up sequential numbers on a first-come first-served basis, but that involves a centralised server which defeats the point of distributed versioning.
That's exactly it; you just use git for that too.
You could write a simple shell/Perl/awk/Python script in a
dedicated git tree (
versions.git?) that manages version numbers, authors, and short descriptions in simple text files, say
YYYY-MM-DD HH:MM:SS major.minor.revision git-commit-tag author@email DescriptionIf you name the files according to their project, you now have an organization-wide database of version numbers, git commit tags (relevant hash), timestamps, authors, and internal descriptions. (Date would be obtained automatically, and author would be taken from current git configuration.)
Note that I chose the field order above so that
sorting it will yield date and time order.
Since the script would
pull its own
HEAD first, then construct the new line, append it, and commit it, it would not be "instant"; it would also have to do a re-
pull to verify the chosen version number is still unique in the head (or revert the commit and fail), to be robust. (Because of this, it is better to implement it in parts: say first part a shell script to do the pull, then
exec the actual update/modification script.)
However, with a little care, the command line interface could be very simple. In my experience, such "registering" of a version number might take 3-10 seconds per run, depending on the bandwidth to and load of the git server you're using. Not instant, but not aggravatingly slow either.
Hopefully, you'll see how git sits right in to the modular
Unix philosophy; that to maintain version numbers in an organization,
a separate git repository for it is just about perfect match. (Consider, for example, that git will then maintain a separate log of the commits; something not provided by a straight-up database. This can be useful if you have an occasional asshat among your workforce who tries to find others to blame for their own mistakes. Updates and fixes, even done by hand directly to the database file, can be allowed, as long as no collisions are generated by such edits. Again, the commits will leave a log that can be consulted to see if something odd ever occurs.)
As I've mentioned before, you are still looking for a
single tool to accomplish the task at hand; but really, with Linux – and Unix in general – is better geared towards splitting the task into parts, each solvable using one or more separate tools.
git, or rather its parts, are very much such separated modular tool-lets.
(Note: No snide or denigrating tone is intended, I'm aiming at helpful, only. Here I've tried to show a
pattern of solutions to this kind of problems, hopefully showing the "mindset" behind the tool. I'm highlighting the difference, because in my (teaching/tutoring/mentoring) experience, it is this "mindset" or paradigm or approach, that is the hardest to acquire. When one "groks" it, pieces just start to fall into place. I also like the term "grok", because this has nothing to do with intelligence or such; it really is something more akin to social or cultural details. The more experience one has, the harder these can be to "grok", no matter how smart or intelligent or capable one is. It is strange, and I don't understand why it is; but it is what I have observed across dozens of very smart, capable people. Myself very much included; I regularly make a silly ass of myself by not grokking a thing before I stuff my opinion into the subject matter, even though I
know better.)