Re: [PATCH] Port git-tag.sh to C.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Saturday, June 9, 2007 - 11:26 am

Kristian Høgsberg <krh@redhat.com> writes:


I think your name in your commit message is in UTF-8 but munged your
mail was mismarked as iso-8859-1.


It would have been nicer to have this in editor.c or somesuch,
as other commands will be redone in C in the future.

We could do the moving later, but the problem is that later is
conditional: "if we are lucky enough to remember that we already
have this function in builtin-tag when doing so".


I would understand an argument to use 0666 (honor umask) or 0600
(this is a temporary file and others have no business looking at
it while an edit is in progress), but I cannot justify 0644.


Open for reading with mode ;-)?


I really think this function needs to be refactored into three.

 * A generic "spawn an editor with this initial seed template,
   return the result of editing in memory and also give exit
   status of the editor" function that does not take path
   parameter (instead perhaps mkstemp a temporary file on your
   own);

 * A function that does what git-stripspace does in core;

 * A function for builtin-tag to use, that calls the above two
   and uses the result (e.g. "did the user kill the editor?
   does the resulting buffer have any nonempty line?") to decide
   what it does.


Two issues:

 * It used to be a tag had limit of 8kB which was lifted some
   time ago; now it is limited to 4kB.  Fixing this implies that
   the "launch editor and get results in core" function I
   mentioned above may need to realloc, and probably the buffer
   is better passed as (char *, ulong) pair as done everywhere
   else (although we know this is text so you can pass only a
   pointer and have the user run strlen() when needed).

 * I do not see any validation on the value of "tag".  Do we want
   to allow passing "" to it?  What about "my\ntag"?


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Port git-tag.sh to C., krh, (Fri Jun 8, 3:45 pm)
Re: [PATCH] Port git-tag.sh to C., Carlos Rica, (Fri Jun 8, 6:58 pm)
Re: [PATCH] Port git-tag.sh to C., Junio C Hamano, (Sat Jun 9, 11:26 am)
Re: [PATCH] Port git-tag.sh to C., krh, (Sat Jun 9, 4:27 pm)
Re: [PATCH] Port git-tag.sh to C., Robin Rosenberg, (Sun Jun 10, 5:37 am)
Re: [PATCH] Port git-tag.sh to C., Junio C Hamano, (Sun Jun 10, 2:36 pm)
Re: [PATCH] Port git-tag.sh to C., Jeff King, (Sun Jun 10, 3:13 pm)
Re: [PATCH] Port git-tag.sh to C., Junio C Hamano, (Sun Jun 10, 3:19 pm)
Re: [PATCH] Port git-tag.sh to C., Jeff King, (Sun Jun 10, 3:22 pm)
Re: [PATCH] Port git-tag.sh to C., Daniel Barkalow, (Mon Jun 11, 8:28 pm)
git-fetch, was Re: [PATCH] Port git-tag.sh to C., Johannes Schindelin, (Tue Jun 12, 5:41 am)
Re: git-fetch, was Re: [PATCH] Port git-tag.sh to C., Julian Phillips, (Tue Jun 12, 6:29 am)
Re: git-fetch, was Re: [PATCH] Port git-tag.sh to C., Daniel Barkalow, (Tue Jun 12, 9:51 am)
Re: git-fetch, was Re: [PATCH] Port git-tag.sh to C., Daniel Barkalow, (Tue Jun 12, 4:55 pm)
Re: git-fetch, was Re: [PATCH] Port git-tag.sh to C., Johannes Schindelin, (Tue Jun 12, 5:27 pm)