From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <stefanbeller@googlemail•com>
Cc: Jonathan Nieder <jrnieder@gmail•com>,
git@vger•kernel.org, Johannes Sixt <j6t@kdbg•org>
Subject: Re: Dokumenting api-paths.txt
Date: Thu, 22 Aug 2013 10:29:02 -0700 [thread overview]
Message-ID: <xmqqy57tr5wh.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <52154282.60701@googlemail.com> (Stefan Beller's message of "Thu, 22 Aug 2013 00:43:14 +0200")
Stefan Beller <stefanbeller@googlemail•com> writes:
>> git_path is for resolving paths within GIT_DIR, such as
>> git_path("config") and git_path("COMMIT_EDITMSG").
>>
>> Jonathan
>
> Before we're doing double work, I just wrote down my understanding
> so far. Feel free to tweak it, or remove obvious parts.
> path API
> ========
I am not sure if they deserve to be called "API"; it is just a
set of simple helper functions.
> `mkpath`::
> The parameters are in printf format. This function can be
> used to construct short-lived filename strings. It is meant
> to be used for direct use in system functions such as
> dir(mkpath("%s/pack", get_objects_directory())).
> The return value is a pointer to such a sanitized filename
> string, but it resides in a static buffer, so it will
> be overwritten by the next call to mkpath (or other functions?)
> This function only does string handling. It doesn't actually
> change anything on the filesystem. (This is not Gits mkdir -p)
>
> `mkpathdup`::
> The same as mkpath, but the memory is duplicated into a new
> buffer, so it is not short-lived, but stays as long as the
> caller doesn't free the memory, which the caller is supposed
> to do.
Good.
> `xstrdup`::
> Duplicates the given string, making the caller responsible
> to free the return value. Basically the same as strdup(2)
> with errorhandling.
>
> I am not sure if this belongs into the path api documentation,
> but it's not documented anywhere else.
This does not belong. It should be grouped together with xmalloc(),
xcalloc(), xrealloc(), etc. and these are not "path" functions.
> `git_path`::
> git_path is for resolving paths within GIT_DIR, such as
> git_path("config") and git_path("COMMIT_EDITMSG").
> This is similar to mkpath, returning a pointer to a static
> buffer, which may be overwritten soon.
>
> `git_pathdup`::
> The same as git_path, but creating a new buffer. The caller
> is responsible to free the returned buffer.
OK.
> `git_path_submodule`::
Similar to git_path() but is run for a submodule specified by the
"path" given as its first parameter.
next prev parent reply other threads:[~2013-08-22 17:29 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 19:23 [PATCH] Rewriting git-repack in C Stefan Beller
2013-08-13 19:23 ` [PATCH] repack: rewrite the shell script " Stefan Beller
2013-08-14 7:26 ` Matthieu Moy
2013-08-14 16:26 ` Stefan Beller
2013-08-14 16:27 ` [RFC PATCH] " Stefan Beller
2013-08-14 16:49 ` Antoine Pelisse
2013-08-14 17:04 ` Stefan Beller
2013-08-14 17:19 ` Jeff King
2013-08-14 17:25 ` Martin Fick
2013-08-14 22:16 ` Stefan Beller
2013-08-14 22:28 ` Martin Fick
2013-08-14 22:53 ` Junio C Hamano
2013-08-14 23:28 ` Martin Fick
2013-08-15 17:15 ` Junio C Hamano
2013-08-16 0:12 ` [RFC PATCHv2] " Stefan Beller
2013-08-17 13:34 ` René Scharfe
2013-08-17 19:18 ` Kyle J. McKay
2013-08-18 14:34 ` Stefan Beller
2013-08-18 14:36 ` [RFC PATCHv3] " Stefan Beller
2013-08-18 15:41 ` Kyle J. McKay
2013-08-18 16:44 ` René Scharfe
2013-08-18 22:26 ` [RFC PATCHv4] " Stefan Beller
2013-08-19 23:23 ` Stefan Beller
2013-08-20 13:31 ` Johannes Sixt
2013-08-20 15:08 ` Stefan Beller
2013-08-20 18:38 ` Johannes Sixt
2013-08-20 18:57 ` René Scharfe
2013-08-20 22:36 ` Stefan Beller
2013-08-20 22:38 ` [PATCH] " Stefan Beller
2013-08-21 8:25 ` Jonathan Nieder
2013-08-21 10:37 ` Stefan Beller
2013-08-21 17:25 ` Stefan Beller
2013-08-21 17:28 ` [RFC PATCHv6 1/2] " Stefan Beller
2013-08-21 17:28 ` [RFC PATCHv6 2/2] repack: retain the return value of pack-objects Stefan Beller
2013-08-21 20:56 ` [RFC PATCHv6 1/2] repack: rewrite the shell script in C Junio C Hamano
2013-08-21 21:52 ` Matthieu Moy
2013-08-21 22:15 ` Stefan Beller
2013-08-21 22:50 ` Junio C Hamano
2013-08-21 22:57 ` Stefan Beller
2013-08-22 10:46 ` Johannes Sixt
2013-08-22 21:03 ` Jonathan Nieder
2013-08-21 8:49 ` [PATCH] " Matthieu Moy
2013-08-21 12:47 ` Stefan Beller
2013-08-21 13:05 ` Matthieu Moy
2013-08-21 12:53 ` Stefan Beller
2013-08-21 13:07 ` Matthieu Moy
2013-08-22 10:46 ` Johannes Sixt
2013-08-22 10:46 ` Johannes Sixt
2013-08-22 20:06 ` [PATCH] repack: rewrite the shell script in C (squashing proposal) Stefan Beller
2013-08-22 20:31 ` Junio C Hamano
2013-08-20 22:46 ` [RFC PATCHv4] repack: rewrite the shell script in C Jonathan Nieder
2013-08-21 9:20 ` Johannes Sixt
2013-08-20 21:24 ` Stefan Beller
2013-08-20 21:34 ` Jonathan Nieder
2013-08-20 21:40 ` Dokumenting api-paths.txt Stefan Beller
2013-08-20 21:59 ` Jonathan Nieder
2013-08-21 22:43 ` Stefan Beller
2013-08-22 17:29 ` Junio C Hamano [this message]
2013-08-14 22:51 ` [RFC PATCH] repack: rewrite the shell script in C Junio C Hamano
2013-08-14 22:59 ` Matthieu Moy
2013-08-15 7:47 ` Stefan Beller
2013-08-15 4:15 ` Duy Nguyen
2013-08-14 17:26 ` Junio C Hamano
2013-08-14 22:51 ` Matthieu Moy
2013-08-14 23:25 ` Martin Fick
2013-08-15 0:26 ` Martin Fick
2013-08-15 7:46 ` Stefan Beller
2013-08-15 15:04 ` Martin Fick
2013-08-15 4:20 ` Duy Nguyen
2013-08-14 17:04 ` Junio C Hamano
2013-08-15 7:53 ` Stefan Beller
2013-08-14 7:12 ` [PATCH] Rewriting git-repack " Matthieu Moy
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=xmqqy57tr5wh.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=j6t@kdbg$(echo .)org \
--cc=jrnieder@gmail$(echo .)com \
--cc=stefanbeller@googlemail$(echo .)com \
/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