GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.01k stars 278 forks source link

`task export` gives non-deterministic task order #3527

Closed willhansen closed 1 day ago

willhansen commented 1 week ago

To report a bug...

task 3.0.2
   Platform: Linux

Compiler
    Version: 13.3.0
       Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
 Compliance: C++17

Build Features
      CMake: 3.29.3
    libuuid: libuuid + uuid_unparse_lower
 Build type: Release

Configuration
       File: /home/will/.config/task/taskrc (found), 52 bytes, mode 100644
       Data: /home/will/.task (found), dir, mode 40755
    Locking: Enabled
         GC: Enabled
    $EDITOR: nvim
Hooks
     System: Enabled
   Location: /home/will/.task/hooks
             (-none-)

Tests
   Terminal: 166x45
       Dups: Scanned 39 tasks for duplicate UUIDs:
             No duplicates found
 Broken ref: Scanned 39 tasks for broken references:
             No broken references found
djmitche commented 6 days ago

It looks like task export can actually take a report name, and will use the filter and sort from that report. That's not documented - maybe it should be?

It's a little hard to follow the code, but it looks like in the absence of a report it defaults to sorting by id, and I think that's what you're seeing -- the tasks with unique id are sorted numerically, but the tasks not in the working set all have id zero and the sort does not affect them.

If you have the capability to build locally, you could try changing src/commands/CmdExport.cpp where it defaults to id (// if no sort order, sort by id) to id,uuid.