В связи с моим вопросом здесь: Git; code disappeared after mergeGit журнал и реальность несоответствие
Это случилось снова, и я не понимаю, как. Проблема в том, что строка кода была изменена в фиксации, но старая строка существует в текущей репо-версии файла, что кажется действительно странным. Кто-нибудь знает, как это происходит, и как мы его избегаем?
линия в вопросе является заголовок функции для метода create_marking
коммит, который изменил линию (как и ожидалось):
commit 925ec3c11006ccca37cf684443d0fad3e1781dca
Author: xxxx
Date: Tue Jun 4 14:55:52 2013
Comment
diff --git a/lib/services/MarkingService.class.php b/lib/services/MarkingService.class.php
index 66a33f7..acf830a 100644
--- a/lib/services/MarkingService.class.php
+++ b/lib/services/MarkingService.class.php
@@ -34,18 +34,12 @@ class MarkingService \{
return '[' . implode(',', self::getCoordinates($marking)) . ']';
\}
\}
- public function create_marking($category, $timestamp, $field_id, $lat, $lon, $accuracy, $lat2 = null, $lon2 = null, $accuracy2 = null, $spread = null, $depth = null, $comment = null) \{
+ public function create_marking($category, $timestamp, $field_id, $coordinates, $spread = null, $depth = null, $comment = null) \{
$this->validate_category($category);
$this->validate_timestamp($timestamp);
Эти следующие два коммиты, являются ЕДИНСТВЕННЫМ совершает в истории, после того, как один из приведенных выше, и, насколько я могу судить, они никоим образом не изменить линию в вопросе:
commit 2ab5fb14765caa269c027e8c57b11232b0441625
Author: xxx
Date: Thu Jul 4 13:58:26 2013
Comment
diff --git a/lib/services/MarkingService.class.php b/lib/services/MarkingService.class.php
index 66a33f7..c553876 100644
--- a/lib/services/MarkingService.class.php
+++ b/lib/services/MarkingService.class.php
@@ -8,32 +8,6 @@ class MarkingService {
return $instance;
}
- public static function getCoordinates(lmMarking $marking)
- {
- $returnValue = array($marking->getLatitude() . ',' . $marking->getLongitude());
-
- if (0 < $marking->getLatitude2()) {
- $returnValue[] = $marking->getLatitude2() . ',' . $marking->getLongitude2();
- }
-
- return $returnValue;
- }
-
- public static function getCoordinatesJavascript(lmMarking $marking)
- {
- return '[' . implode(',', self::getCoordinates($marking)) . ']';
- }
-
public function create_marking($category, $timestamp, $field_id, $lat, $lon, $accuracy, $lat2 = null, $lon2 = null, $accuracy2 = null, $spread = null, $depth = null, $comment = null) {
$this->validate_category($category);
$this->validate_timestamp($timestamp);
и
commit d152befa9977b8fc13df9f3ea3f756217751cb0d
Merge: 77b20e2 2ab5fb1
Author: xxx
Date: Thu Jul 4 14:43:26 2013
Comment
diff --cc lib/services/MarkingService.class.php
index acf830a,c553876..f5a8bc4
--- a/lib/services/MarkingService.class.php
+++ b/lib/services/MarkingService.class.php
@@@ -131,34 -157,4 +105,34 @@@ class MarkingService
throw new InvalidArgumentException("Invalid depth: '$depth'");
}
}
+
+ private function validateCoordinates($coordinates)
+ {
+ $validatorOptions = array(
+ 'lat' => array(
+ 'field' => 'latitude',
+ 'validator' => FILTER_VALIDATE_FLOAT
+ ),
+ 'lng' => array(
+ 'field' => 'longitude',
+ 'validator' => FILTER_VALIDATE_FLOAT
+ ),
+ 'accuracy' => array(
+ 'field' => 'accuracy',
+ 'validator' => FILTER_VALIDATE_INT
+ )
+ );
+
+ foreach ($coordinates as $coordinate) {
+ foreach ($coordinate as $key => $value) {
+ if (false === filter_var($coordinate[$key], $validatorOptions[$key]['validator'])) {
+ throw new InvalidArgumentException("Invalid " . $validatorOptions[$key]['field'] . ": '" . $value . "'");
+ }
+ }
+ }
+ }
- }
+ }
и по некоторым причинам я не могу понять, строка в файле теперь звучит
public function create_marking($category, $timestamp, $field_id, $lat, $lon, $accuracy, $lat2 = null, $lon2 = null, $accuracy2 = null, $spread = null, $depth = null, $comment = null) {
Что я делаю неправильно?
EDIT выход состояния мерзавца
$ git status
# On branch master
nothing to commit, working directory clean
выход мерзавца войти
$ git log lib/services/MarkingService.class.php
commit d152befa9977b8fc13df9f3ea3f756217751cb0d
Merge: 77b20e2 2ab5fb1
Author: xxx
Date: Thu Jul 4 14:43:26 2013 +0300
Changed the format of Markings block in Sync API method.
Send markings coordinates in the API in the new format
commit 2ab5fb14765caa269c027e8c57b11232b0441625
Author: xxx
Date: Thu Jul 4 13:58:26 2013 +0300
Changed the format of Markings block in Sync API method.
Send markings coordinates in the API in the new format
commit 925ec3c11006ccca37cf684443d0fad3e1781dca
Author: xxx
Date: Tue Jun 4 14:55:52 2013 +0300
Changed the makrings coordinates structure.
Allow more points in CreateMarking
мерзавец войти --oneline --graph
$ git log --oneline --graph lib/services/MarkingService.class.php
* d152bef Changed the format of Markings block in Sync API method. Send markings coordinates in the API in the new format
|\
| * 2ab5fb1 Changed the format of Markings block in Sync API method. Send markings coordinates in the API in the new format
* | 925ec3c Changed the makrings coordinates structure. Allow more points in CreateMarking
|/
* bacfb14 An intermediate commit. HOTFIX: Fix markings
* 6479513 LETFARM-1863 DB and API support for markings
Каков результат 'git status' и' git log lib/services/MarkingService.class.php'? – Koraktor
Я также попытался сбросить фиксацию, которая ввела желаемое изменение, но эта строка STILL - старая версия. – Vonsild
Если вы посмотрите на фиксацию 2ab5fb14765caa269, данная строка - старая версия. Когда вы обновляете свой филиал, вы выполняете 'git merge' или' git rebase'? – Schleis