# # # patch "ChangeLog" # from [0c578955f63ad6cb465788a62afd792c3ffce8b3] # to [41d80f07d947ff6ee022c089ee0e9b12981ba8a3] # # patch "commands.cc" # from [fff9418f22489beb99be08c9eaa8aeea48e4d299] # to [ffda8a186503943a14239e5193698d3c57a94c01] # # patch "tests/t_add.at" # from [81e06f303994a5e11d9a7802c9c1c2700a2aee44] # to [899b1081891c52a86be286d16af8df0bf5f2d457] # # patch "work.cc" # from [be9eb83e519a1395626b2b29868af63e46a958c2] # to [5a1ae550863011a4dba19abc3f1fba84d5324a1d] # # patch "work.hh" # from [dc6f1035c0b3a27f9b94bff02d5f650b9da8f26b] # to [60f47948673a128ebc9c533ace6cda4b2d027a51] # ============================================================ --- ChangeLog 0c578955f63ad6cb465788a62afd792c3ffce8b3 +++ ChangeLog 41d80f07d947ff6ee022c089ee0e9b12981ba8a3 @@ -1,5 +1,19 @@ 2006-03-02 Emile Snyder + add --unknown, when new files exist in new directories, would try + to add files multiple times. + + * commands.cc (CMD(add)): Call perform_additions() with correct + new boolean flag val to determine whether it recurses on the paths + we hand it. + * work.{cc,hh} (perform_additions): Use boolean flag to indicate + whether the paths should be treated as a set of starting points + for recursively adding entries, or a fixed set of paths. + * tests/t_add.at: Test that we are not getting the warning + messages when adding new files in new directories. + +2006-03-02 Emile Snyder + XFAIL tests on non-win32 systems where we innappropriately I() that some path does not have a '\' character in it. ============================================================ --- commands.cc fff9418f22489beb99be08c9eaa8aeea48e4d299 +++ commands.cc ffda8a186503943a14239e5193698d3c57a94c01 @@ -1208,7 +1208,8 @@ paths.insert(sp); } - perform_additions(paths, app); + bool add_recursive = !app.unknown; + perform_additions(paths, app, add_recursive); } static void find_missing (app_state & app, ============================================================ --- tests/t_add.at 81e06f303994a5e11d9a7802c9c1c2700a2aee44 +++ tests/t_add.at 899b1081891c52a86be286d16af8df0bf5f2d457 @@ -57,6 +57,9 @@ ]) AT_DATA(dir/file6.ignore, [file 6 ]) +AT_CHECK(mkdir dir2) +AT_DATA(dir2/file7, [file 7 +]) #AT_DATA(.mt-ignore, [.*\.ignore$ #]) @@ -67,6 +70,9 @@ #AT_CHECK(grep 'adding file4.ignore' stderr, [1], [ignore]) AT_CHECK(grep 'adding dir/file5' stderr, [0], [ignore]) #AT_CHECK(grep 'adding dir/file6.ignore' stderr, [1], [ignore]) +AT_CHECK(grep 'adding dir2' stderr, [0], [ignore]) +AT_CHECK(grep 'adding dir2/file7' stderr, [0], [ignore]) +AT_CHECK(grep 'skipping dir2/file7' stderr, [1], [ignore]) AT_CHECK(grep 'adding test_hooks.lua' stderr, [1], [ignore]) AT_CHECK(MONOTONE status, [], [stdout]) ============================================================ --- work.cc be9eb83e519a1395626b2b29868af63e46a958c2 +++ work.cc 5a1ae550863011a4dba19abc3f1fba84d5324a1d @@ -147,7 +147,7 @@ } void -perform_additions(path_set const & paths, app_state & app) +perform_additions(path_set const & paths, app_state & app, bool recursive) { if (paths.empty()) return; @@ -169,8 +169,19 @@ addition_builder build(app, new_roster, er); for (path_set::const_iterator i = paths.begin(); i != paths.end(); ++i) - // NB.: walk_tree will handle error checking for non-existent paths - walk_tree(file_path(*i), build); + { + if (recursive) + { + // NB.: walk_tree will handle error checking for non-existent paths + walk_tree(file_path(*i), build); + } + else + { + // in the case where we're just handled a set of paths, we use the builder + // in this strange way. + build.visit_file(file_path(*i)); + } + } cset new_work; make_cset(base_roster, new_roster, new_work); ============================================================ --- work.hh dc6f1035c0b3a27f9b94bff02d5f650b9da8f26b +++ work.hh 60f47948673a128ebc9c533ace6cda4b2d027a51 @@ -60,7 +60,7 @@ }; void -perform_additions(path_set const & targets, app_state & app); +perform_additions(path_set const & targets, app_state & app, bool recursive = true); void perform_deletions(path_set const & targets, app_state & app);