Showing 3 changed files with 27 additions and 4 deletions
+8 -2
lib/Gitprep/Manager.pm
... ...
@@ -377,14 +377,20 @@ EOS
377 377
     "original_user not null default ''",
378 378
     "original_pid integer not null default 0",
379 379
     "private not null default 0",
380
-    "ignore_space_change not null default 0"
380
+    "ignore_space_change not null default 0",
381
+    "guess_encoding not null default ''"
381 382
   ];
382 383
   for my $column (@$project_columns) {
383 384
     eval { $dbi->execute("alter table project add column $column") };
384 385
   }
385 386
 
386 387
   # Check project table
387
-  eval { $dbi->select([qw/default_branch original_user original_pid/], table => 'project') };
388
+  eval {
389
+    $dbi->select(
390
+      [qw/default_branch original_user original_pid private ignore_space_change guess_encoding/],
391
+      table => 'project'
392
+    );
393
+  };
388 394
   if ($@) {
389 395
     my $error = "Can't create project table properly: $@";
390 396
     $self->app->log->error($error);
+19 -2
templates/settings.html.ep
... ...
@@ -79,6 +79,7 @@
79 79
       my $default_branch = param('default-branch');
80 80
       my $private = param('private');
81 81
       my $ignore_space_change = param('ignore_space_change');
82
+      my $guess_encoding = param('guess_encoding');
82 83
       
83 84
       my $params = {};
84 85
       if (defined $default_branch) {
... ...
@@ -90,6 +91,9 @@
90 91
       if (defined $ignore_space_change) {
91 92
         $params->{ignore_space_change} = $ignore_space_change ? 1 : 0;
92 93
       }
94
+      if (defined $guess_encoding) {
95
+        $params->{guess_encoding} = $guess_encoding;
96
+      }
93 97
       
94 98
       my $dbi = app->dbi;
95 99
       eval {
... ...
@@ -248,12 +252,25 @@
248 252
                   'ignore_space_change',
249 253
                   where => {user_id => $user, name => $project}
250 254
                 )->value;
251
-                my @checked = $ignore_space_change ? (checked => undef) : ();
255
+                my @ignore_space_change_checked = $ignore_space_change ? (checked => undef) : ();
252 256
               %>
253 257
               <span>Ignore space change in diff</span>
254 258
               
255 259
               %= hidden_field 'ignore_space_change' => 0;
256
-              %= check_box 'ignore_space_change' => 1, @checked;
260
+              %= check_box 'ignore_space_change' => 1, @ignore_space_change_checked;
261
+            </li>
262
+            <li>
263
+              <%
264
+                my $guess_encoding = app->dbi->model('project')->select(
265
+                  'guess_encoding',
266
+                  where => {user_id => $user, name => $project}
267
+                )->value;
268
+              %>
269
+              <div>Guess encoding</div>
270
+              (Guess encoding from the following encoding list. default is "UTF-8".
271
+              if your source code is different from UTF-8, set comma separated encoding list.
272
+              For example "cp932,UTF-8")
273
+              %= text_field 'guess_encoding' => $guess_encoding;
257 274
             </li>
258 275
             <li>
259 276
               <input type="submit" class="btn" value="Save">
BIN
xt/basic.db
Binary file not shown.