public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] update-cache.c ignore directories
@ 2005-04-22 22:25 atani
  2005-04-22 22:27 ` Fabian Franz
  0 siblings, 1 reply; 3+ messages in thread
From: atani @ 2005-04-22 22:25 UTC (permalink / raw)
  To: GIT Mailing List

--- sorry if this dupes, mail client issues... 
 
In my tests of using git (both Linus and pasky versions) I had a 
problem with  
doing "gitadd.sh *" where * expands to include directories.  This 
simple  
patch allows update-cache.c to more gracefully handle a directory 
being  
passed into the add_file_to_cache method.  Without this patch 
update-cache  
exits prematurely with an error similar to: 
------------- 
fatal: Unable to add plx to database 
------------- 
 
Now it spits out: 
------------- 
'plx' is a directory, ignoring 
------------- 
 
Which from an end user stand point is better. 
 
BTW, so far my tests of using git are positive for my small Dreamcast 
software  
projects...  I was previously using subversion but find it to be a bit 
of  
overkill for these small projects. 
 
Martin Schlemmer,  I ran "emerge sync" today and found git has been 
added to  
portage, version 0.5.  Also note that there are now two "git" entries 
within  
portage app-misc/git and dev-util/git.  app-misc/git is GNU 
Interactive Tools 
 
Mike 
 
Signed-off-by: Mike Dunston (atani@atani-software•net) 
 
Index: update-cache.c 
=================================================================== 
--- 690494557d393ca78f69a8569880ed4a3aeda276/update-cache.c  
(mode:100644  
sha1:4353b80890ba2afbe22248a4dc25060aa4a429b2) 
+++ uncommitted/update-cache.c  (mode:100644) 
@@ -104,6 +104,11 @@ 
                close(fd); 
                return -1; 
        } 
+       if(S_ISDIR(st.st_mode)) { 
+               printf("'%s' is a directory, ignoring\n", path); 
+               close(fd); 
+               return 0; 
+       } 
        namelen = strlen(path); 
        size = cache_entry_size(namelen); 
        ce = malloc(size); 

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

* Re: [PATCH] update-cache.c ignore directories
  2005-04-22 22:25 atani
@ 2005-04-22 22:27 ` Fabian Franz
  0 siblings, 0 replies; 3+ messages in thread
From: Fabian Franz @ 2005-04-22 22:27 UTC (permalink / raw)
  To: atani; +Cc: GIT Mailing List

Am Samstag, 23. April 2005 00:25 schrieb atani:

> Now it spits out:
> -------------
> 'plx' is a directory, ignoring
> -------------

I saw that you spit this out to stdout. Wouldn't it be better to spit it out 
to stderr (even if its just a warning)?

cu

Fabian


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

* Re: [PATCH] update-cache.c ignore directories
@ 2005-04-22 22:34 atani
  0 siblings, 0 replies; 3+ messages in thread
From: atani @ 2005-04-22 22:34 UTC (permalink / raw)
  To: GIT Mailing List

 
> Am Samstag, 23. April 2005 00:25 schrieb atani: 
>  
> > Now it spits out: 
> > ------------- 
> > 'plx' is a directory, ignoring 
> > ------------- 
>  
> I saw that you spit this out to stdout. Wouldn't it be better to 
spit it out  
> to stderr (even if its just a warning)? 
 
Sure.  I do not know of the current conventions on where the output 
should go, or which methods to use for said output.  Is there a 
standard method for handling "warnings"?  I saw there is the "die" 
method but that is not what should be used here as implies a "fatal" 
error. 
 
Mike 

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

end of thread, other threads:[~2005-04-22 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-22 22:34 [PATCH] update-cache.c ignore directories atani
  -- strict thread matches above, loose matches on Subject: below --
2005-04-22 22:25 atani
2005-04-22 22:27 ` Fabian Franz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox