diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-12 16:53:28 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-12 16:56:43 +0900 |
commit | d1839769ee37c779632f1581724864e957381c04 (patch) | |
tree | 0b3d3c7b344ace92ac550c5f89c91e67f0d5e86c /load-git.c | |
parent | f692c39ac793ed999d47d29fd2306910403ad06a (diff) | |
download | subsurface-d1839769ee37c779632f1581724864e957381c04.tar.gz |
Fix git loading of odd locales
This should make git loading be able to load git saves with arbitrary
weekday names. Even strange German ones.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'load-git.c')
-rw-r--r-- | load-git.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/load-git.c b/load-git.c index f4467d178..c1007358c 100644 --- a/load-git.c +++ b/load-git.c @@ -934,15 +934,21 @@ static int dive_directory(const char *root, const char *name, int timeoff) { int yyyy = -1, mm = -1, dd = -1; int h, m, s; - int mday_off = timeoff - 7; - int month_off = mday_off - 3; - int year_off = month_off - 5; + int mday_off, month_off, year_off; struct tm tm; - /* There has to be a mday */ - if (mday_off < 0) + /* Skip the '-' before the time */ + mday_off = timeoff; + if (!mday_off || name[--mday_off] != '-') return GIT_WALK_SKIP; - if (name[timeoff-1] != '-') + /* Skip the day name */ + while (mday_off > 0 && name[--mday_off] != '-') + /* nothing */; + + mday_off = mday_off - 2; + month_off = mday_off - 3; + year_off = month_off - 5; + if (mday_off < 0) return GIT_WALK_SKIP; /* Get the time of day */ |