git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] entry.c: remove "checkout-index" from error messages
@ 2010-11-28  4:36 Nguyễn Thái Ngọc Duy
  2010-11-28  6:30 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-28  4:36 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Back then when entry.c was part of checkout-index (or checkout-cache
at that time [1]). It makes sense to print the command name in error
messages. Nowadays entry.c is in libgit and can be used by any
commands, printing "git checkout-index: blah" does no more than
confusion. The error messages without it still give enough information.

[1] 12dccc1 (Make fiel checkout function available to the git library - 2005-06-05)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 I attempted to replace "git checkout-index" with the actual command name
 when these functions are called, but I think it's better just removing
 it...

 entry.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/entry.c b/entry.c
index 004182c..b017167 100644
--- a/entry.c
+++ b/entry.c
@@ -106,14 +106,14 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 	case S_IFLNK:
 		new = read_blob_entry(ce, &size);
 		if (!new)
-			return error("git checkout-index: unable to read sha1 file of %s (%s)",
+			return error("unable to read sha1 file of %s (%s)",
 				path, sha1_to_hex(ce->sha1));
 
 		if (ce_mode_s_ifmt == S_IFLNK && has_symlinks && !to_tempfile) {
 			ret = symlink(new, path);
 			free(new);
 			if (ret)
-				return error("git checkout-index: unable to create symlink %s (%s)",
+				return error("unable to create symlink %s (%s)",
 					     path, strerror(errno));
 			break;
 		}
@@ -141,7 +141,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 		}
 		if (fd < 0) {
 			free(new);
-			return error("git checkout-index: unable to create file %s (%s)",
+			return error("unable to create file %s (%s)",
 				path, strerror(errno));
 		}
 
@@ -155,16 +155,16 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 		close(fd);
 		free(new);
 		if (wrote != size)
-			return error("git checkout-index: unable to write file %s", path);
+			return error("unable to write file %s", path);
 		break;
 	case S_IFGITLINK:
 		if (to_tempfile)
-			return error("git checkout-index: cannot create temporary subproject %s", path);
+			return error("cannot create temporary subproject %s", path);
 		if (mkdir(path, 0777) < 0)
-			return error("git checkout-index: cannot create subproject directory %s", path);
+			return error("cannot create subproject directory %s", path);
 		break;
 	default:
-		return error("git checkout-index: unknown file mode for %s", path);
+		return error("unknown file mode for %s in index", path);
 	}
 
 	if (state->refresh_cache) {
@@ -211,7 +211,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
 			return 0;
 		if (!state->force) {
 			if (!state->quiet)
-				fprintf(stderr, "git-checkout-index: %s already exists\n", path);
+				fprintf(stderr, "%s already exists, no checkout\n", path);
 			return -1;
 		}
 
-- 
1.7.3.2.316.gda8b3

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

* Re: [PATCH] entry.c: remove "checkout-index" from error messages
  2010-11-28  4:36 [PATCH] entry.c: remove "checkout-index" from error messages Nguyễn Thái Ngọc Duy
@ 2010-11-28  6:30 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2010-11-28  6:30 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

On Sun, Nov 28, 2010 at 11:36:38AM +0700, Nguyễn Thái Ngọc Duy wrote:

> Back then when entry.c was part of checkout-index (or checkout-cache
> at that time [1]). It makes sense to print the command name in error
> messages. Nowadays entry.c is in libgit and can be used by any
> commands, printing "git checkout-index: blah" does no more than
> confusion. The error messages without it still give enough information.
> 
> [1] 12dccc1 (Make fiel checkout function available to the git library - 2005-06-05)
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  I attempted to replace "git checkout-index" with the actual command name
>  when these functions are called, but I think it's better just removing
>  it...

Agreed. This came up recently in another thread[1], and I also tracked
it down to a simple cut-and-paste from the original checkout-index.

Acked-by: Jeff King <peff@peff.net>

-Peff

[1] http://article.gmane.org/gmane.comp.version-control.git/160751

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

end of thread, other threads:[~2010-11-28  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-28  4:36 [PATCH] entry.c: remove "checkout-index" from error messages Nguyễn Thái Ngọc Duy
2010-11-28  6:30 ` Jeff King

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 NNTP newsgroup(s).