mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
TW-1636: UUID with numeric-only first segment is not parsed properly
- Switched Nibbler::getUUID to Nibbler::getPartialUUID, which caused partial UUID mathcing to fail sometimes. - Changed precedence to search for UUID before ID, which solves the numeric UUID problem.
This commit is contained in:
parent
9cdabf288e
commit
2a621a4367
2 changed files with 8 additions and 9 deletions
23
src/DOM.cpp
23
src/DOM.cpp
|
@ -255,6 +255,17 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
||||||
std::string uuid;
|
std::string uuid;
|
||||||
bool proceed = false;
|
bool proceed = false;
|
||||||
|
|
||||||
|
if (n.getPartialUUID (uuid) && n.depleted ())
|
||||||
|
{
|
||||||
|
if (uuid == task.get ("uuid"))
|
||||||
|
ref = task;
|
||||||
|
else
|
||||||
|
context.tdb2.get (uuid, ref);
|
||||||
|
|
||||||
|
proceed = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (n.getInt (id) && n.depleted ())
|
if (n.getInt (id) && n.depleted ())
|
||||||
{
|
{
|
||||||
if (id == task.id)
|
if (id == task.id)
|
||||||
|
@ -264,18 +275,6 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
||||||
|
|
||||||
proceed = true;
|
proceed = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
n.restore ();
|
|
||||||
if (n.getUUID (uuid) && n.depleted ())
|
|
||||||
{
|
|
||||||
if (uuid == task.get ("uuid"))
|
|
||||||
ref = task;
|
|
||||||
else
|
|
||||||
context.tdb2.get (uuid, ref);
|
|
||||||
|
|
||||||
proceed = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proceed)
|
if (proceed)
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool TF2::get (int id, Task& task)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Locate task by uuid.
|
// Locate task by uuid, which may be a partial UUID.
|
||||||
bool TF2::get (const std::string& uuid, Task& task)
|
bool TF2::get (const std::string& uuid, Task& task)
|
||||||
{
|
{
|
||||||
if (! _loaded_tasks)
|
if (! _loaded_tasks)
|
||||||
|
@ -123,7 +123,7 @@ bool TF2::get (const std::string& uuid, Task& task)
|
||||||
|
|
||||||
for (auto& i : _tasks)
|
for (auto& i : _tasks)
|
||||||
{
|
{
|
||||||
if (i.get ("uuid") == uuid)
|
if (closeEnough (i.get ("uuid"), uuid, uuid.length ()))
|
||||||
{
|
{
|
||||||
task = i;
|
task = i;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue