git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 2/4] Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)
@ 2008-03-07 10:54 Junio C Hamano
  2008-03-07 10:54 ` [PATCH 3/4] Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes) Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-03-07 10:54 UTC (permalink / raw
  To: git

When get_pathspec() was originally made absolute-path capable,
we botched the interface to it, without dying inside the function
when given a path that is outside the work tree, and made it the
responsibility of callers to check the condition in a roundabout
way.  This is made unnecessary with the previous patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-mv.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 68aa2a6..94f6dd2 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -19,7 +19,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 				  int count, int base_name)
 {
 	int i;
-	int len = prefix ? strlen(prefix) : 0;
 	const char **result = xmalloc((count + 1) * sizeof(const char *));
 	memcpy(result, pathspec, count * sizeof(const char *));
 	result[count] = NULL;
@@ -33,11 +32,8 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 			if (last_slash)
 				result[i] = last_slash + 1;
 		}
-		result[i] = prefix_path(prefix, len, result[i]);
-		if (!result[i])
-			exit(1); /* error already given */
 	}
-	return result;
+	return get_pathspec(prefix, result);
 }
 
 static void show_list(const char *label, struct path_list *list)
-- 
1.5.4.3.587.g0bdd73


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/4] Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes)
  2008-03-07 10:54 [PATCH 2/4] Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files) Junio C Hamano
@ 2008-03-07 10:54 ` Junio C Hamano
  2008-03-07 10:54   ` [PATCH 4/4] Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec()) Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-03-07 10:54 UTC (permalink / raw
  To: git

When get_pathspec() was originally made absolute-path capable,
we botched the interface to it, without dying inside the function
when given a path that is outside the work tree, and made it the
responsibility of callers to check the condition in a roundabout
way.  This is made unnecessary with the previous patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-add.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index 820110e..4a91e3e 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -228,18 +228,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		goto finish;
 	}
 
-	if (*argv) {
-		/* Was there an invalid path? */
-		if (pathspec) {
-			int num;
-			for (num = 0; pathspec[num]; num++)
-				; /* just counting */
-			if (argc != num)
-				exit(1); /* error message already given */
-		} else
-			exit(1); /* error message already given */
-	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 4/4] Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec())
  2008-03-07 10:54 ` [PATCH 3/4] Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes) Junio C Hamano
@ 2008-03-07 10:54   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-03-07 10:54 UTC (permalink / raw
  To: git

When get_pathspec() was originally made absolute-path capable,
we botched the interface to it, without dying inside the function
when given a path that is outside the work tree, and made it the
responsibility of callers to check the condition in a roundabout
way.  This is made unnecessary with the previous patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-ls-files.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index 25dbfb4..dc7eab8 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -574,17 +574,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 	pathspec = get_pathspec(prefix, argv + i);
 
 	/* Verify that the pathspec matches the prefix */
-	if (pathspec) {
-		if (argc != i) {
-			int cnt;
-			for (cnt = 0; pathspec[cnt]; cnt++)
-				;
-			if (cnt != (argc - i))
-				exit(1); /* error message already given */
-		}
+	if (pathspec)
 		prefix = verify_pathspec(prefix);
-	} else if (argc != i)
-		exit(1); /* error message already given */
 
 	/* Treat unmatching pathspec elements as errors */
 	if (pathspec && error_unmatch) {
-- 
1.5.4.3.587.g0bdd73


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-07 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07 10:54 [PATCH 2/4] Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files) Junio C Hamano
2008-03-07 10:54 ` [PATCH 3/4] Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes) Junio C Hamano
2008-03-07 10:54   ` [PATCH 4/4] Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec()) Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).