Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/cli/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ fprintf(stderr, "darktable %s\n"
" multiple times instead of input file\n"
" --library <path> read the history stack from library database\n"
" instead of XMP sidecar files\n"
" using ':memory:' for an empty in-memory library\n"
" is useless for darktable cli export\n"
" --icc-type <type> specify icc type, default to NONE\n"
" use --help icc-type for list of supported types\n"
" --icc-file <file> specify icc filename, default to NONE\n"
Expand Down Expand Up @@ -384,6 +386,13 @@ int main(int argc, char *arg[])
{
k++;
library = arg[k];
if(!strcmp(library, ":memory:"))
{
fprintf(stderr, _("empty in-memory library is useless for darktable cli export\n"));
usage(arg[0]);
exit(1);
}

}
else if(!strcmp(arg[k], "--icc-type") && argc > k + 1)
{
Expand Down Expand Up @@ -575,6 +584,9 @@ int main(int argc, char *arg[])
exit(1);
}

// When --library was provided, use the DB history; otherwise keep XMP override mode.
darktable.prefer_library_history = (library != NULL);

GList *id_list = NULL;

for(GList *l = inputs; l != NULL; l=g_list_next(l))
Expand Down
3 changes: 3 additions & 0 deletions src/common/darktable.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ typedef struct darktable_t
int32_t unmuted_signal_dbg_acts;
gboolean unmuted_signal_dbg[DT_SIGNAL_COUNT];
gboolean pipe_cache;
// Keep database history for known images rather than replacing it from XMP.
// Set by darktable-cli with explicit --library <db>; GUI and CLI use XMP by default.
gboolean prefer_library_history;
int gui_running; // atomic, access with g_atomic_int_*()
GTimeZone *utc_tz;
GDateTime *origin_gdt;
Expand Down
9 changes: 7 additions & 2 deletions src/common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,8 +1874,13 @@ static dt_imgid_t _image_import_internal(const dt_filmid_t film_id,
if(img)
img->flags &= ~DT_IMAGE_REMOVE;
dt_image_cache_write_release(img, DT_IMAGE_CACHE_RELAXED);
_image_read_duplicates(id, normalized_filename, raise_signals);
dt_image_synch_all_xmp(normalized_filename);
// Reconcile with XMP sidecars unless library history is preferred to avoid
// overwriting library edit history with potentially stale XMP history.
if(!darktable.prefer_library_history)
{
_image_read_duplicates(id, normalized_filename, raise_signals);
dt_image_synch_all_xmp(normalized_filename);
}
g_free(ext);
g_free(normalized_filename);
if(raise_signals)
Expand Down
Loading