Am Sonntag, 28. Oktober 2012 18:18:07 UTC+1 schrieb P Rouleau: > > Would it be fine if the "version file" was only created in the working > directory and not push on the server?
Yes > And instead of using the date of the last checkout it was the date of the > last commit? The date of the last (head) commit can be used > You use the term "push" in your reply but I get the felling it could be > replaced with "written". > push in this case, I push the data from my local repo to the server repo and the server repo should create the docu > > I suggest a simple script, ie update_version.sh, or maybe you already have > a script to generate the documentation, so you can add the commands in it. > > You can have the name of the current branch with this command: > git symbolic-ref HEAD 2>/dev/null > > and the date of the last commit with: > git log -n1 --tformat="%cd" > > If you absolutely want the checkout date, I do not see how it can be made. > I though about cheating and use the date of .git/HEAD but it do not change > on a pull. It only change on checkout. > > I have used in the post-received hook this code line: REPOVERSION="$(/usr/bin/git --git-dir=$GITDIR symbolic-ref HEAD 2> /dev/null | cut -b 12-)-$(/usr/bin/git --git-dir=$GITDIR log --pretty=format:'%h, %ad' -1)" The content is written via grep / echo to the documentation file and after that I run doxygen for creating the documentation. Before I run the version collection, I update the git repo on the server with: /usr/bin/git --git-dir=$GITDIR reset --hard > /dev/null 2>&1 /usr/bin/git --git-dir=$GITDIR pull > /dev/null 2>&1 > git offers the command "describe" who can be used to generate a version > string, but it needs a tag and it is not confined to one branch. I do not > think it is want you want, but I mention it just in case. Said you have a > tag v1.0 and 13 commits since then, describe will returns v1.0.13. > > Thats fine, I think I can use that later Thanks -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/HzDbadp7fMMJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
