Index: gtags/gtags.c
===================================================================
RCS file: /sources/global/global/gtags/gtags.c,v
retrieving revision 1.267
diff -d -u -r1.267 gtags.c
--- gtags/gtags.c	11 May 2014 23:22:51 -0000	1.267
+++ gtags/gtags.c	24 Jun 2014 23:59:50 -0000
@@ -566,38 +566,24 @@
 	/*
 	 * Make add list and delete list for update.
 	 */
-	if (single_update) {
-		int type;
-		const char *fid;
+	do {
+		char process_single_file = (single_update) ? issourcefile(single_update) : 0;
+		if (process_single_file) {
+			path = single_update;
+		} else {
+			file_list = (single_update) ? single_update : file_list;
+			if (file_list) {
+				find_open_filelist(file_list, root);
+			} else {
+				find_open(NULL);
+			}
 
-		if (skipthisfile(single_update))
-			goto exit;
-		if (test("b", single_update))
-			goto exit;
-		fid = gpath_path2fid(single_update, &type);
-		if (fid == NULL) {
-			/* new file */
-			type = issourcefile(single_update) ? GPATH_SOURCE : GPATH_OTHER;
-			if (type == GPATH_OTHER)
-				strbuf_puts0(addlist_other, single_update);
-			else {
-				strbuf_puts0(addlist, single_update);
-				total++;
+			if ((path = find_read()) == NULL) {
+				break;
 			}
-		} else {
-			/* update file */
-			if (type == GPATH_OTHER)
-				goto exit;
-			idset_add(deleteset, atoi(fid));
-			strbuf_puts0(addlist, single_update);
-			total++;
 		}
-	} else {
-		if (file_list)
-			find_open_filelist(file_list, root);
-		else
-			find_open(NULL);
-		while ((path = find_read()) != NULL) {
+
+		do {
 			const char *fid;
 			int n_fid = 0;
 			int other = 0;
@@ -615,6 +601,7 @@
 				n_fid = atoi(fid);
 				idset_add(findset, n_fid);
 			}
+
 			if (other) {
 				if (fid == NULL)
 					strbuf_puts0(addlist_other, path);
@@ -626,10 +613,45 @@
 					strbuf_puts0(addlist, path);
 					total++;
 					idset_add(deleteset, n_fid);
+				} else if (single_update) {
+					STRBUF *list;
+					/*
+					 * Prefix files to be dropped with
+					 * '-' and '+' to add/update
+					 * */
+					if (*path == '-') {
+						++path;
+						list = deletelist;
+						idset_add(deleteset, n_fid);
+					} else if (*path == '+') {
+						++path;
+						list = addlist;
+					} else if (test("f", path)) {
+						list = addlist;
+					} else {
+						list = deletelist;
+						idset_add(deleteset, n_fid);
+					}
+   
+					strbuf_puts0(list, path);
+					total++;
 				}
 			}
+		} while (!process_single_file && (path = find_read()) != NULL);
+
+		/* Close the file if we have opened */
+		if (!process_single_file) {
+			find_close();
 		}
-		find_close();
+
+		/*
+		 * If single file update or minimal refresh,
+		 * do not delete remaining tags
+		 */
+		if (process_single_file || single_update) {
+			break;
+		}
+
 		/*
 		 * make delete list.
 		 */
@@ -659,7 +681,7 @@
 				}
 			}
 		}
-	}
+	} while(0);
 	statistics_time_end(tim);
 	/*
 	 * execute updating.
Index: libutil/getdbpath.c
===================================================================
RCS file: /sources/global/global/libutil/getdbpath.c,v
retrieving revision 1.32
diff -d -u -r1.32 getdbpath.c
--- libutil/getdbpath.c	28 Feb 2014 04:08:11 -0000	1.32
+++ libutil/getdbpath.c	24 Jun 2014 23:59:50 -0000
@@ -211,7 +211,10 @@
 	char *p;
 	static char msg[1024];
 
-	if (!getcwd(cwd, MAXPATHLEN)) {
+	/* Prefer shorter paths over long realpath if GTAGSLOGICALPATH is set */
+	if (getenv("GTAGSLOGICALPATH") && (p = getenv("PWD"))) {
+		strncpy(cwd, p, sizeof(cwd) - 1);
+	} else if (!getcwd(cwd, MAXPATHLEN)) {
 		gtags_dbpath_error = "cannot get current directory.";
 		return -1;
 	}
