From: Andre Noll Date: Wed, 24 Dec 2014 15:10:43 +0000 (+0000) Subject: aft: Generate a remove event when adding duplicate files. X-Git-Tag: v0.5.4~3^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=a092ce3940929f594d1f55d945cf43081706fb4b aft: Generate a remove event when adding duplicate files. Consider the following scenario: add /foo.mp3 add /bar.mp3 # assume foo and bar differ cp /foo.mp3 /bar.mp3 add /bar.mp3 In the last add command, the path being added (/bar.mp3) already exists in the audio file table, and its hash also exists for a different path (/foo.mp3). The code in aft.c is smart enough to detect this. It first removes the existing entry for /bar.mp3 and then considers the addition of /bar.mp3 as a file rename /foo.mp3 -> /bar.mp3. Unfortunately, we miss to generate the remove event in this case. This patch should fix it. It also improves the message a bit. --- diff --git a/aft.c b/aft.c index 61fd9942..301da7c7 100644 --- a/aft.c +++ b/aft.c @@ -1718,10 +1718,11 @@ static void com_add_callback(int fd, const struct osl_object *query) struct osl_object obj; if (pb) { /* hs trumps pb, remove pb */ if (flags & ADD_FLAG_VERBOSE) { - ret = para_printf(&msg, "removing path brother\n"); + ret = para_printf(&msg, "removing %s\n", path); if (ret < 0) goto out; } + afs_event(AUDIO_FILE_REMOVE, &msg, pb); ret = osl(osl_del_row(audio_file_table, pb)); if (ret < 0) goto out;