Name: In getPrefix, support a negative argument, e.g. getPrefix(-1). Refs #1086.
diff --git a/CHANGELOG b/CHANGELOG
index 66f3e5f..e09485f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Interim changes since NDN-CPP v0.2(2013-12-16)
+Interim changes since NDN-CPP v0.2(2013-12-17)
 
 Bug fixes
 * http://redmine.named-data.net/issues/1056 Fix DTAG NDNProtocolDataUnit to encode as "NDN\202\000".
@@ -8,7 +8,8 @@
 * Fix bug in getForwardingEntryFlags: Need to check all flags, not the first flag using "else if".
 
 Changes
-* http://redmine.named-data.net/issues/1085: In Name::Component, added comparison operators.
+* http://redmine.named-data.net/issues/1085 In Name::Component, added comparison operators.
+* http://redmine.named-data.net/issues/1086 In Name::getPrefix, support a negative argument, e.g. getPrefix(-1).
 * MetaInfo: Added setFinalBlockID for Name::Component, remove unused setFinalBlockID which take uint8_t*, etc.
 * Fix clang compiler warnings: Include headers, parentheses and cast explicitly.
 * Moved class ExcludeEntry to inner class Exclude::Entry.
diff --git a/include/ndn-cpp/name.hpp b/include/ndn-cpp/name.hpp
index 9a1b39e..50f50b2 100644
--- a/include/ndn-cpp/name.hpp
+++ b/include/ndn-cpp/name.hpp
@@ -438,13 +438,17 @@
   
   /**
    * Return a new Name with the first nComponents components of this Name.
-   * @param nComponents The number of prefix components.
+   * @param nComponents The number of prefix components.  If nComponents is -N then return the prefix up
+   * to name.size() - N. For example getPrefix(-1) returns the name without the final component.
    * @return A new Name.
    */
   Name
-  getPrefix(size_t nComponents) const
+  getPrefix(int nComponents) const
   {
-    return getSubName(0, nComponents);
+    if (nComponents < 0)
+      return getSubName(0, components_.size() + nComponents);
+    else
+      return getSubName(0, nComponents);
   }
   
   /**