[PATCH/WIP 06/10] Enable :(glob)path syntax for a lot of commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 builtin/add.c          | 4 +++-
 builtin/checkout.c     | 4 +++-
 builtin/clean.c        | 4 +++-
 builtin/commit.c       | 8 ++++++--
 builtin/grep.c         | 4 +++-
 builtin/ls-files.c     | 4 +++-
 builtin/ls-tree.c      | 4 +++-
 builtin/rerere.c       | 4 +++-
 builtin/reset.c        | 4 +++-
 builtin/rm.c           | 4 +++-
 builtin/update-index.c | 4 +++-
 revision.c             | 4 +++-
 12 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 1b99e2b..a3ffa9d 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -379,7 +379,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	 * below before enabling new magic.
 	 */
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       PATHSPEC_SYMLINK_LEADING_PATH |
 		       PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE,
 		       prefix, argv);
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 90f4a01..cb5d548 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1113,7 +1113,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		 * lifted for new magic when opts.patch_mode == 0.
 		 */
 		parse_pathspec(&opts.pathspec,
-			       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+			       PATHSPEC_FROMTOP |
+			       PATHSPEC_LITERAL |
+			       (opts.patch_mode ? PATHSPEC_GLOB : 0),
 			       0, prefix, argv);
 
 		if (!opts.pathspec.nr)
diff --git a/builtin/clean.c b/builtin/clean.c
index b4ffa2b..f675d5a 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -101,7 +101,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 			    &dir.exclude_list[EXC_CMDL]);
 
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, argv);
 
 	fill_directory(&dir, &pathspec);
diff --git a/builtin/commit.c b/builtin/commit.c
index 433fdb9..743a3ea 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -282,7 +282,9 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
 	if (is_status)
 		refresh_flags |= REFRESH_UNMERGED;
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       PATHSPEC_EMPTY_MATCH_ALL,
 		       prefix, argv);
 
@@ -1205,7 +1207,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 	if (show_ignored_in_status)
 		s.show_ignored_files = 1;
 	parse_pathspec(&s.pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       PATHSPEC_EMPTY_MATCH_ALL,
 		       prefix, argv);
 
diff --git a/builtin/grep.c b/builtin/grep.c
index 4d8e82c..9f1b029 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -857,7 +857,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	}
 
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, argv + i);
 	pathspec.max_depth = opt.max_depth;
 	pathspec.recursive = 1;
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 1cbd211..feb4220 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -536,7 +536,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
 		setup_work_tree();
 
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP,
 		       prefix, argv);
 
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4764683..25d0590 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -173,7 +173,9 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
 	 * match_pathspec_depth() or tree_entry_interesting()
 	 */
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, argv + 1);
 	for (i = 0; i < pathspec.nr; i++)
 		pathspec.items[i].nowildcard_len = pathspec.items[i].len;
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 779fc77..d64d010 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -72,7 +72,9 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
 		if (argc < 2)
 			warning("'git rerere forget' without paths is deprecated");
 		parse_pathspec(&pathspec,
-			       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+			       PATHSPEC_FROMTOP |
+			       PATHSPEC_LITERAL |
+			       PATHSPEC_GLOB,
 			       0, prefix, argv + 1);
 		return rerere_forget(&pathspec);
 	}
diff --git a/builtin/reset.c b/builtin/reset.c
index 69ce164..f71af9c 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -184,7 +184,9 @@ static int read_from_tree(const char *prefix, const char **argv,
 
 	memset(&opt, 0, sizeof(opt));
 	parse_pathspec(&opt.pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, argv);
 	opt.output_format = DIFF_FORMAT_CALLBACK;
 	opt.format_callback = update_index_from_diff;
diff --git a/builtin/rm.c b/builtin/rm.c
index d46f1aa..ff0fd5b 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -250,7 +250,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	}
 
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, argv);
 	refresh_index(&the_index, REFRESH_QUIET, &pathspec, NULL, NULL);
 
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 1dd6178..c456e1b 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -549,7 +549,9 @@ static int do_reupdate(int ac, const char **av,
 	struct pathspec pathspec;
 
 	parse_pathspec(&pathspec,
-		       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+		       PATHSPEC_FROMTOP |
+		       PATHSPEC_LITERAL |
+		       PATHSPEC_GLOB,
 		       0, prefix, av + 1);
 
 	if (read_ref("HEAD", head_sha1))
diff --git a/revision.c b/revision.c
index 079955f..5ac480b 100644
--- a/revision.c
+++ b/revision.c
@@ -1852,7 +1852,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 		ALLOC_GROW(prune_data.path, prune_data.nr+1, prune_data.alloc);
 		prune_data.path[prune_data.nr++] = NULL;
 		parse_pathspec(&revs->prune_data,
-			       PATHSPEC_FROMTOP | PATHSPEC_LITERAL,
+			       PATHSPEC_FROMTOP |
+			       PATHSPEC_LITERAL |
+			       PATHSPEC_GLOB,
 			       0, revs->prefix, prune_data.path);
 	}
 
-- 
1.8.0.rc2.23.g1fb49df

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]