Comments (10)
+1
from rugged.
Time#mktime method should allow creating new Time objects with a specified tz.
Not under 1.8.7; this only applies to 1.9+. What should I do with the old Ruby? I don't see any way of defining a timezone, besides local and UTC.
from rugged.
FWIW pygit2 exposes it as part of the author information so you access it with commit.author.offset
.
from rugged.
I see. That may be a valid approach in 1.8.7, whilst in 1.9.2 we could set the offset properly in the Time object... Although I don't like the idea of having different APIs based on the version.
This ought to be a solved problem... I can't believe that 1.8.7 doesn't have proper support for timezones.
from rugged.
Yeah I'm totally baffled by not being able to create Time objects with a custom timezone in 1.8.7. I thought Grit gave back proper time objects but its ignoring the timezone entirely and uses the unix time.
I guess I like the idea of always using UTC in 1.8.7 and exposing the zone offset separately.
An alternate approach would be to expose to an ISO8601 string version of the timestamp in addition to the time object.
from rugged.
Gotcha. Do you want proper timezones in 1.9, though? Or would you rather keep the API consistent?
from rugged.
So at this point I really don't even care about the Time object. I just want an ISO8601 string representation that retains the original time zone info. This can be a totally separate accessor. Right now we're just converting the Time object into an ISO8601 string anyway so all this round-trip through Time is doing is losing data.
from rugged.
tl;dr; The offset can not always be resolved to a timezone.
The offset is the number of minutes from UTC, including the daylight saving time policy at this date.
This means:
- Some different timezones may share the same offset at some point in the year
- The same timezone may have a different offset along the year
from rugged.
That's fine. I need the information that's in the commit. I can establish time of day and approximate timezone at least.
This is really so fundamental. It should always be possible to recreate the exact same object from the data libgit2/rugged exposes. I should be able to take the information exposed by these interfaces and recreate the raw objects and have them checksum down to the same sha1. This is a really simple and important stick to measure against. If you can't recreate the object data, then I'd say it should be classified as a bug.
As of right now it's impossible to generate a same commit object from the information exposed by Rugged.
from rugged.
Fixed in #158
from rugged.
Related Issues (20)
- No documentation on how to build rugged v1.4 with ssh support HOT 2
- Cannot install 1.5.0, 1.4.4 works fine. HOT 9
- Support for .mailmap when reading authors? HOT 2
- Read files from remote repository without cloning HOT 3
- cannot load such file -- rugged/2.7/rugged (LoadError) HOT 3
- Ruby 3.2 compatibility fix is not yet released HOT 10
- Problems installing
- Release new version containing 9f9bce7 HOT 1
- Rugged::Repository.init_at does not create a branch HOT 2
- extconf.rb doesn't find libgit2 from GNU Guix HOT 2
- no tag for 1.6.3 HOT 1
- libssh2 issues with Ruby profilers -- would a workaround PR be acceptable? HOT 9
- invalid or unknown remote ssh hostkey when connecting to Github.com HOT 1
- pygit2 has Repository.merge method but Rugged does not HOT 2
- Rugged is incompatible with libgit2-1.7
- rugged does not seem to work with TruffleRuby HOT 2
- Rugged::Repository#clone_at :upstream option has no effect HOT 2
- Parent Refs Inaccurate On Shallow Graft Commits
- libgit2 1.8: TreeToTreeDiffTest#test_each_line_patch_header fails HOT 1
- LFS support? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rugged.