From d3afe297be72fdfbc8590b4ce1ac4912e4ccae5c Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 22 Nov 2010 17:05:20 -0800 Subject: fix for bug 6459 * don't throw away "unsaved" state when doing "discard". --- src/cstore/unionfs/cstore-unionfs.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/cstore') diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index f125f37..e2e27c6 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -840,7 +840,10 @@ UnionfsCstore::set_comment(const string& comment) bool UnionfsCstore::discard_changes(unsigned long long& num_removed) { - // unionfs-specific implementation + // need to keep unsaved marker + bool unsaved = sessionUnsaved(); + bool ret = true; + vector files; vector directories; try { @@ -866,9 +869,15 @@ UnionfsCstore::discard_changes(unsigned long long& num_removed) } catch (...) { output_internal("discard failed [%s]\n", change_root.file_string().c_str()); - return false; + ret = false; } - return true; + + if (unsaved) { + // restore unsaved marker + num_removed--; + markSessionUnsaved(); + } + return ret; } // get comment at the current work or active path -- cgit v1.2.3