Merge branch 'master' of ssh://dev.eclipse.org/gitroot/e4/org.eclipse.orion.client
diff --git a/bundles/org.eclipse.orion.client.core/static/git-status.html b/bundles/org.eclipse.orion.client.core/static/git-status.html
index ec8c501..bd4018e 100644
--- a/bundles/org.eclipse.orion.client.core/static/git-status.html
+++ b/bundles/org.eclipse.orion.client.core/static/git-status.html
@@ -43,7 +43,7 @@
  	<script src="js/preferences.js"></script>

 	<script src="js/searchClient.js"></script>

     <div dojoType="dijit.layout.BorderContainer" design="headline" liveSplitters="true" persist="true" gutters="false" style="width: 100%; height: 100%;" splitter="true">

-		<div class="toolbar" id="toolbar" style="overflow: hidden; dojoType="dijit.layout.ContentPane" region="top">

+		<div class="toolbar" id="toolbar" style="overflow: hidden;" dojoType="dijit.layout.ContentPane" region="top">

 		</div>

 		

 		<!-- status pane on left : start vvv-->

@@ -92,7 +92,7 @@
 

 			<!-- commit zone : start vvv-->

 			<div id = "commitZone">

-				<span>Commit Message : </span>

+				<h2>Commit Message : </h2>

 				<table >

 					<tr>

 						<td nowrap="nowrap">

diff --git a/bundles/org.eclipse.orion.client.core/static/js/commands.js b/bundles/org.eclipse.orion.client.core/static/js/commands.js
index 1e110d6..6057d73 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/commands.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/commands.js
@@ -169,7 +169,7 @@
 						if (!selection) {
 							return;
 						}
-						this.renderCommands(parent, scope, selection, handler, style, userData);
+						cmdService.renderCommands(parent, scope, selection, handler, style, userData);
 					});
 				});
 				return;
diff --git a/bundles/org.eclipse.orion.client.core/static/js/fileCommands.js b/bundles/org.eclipse.orion.client.core/static/js/fileCommands.js
index 96d692d..ae79444 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/fileCommands.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/fileCommands.js
@@ -128,7 +128,8 @@
 		var path = splits[splits.length-1];
 		var qIndex = path.indexOf("/?");
 		if (qIndex > 0) {
-			path = path.substring(0, qIndex);
+			//remove the query but not the trailing separator
+			path = path.substring(0, qIndex+1);
 		}
 		return path;
 	}
@@ -151,13 +152,14 @@
 		
 		// gather up source paths so we do not propose to move/copy a source to its own location
 		var sourceLocations = [];
