public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: j.sixt@viscovery•net
To: David Aguilar <davvid@gmail•com>
Cc: <gitster@pobox•com>, <peff@peff•net>, <markus.heidelberg@web•de>,
	<jnareb@gmail•com>, <git@vger•kernel.org>
Subject: Re: [PATCH v6 2/3] compat: add a basename() compatibility function
Date: Sun, 31 May 2009 10:11:02 +0200	[thread overview]
Message-ID: <54809.1243757462@viscovery.net> (raw)

On Sun 31/05/09 06:42 , David Aguilar davvid@gmail•com sent:
> On Sat, May 30, 2009 at 09:37:54PM -0700, David Aguilar wrote:
> > Some systems such as Windows lack libgen.h so provide a
> > basename() implementation for cross-platform use.
> > [...]
> > diff --git a/compat/basename.c b/compat/basename.c
> > new file mode 100644
> > index 0000000..c45716a
> > --- /dev/null
> > +++ b/compat/basename.c
> > @@ -0,0 +1,19 @@
> > +#include "../git-compat-util.h"
> > +
> > +/* Adapted from libiberty's basename.c.  */
> > +char *gitbasename (char *path)
> > +{
> > +	const char *base;
> > +
> > +#ifdef USE_WIN32_FS
> > +	/* Skip over the disk name in MSDOS pathnames. */
> > +	if (isalpha(path[0]) && path[1] == ':')
> > +		path += 2;
> > +#endif
> 
> Thanks for bearing through this series everyone.. ;)
> 
> Can someone with better win32 knowledge let me know if the
> USE_WIN32_FS stuff is needed for msysgit?

No, you don't need it: use

	if (has_dos_drive_prefix(path))
		path += 2;

without any #ifdef.

Thank _you_ for going through so many iterations.

Unfortunately, it may take me a day or two until I can test the patches on 
Windows again.

-- Hannes

             reply	other threads:[~2009-05-31  8:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-31  8:11 j.sixt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-05-31  4:37 [PATCH v6 1/3] compat: add a mkstemps() compatibility function David Aguilar
2009-05-31  4:37 ` [PATCH v6 2/3] compat: add a basename() " David Aguilar
2009-05-31  4:42   ` David Aguilar
2009-05-31  4:53     ` Junio C Hamano

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=54809.1243757462@viscovery.net \
    --to=j.sixt@viscovery$(echo .)net \
    --cc=davvid@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jnareb@gmail$(echo .)com \
    --cc=markus.heidelberg@web$(echo .)de \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox