All of lore.kernel.org
 help / color / mirror / Atom feed
From: "atani" <atani@atani-software.net>
To: GIT Mailing List <git@vger.kernel.org>
Subject: [PATCH] update-cache.c ignore directories
Date: Fri, 22 Apr 2005 15:25:07 -0700	[thread overview]
Message-ID: <1114208707.12699@tsunami.he.net> (raw)

--- 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); 

             reply	other threads:[~2005-04-22 22:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-22 22:25 atani [this message]
2005-04-22 22:27 ` [PATCH] update-cache.c ignore directories Fabian Franz
  -- strict thread matches above, loose matches on Subject: below --
2005-04-22 22:34 atani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1114208707.12699@tsunami.he.net \
    --to=atani@atani-software.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.