Thread (28 messages) flat view 28 messages, 6 authors, 2016-06-15

Dokumenting api-paths.txt

From: Stefan Beller <hidden>
Date: 2016-06-15 22:58:28

Possibly related (same subject, not in this thread)

On 08/20/2013 11:34 PM, Jonathan Nieder wrote:
Stefan Beller wrote:
quoted
On 08/20/2013 03:31 PM, Johannes Sixt wrote:
quoted
quoted
quoted
+    packdir = mkpathdup("%s/pack", get_object_directory());
+    packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, getpid());
Should this not be

    packdir = xstrdup(git_path("pack"));
    packtmp = xstrdup(git_path("pack/.tmp-%d-pack", getpid()));
Just a question for documentational purpose. ;)
Am I right suggesting the following:

`mkpathdup`::
	Use parameters to build the path on the filesystem,
	i.e. create required folders and then return a duplicate
	of that path. The caller is responsible to free the memory
Right.  mkpathdup is basically just mkpath composed with xstrdup,
except that it avoids stomping on mkpath's buffers.

The corresponding almost-shortcut for xstrdup(git_path(s)) is
git_pathdup(s).  But that's a minor detail.

Maybe a new Documentation/technical/api-paths.txt is in order.

Thanks,
Jonathan
Is there a way to create a path, without being using git_path?
git_path seems to imply adding .git.

So if I have 
	packdir = xstrdup(git_path("pack"));
	...
	path = git_path("%s/%s", packdir, filename)

This produces something as:
.git/.git/objects/pack/.tmp-13199-pack-c59c5758ef159b272f6ab10cb9fadee443966e71.idx
definitely having one .git too much.

Also interesting to add would be that git_path operates in the
.git/objects directory?

Thanks,
Stefan

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help