-		for (var i=0; i<items.length; i++) {
+		var i;
+		for (i=0; i<items.length; i++) {
 			sourceLocations.push(stripPath(items[i].Location));
 		}
 		var choices = [];
 		if (eclipse.favoritesCache) {
 			var favorites = eclipse.favoritesCache.favorites;
-			for (var i=0; i<favorites.length; i++) {
+			for (i=0; i<favorites.length; i++) {
 				var path = stripPath(favorites[i].path);
 				if (!contains(sourceLocations, path)) {
 					choices.push({name: favorites[i].name, image: "images/silk/star.gif", path: path, callback: callback});
@@ -169,12 +171,24 @@
 		// Don't propose a target if it's a source
 		var proposedPaths = [];
 		var alreadySeen = [];
-		for (var i= 0; i<items.length; i++) {
-			// for the purposes of finding parents and siblings, if this is a file, consider its parent folder for finding targets, not itself.
+		var j, child, childPath;
+		for (i= 0; i<items.length; i++) {
 			var item = items[i];
+			var sibling = items[i];
+			// for the purposes of finding parents, if this is a file, consider its parent folder for finding targets, not itself.
 			if (!item.Directory && item.parent) {
 				item = item.parent;
 			}
+			if (item.Parents) {
+				for (j=0; j<item.Parents.length; j++) {
+					child = item.Parents[j];
+					childPath = stripPath(child.Location);
+					if (child.Directory && !contains(alreadySeen, childPath) && !contains(sourceLocations, childPath)) {
+						alreadySeen.push(childPath);
+						child.stripped = childPath;
+						proposedPaths.push(child);
+					}
+				}			}
 			if (item.parent) {
 				var parentPath = item.parent.Location;
 				if (parentPath) {
@@ -185,16 +199,15 @@
 						item.parent.stripped = stripped;
 					}
 				}
-				// siblings
-				if (item.parent.Children) {
-					for (var j=0; j<item.parent.Children.length; j++) {
-						var child = item.parent.Children[j];
-						var childPath = stripPath(child.Location);
-						if (child.Directory && !contains(alreadySeen, childPath) && !contains(sourceLocations, childPath)) {
-							alreadySeen.push(childPath);
-							child.stripped = childPath;
-							proposedPaths.push(child);
-						}
+			}
+			if (sibling.parent && sibling.parent.children) {	// siblings
+				for (j=0; j<sibling.parent.children.length; j++) {
+					child = sibling.parent.children[j];
+					childPath = stripPath(child.Location);
+					if (child.Directory && !contains(alreadySeen, childPath) && !contains(sourceLocations, childPath)) {
+						alreadySeen.push(childPath);
+						child.stripped = childPath;
+						proposedPaths.push(child);
 					}
 				}
 			}
@@ -210,14 +223,14 @@
 			return 0;
 		});
 		// now add them
-		for (var i=0; i<proposedPaths.length; i++) {
+		for (i=0; i<proposedPaths.length; i++) {
 			var item = proposedPaths[i];
 			var displayPath = item.Name;
 			// we know we've left leading and trailing slash so slashes is splits + 1
 			var slashes = item.stripped.split('/').length + 1;
 			// but don't indent for leading or trailing slash
 			// TODO is there a smarter way to do this?
-			for (var j=0; j<slashes-2; j++) {
+			for (j=0; j<slashes-2; j++) {
 				displayPath = "  " + displayPath;
 			}
 			choices.push({name: displayPath, path: item.stripped, callback: callback});
diff --git a/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js b/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
index e514e36..cdb02f1 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
@@ -188,7 +188,7 @@
 			this.modifyImageButton(stageAllBtn , "Stage all", function(evt){self.stageAll();} , !this.hasUnstaged);
 			this.modifyImageButton(unstageAllBtn , "Unstage all", function(evt){self.unstageAll();} , !this.hasStaged);
 			this.modifyImageButton(commitBtn , "Commit staged files", function(evt){self.commit(messageArea.value);} , !this.hasStaged);
-			this.modifyImageButton(amendBtn , "Amend last commit", function(evt){self.commit(messageArea.value);} , !this.hasStaged);
+			this.modifyImageButton(amendBtn , "Amend last commit", function(evt){self.commit(messageArea.value , true);} , !this.hasStaged);
 		},
 		
 		_makeLocation: function(location , name){//temporary
@@ -315,6 +315,7 @@
 			var result = this._resolveURI(itemModel);
 			var diffVS = this._model.isStaged(itemModel.type) ? "index VS HEAD ) >>> " : "local VS index ) >>> " ;
 			var message = "Compare( " + orion.statusTypeMap[itemModel.type][1] + " : " +diffVS + itemModel.name;
+			this.removeProgressDiv("inline-compare-viewer"  , "compareIndicatorId");
 			this._inlineCompareContainer.resolveDiff(result.diffURI,
 													result.fileURI,
 					                                function(){					
@@ -414,7 +415,7 @@
 				this.unstage(this._url.substring(start));
 		},
 		
-		commitAll: function(location , message){
+		commitAll: function(location , message , body){
 			var self = this;
 			var url = "/git/commit" +  location;
 			dojo.xhrPost({
@@ -424,7 +425,7 @@
 				},
 				handleAs: "json",
 				timeout: 5000,
-				postData: dojo.toJson({"Message":message} ),
+				postData: body,
 				load: function(jsonData, ioArgs) {
 					console.log(JSON.stringify(jsonData));
 					self.getGitStatus(self._url);;
@@ -437,13 +438,13 @@
 			});
 		},
 		
-		commit: function(message){
+		commit: function(message , amend){
 			var start = this._url.indexOf("/file/");
 			if(start != -1){
 				var sub = this._url.substring(start);
 				var subSlitted = sub.split("/");
 				if(subSlitted.length > 2){
-					this.commitAll([subSlitted[0] , subSlitted[1] , subSlitted[2]].join("/") , message);
+					this.commitAll([subSlitted[0] , subSlitted[1] , subSlitted[2]].join("/") , message , amend ?dojo.toJson({"Message":message,"Amend":"true"}): dojo.toJson({"Message":message}));
 				}
 			}
 		}
diff --git a/bundles/org.eclipse.orion.client.core/static/plugins/filePlugin/fileImpl.js b/bundles/org.eclipse.orion.client.core/static/plugins/filePlugin/fileImpl.js
index 8288449..4c1f9aa 100644
--- a/bundles/org.eclipse.orion.client.core/static/plugins/filePlugin/fileImpl.js
+++ b/bundles/org.eclipse.orion.client.core/static/plugins/filePlugin/fileImpl.js
@@ -272,14 +272,16 @@
 		
 		_doCopyMove: function(sourceLocation, targetLocation, isMove, name) {
 			if (!name) {
-				name = sourceLocation.slice(sourceLocation.lastIndexOf('/'));
+				//take the last segment (trailing slash will product an empty segment)
+				var segments = sourceLocation.split("/");
+				name = segments.pop() || segments.pop();
 			}
 			return dojo.xhrPost({
 				url: targetLocation,
 				headers: {
 					"Orion-Version": "1",
 					"Slug": name,
-					"X-Create-Options": isMove ? "move" : "copy"
+					"X-Create-Options": "no-overwrite," + (isMove ? "move" : "copy")
 				},
 				postData: dojo.toJson({"Location": sourceLocation}),
 				handleAs: "json",