johnmehr / gitup

A minimalist, dependency-free FreeBSD program to clone/pull Git repositories.
BSD 2-Clause "Simplified" License
51 stars 9 forks source link

Write .gituprevision in the root of the clone #19

Closed michael-o closed 3 years ago

michael-o commented 3 years ago

Since I moved from Subversion to gitup I do not see revision in uname -a anymore. This is especially problematic for users which have to report issues and requested the used commit id. I know that this is not really related to gitup, but here is my proposal:

When a clone or a pull happens to a section create/update a .gituprevision file in that same target directory ideally to the same format the official Git client would procude. In the next step sys/conf/newvers.sh can be modified to readin that file and make uname -a just like using Subversion or Git.

Git code: https://github.com/freebsd/freebsd-src/blob/098dbd7ff7f3da9dda03802cdb2d8755f816eada/sys/conf/newvers.sh#L249-L264

johnmehr commented 3 years ago

Hello,

I just pushed out an update to create a .gituprevision file in the target path which stores the branch, a '-' and the first nine digits of the want commit. How does it look?

michael-o commented 3 years ago

Thank you for the quick turnaround, looking into. A hyphen might be problematic because a vendor branch can contain a hyphen. When newvers.sh should perform a cut it should expect maybe just two columns instead of 2+.

michael-o commented 3 years ago

Tested. Works for me. I would highly prefer something which is not allowed in a branch name. Colon seems good to me.

johnmehr commented 3 years ago

I just changed the separator to a colon and pushed the changes.

michael-o commented 3 years ago

Works for me! Happily closing this issue.

emaste commented 3 years ago

sys/conf/newvers.sh can be modified Will you submit a patch for that as well?

michael-o commented 3 years ago

sys/conf/newvers.sh can be modified Will you submit a patch for that as well?

If you'd review, I'd be happy to next week.

emaste commented 3 years ago

Sounds good, tag me on the review and I'll look.

michael-o commented 3 years ago

Here you go folks: https://github.com/freebsd/freebsd-src/pull/449